Skip to content

Commit b93a8b1

Browse files
docs: improve usage example
1 parent 87cbf7e commit b93a8b1

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

.github/workflows/docs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
name: Docs
22

3-
run-name: ${{github.event.workflow_run.head_commit.message}}
3+
run-name: Update API docs
44

55
on:
66
workflow_run:
77
workflows: [CI]
88
types: [completed]
99
branches: [master]
10+
push:
11+
branches: [master]
12+
paths:
13+
- ktreesitter/README.md
1014

1115
concurrency:
1216
cancel-in-progress: true
@@ -20,7 +24,9 @@ jobs:
2024
docs:
2125
runs-on: ubuntu-latest
2226
name: Publish docs on GitHub pages
23-
if: github.event.workflow_run.conclusion == 'success'
27+
if: >-
28+
github.event_name == 'push' ||
29+
github.event.workflow_run.conclusion == 'success'
2430
environment:
2531
name: github-pages
2632
url: ${{steps.deployment.outputs.page_url}}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ Some bundled languages that are relevant to Kotlin development.
2626
[tree-sitter]: https://tree-sitter.github.io/tree-sitter/
2727
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/kotlin-tree-sitter/ci.yml?logo=github&label=CI
2828
[central]: https://img.shields.io/maven-central/v/io.github.tree-sitter/ktreesitter?logo=sonatype&label=Maven%20Central
29-
[portal]: https://img.shields.io/gradle-plugin-portal/v/io.github.treesitter.ktreesitter-plugin?logo=gradle&label=Gradle%20Plugin%20Portal
29+
[portal]: https://img.shields.io/gradle-plugin-portal/v/io.github.tree-sitter.ktreesitter-plugin?logo=gradle&label=Gradle%20Plugin%20Portal
3030
[docs]: https://img.shields.io/github/deployments/tree-sitter/kotlin-tree-sitter/github-pages?logo=kotlin&label=API%20Docs

ktreesitter/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ repositories {
2626
## Basic usage
2727

2828
```kotlin
29-
import io.github.treesitter.ktreesitter.*
30-
import io.github.treesitter.ktreesitter.java.TreeSitterJava
31-
32-
val language = Language(TreeSitterJava.language())
29+
val language = Language(TreeSitterKotlin.language())
3330
val parser = Parser(language)
34-
val tree = parser.parse("class Foo {}")
31+
val tree = parser.parse("fun main() {}")
32+
val rootNode = tree.rootNode
3533

36-
assert(tree.rootNode.type == "program")
34+
assert(rootNode.type == "source_file")
35+
assert(rootNode.startPoint.column == 0)
36+
assert(rootNode.endPoint.column == 13)
3737
```
3838

3939
[tree-sitter]: https://tree-sitter.github.io/tree-sitter/

0 commit comments

Comments
 (0)