Skip to content

Commit

Permalink
docs: improve usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Jun 12, 2024
1 parent 87cbf7e commit b93a8b1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: Docs

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

on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [master]
push:
branches: [master]
paths:
- ktreesitter/README.md

concurrency:
cancel-in-progress: true
Expand All @@ -20,7 +24,9 @@ jobs:
docs:
runs-on: ubuntu-latest
name: Publish docs on GitHub pages
if: github.event.workflow_run.conclusion == 'success'
if: >-
github.event_name == 'push' ||
github.event.workflow_run.conclusion == 'success'
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Some bundled languages that are relevant to Kotlin development.
[tree-sitter]: https://tree-sitter.github.io/tree-sitter/
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/kotlin-tree-sitter/ci.yml?logo=github&label=CI
[central]: https://img.shields.io/maven-central/v/io.github.tree-sitter/ktreesitter?logo=sonatype&label=Maven%20Central
[portal]: https://img.shields.io/gradle-plugin-portal/v/io.github.treesitter.ktreesitter-plugin?logo=gradle&label=Gradle%20Plugin%20Portal
[portal]: https://img.shields.io/gradle-plugin-portal/v/io.github.tree-sitter.ktreesitter-plugin?logo=gradle&label=Gradle%20Plugin%20Portal
[docs]: https://img.shields.io/github/deployments/tree-sitter/kotlin-tree-sitter/github-pages?logo=kotlin&label=API%20Docs
12 changes: 6 additions & 6 deletions ktreesitter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ repositories {
## Basic usage

```kotlin
import io.github.treesitter.ktreesitter.*
import io.github.treesitter.ktreesitter.java.TreeSitterJava

val language = Language(TreeSitterJava.language())
val language = Language(TreeSitterKotlin.language())
val parser = Parser(language)
val tree = parser.parse("class Foo {}")
val tree = parser.parse("fun main() {}")
val rootNode = tree.rootNode

assert(tree.rootNode.type == "program")
assert(rootNode.type == "source_file")
assert(rootNode.startPoint.column == 0)
assert(rootNode.endPoint.column == 13)
```

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

0 comments on commit b93a8b1

Please sign in to comment.