Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions bindings/rust/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions queries/tags.scm
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
; Method definitions

; A Sorbet `sig` block sits between a method's doc comment and its definition, so
; the comment is not adjacent to the definition and the general pattern below
; cannot attach it. Anchoring adjacency on the `sig` call instead recovers the
; doc comment. This must precede the general pattern: when several patterns match
; the same node, tree-sitter-tags keeps the one from the earliest pattern.
(
(comment)* @doc
.
(call
method: (identifier) @reference.call
block: [
(block)
(do_block)
])
.
[
(method
name: (_) @name) @definition.method
(singleton_method
name: (_) @name) @definition.method
]
(#eq? @reference.call "sig")
(#strip! @doc "^#\\s*")
(#select-adjacent! @doc @reference.call)
)

(
(comment)* @doc
.
Expand Down
Loading