feature/treesitter-tag-queries #2
2 changed files with 162 additions and 0 deletions
119
references/COMMUNITY_TAGS_FINDINGS.md
Normal file
119
references/COMMUNITY_TAGS_FINDINGS.md
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
# Community tags.scm — Source Audit
|
||||
|
||||
Audit date: July 3, 2026
|
||||
Source: Individual tree-sitter grammar repos (NOT nvim-treesitter)
|
||||
|
||||
## Correction
|
||||
|
||||
Existing `references/tags-queries/` files match grammar-repo content, NOT
|
||||
nvim-treesitter. The ANALYSIS.md report checked only nvim-treesitter (404).
|
||||
All grammar repos have live tags.scm.
|
||||
|
||||
## Availability
|
||||
|
||||
| Language | Grammar Repo | Has tags.scm? |
|
||||
|----------|-------------|---------------|
|
||||
| Python | tree-sitter/tree-sitter-python | YES |
|
||||
| JavaScript | tree-sitter/tree-sitter-javascript | YES |
|
||||
| Ruby | tree-sitter/tree-sitter-ruby | YES |
|
||||
| Go | tree-sitter/tree-sitter-go | YES |
|
||||
| Rust | tree-sitter/tree-sitter-rust | YES |
|
||||
| Java | tree-sitter/tree-sitter-java | YES |
|
||||
| C | tree-sitter/tree-sitter-c | YES |
|
||||
| C++ | tree-sitter/tree-sitter-cpp | YES |
|
||||
| TypeScript | tree-sitter/tree-sitter-typescript | YES |
|
||||
| Kotlin | fwcd/tree-sitter-kotlin | YES |
|
||||
|
||||
## Captures Per Language
|
||||
|
||||
### Python
|
||||
- `@definition.class` — class_definition name
|
||||
- `@definition.function` — function_definition name
|
||||
- `@definition.constant` — module-level assignment LHS
|
||||
- `@reference.call` — call function (identifier or attribute)
|
||||
|
||||
### JavaScript
|
||||
- `@definition.class` — class / class_declaration
|
||||
- `@definition.function` — function_declaration, function_expression, arrow_function
|
||||
- `@definition.method` — method_definition
|
||||
- `@definition.constant` — export_statement with value
|
||||
- `@reference.call` — call_expression function name
|
||||
- `@reference.class` — new_expression constructor
|
||||
|
||||
### Ruby
|
||||
- `@definition.class` — class / singleton_class
|
||||
- `@definition.method` — method / singleton_method / alias
|
||||
- `@definition.module` — module
|
||||
- `@reference.call` — call method / identifier
|
||||
|
||||
### Go
|
||||
- `@definition.function` — function_declaration
|
||||
- `@definition.method` — method_declaration
|
||||
- `@definition.type` — type_spec
|
||||
- `@reference.call` — call_expression (direct + selector)
|
||||
- `@reference.type` — type_identifier references
|
||||
- Plus: package, import, var, const, struct, interface declarations
|
||||
|
||||
### Rust
|
||||
- `@definition.class` — struct / enum / union / type_item
|
||||
- `@definition.function` — function_item
|
||||
- `@definition.method` — function_item in declaration_list
|
||||
- `@definition.interface` — trait_item
|
||||
- `@definition.module` — mod_item
|
||||
- `@definition.macro` — macro_definition
|
||||
- `@reference.call` — call_expression (direct + field + macro)
|
||||
- `@reference.implementation` — impl_item
|
||||
|
||||
### Java
|
||||
- `@definition.class` — class_declaration
|
||||
- `@definition.method` — method_declaration
|
||||
- `@definition.interface` — interface_declaration
|
||||
- `@reference.call` — method_invocation with argument_list
|
||||
- `@reference.implementation` — type_list in implements
|
||||
- `@reference.class` — object_creation_expression, superclass
|
||||
|
||||
### C
|
||||
- `@definition.class` — struct_specifier
|
||||
- `@definition.function` — function_declarator
|
||||
- `@definition.type` — type_definition, enum_specifier
|
||||
|
||||
### C++
|
||||
- `@definition.class` — struct_specifier, union_specifier, class_specifier
|
||||
- `@definition.function` — function_declarator (identifier)
|
||||
- `@definition.method` — function_declarator (qualified_identifier)
|
||||
- `@definition.type` — type_definition, enum_specifier
|
||||
|
||||
### TypeScript
|
||||
- `@definition.function` — function_signature
|
||||
- `@definition.method` — method_signature, abstract_method_signature
|
||||
- `@definition.class` — abstract_class_declaration
|
||||
- `@definition.module` — module
|
||||
- `@definition.interface` — interface_declaration
|
||||
- `@reference.type` — type_annotation
|
||||
- `@reference.class` — new_expression
|
||||
|
||||
### Kotlin
|
||||
- `@definition.class` — class_declaration, object_declaration, companion_object
|
||||
- `@definition.function` — function_declaration (simple_identifier)
|
||||
- `@definition.constant` — property_declaration, enum_entry
|
||||
- `@definition.type` — type_alias
|
||||
- `@reference.call` — call_expression, navigation_expression
|
||||
- `@reference.class` — constructor_invocation
|
||||
|
||||
## Core Vocabulary (present in all)
|
||||
|
||||
- `@definition.*` — declaration/definition sites
|
||||
- `@reference.*` — usage/reference sites
|
||||
|
||||
## Gaps vs Dervish Sequence Needs
|
||||
|
||||
| Need | Present in any community tags.scm? |
|
||||
|------|-----------------------------------|
|
||||
| Call tracking | Java, Python, Go, Rust, Kotlin, JS, Ruby |
|
||||
| Constructor tracking | Java, TypeScript, Kotlin, JS |
|
||||
| Class/method/function defs | All |
|
||||
| Control flow (if/else/when) | **0 languages** |
|
||||
| Error handling (try/catch/throw) | **0 languages** |
|
||||
| Return statements | **0 languages** |
|
||||
| Annotations/decorators | **0 languages** |
|
||||
| Ordered sequences | **0 languages** |
|
||||
43
references/tags-queries/kotlin_tags_query.scm
Normal file
43
references/tags-queries/kotlin_tags_query.scm
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
; Classes
|
||||
(class_declaration
|
||||
(type_identifier) @name) @definition.class
|
||||
|
||||
; Objects
|
||||
(object_declaration
|
||||
(type_identifier) @name) @definition.class
|
||||
|
||||
; Functions (top-level and member)
|
||||
(function_declaration
|
||||
(simple_identifier) @name) @definition.function
|
||||
|
||||
; Properties
|
||||
(property_declaration
|
||||
(variable_declaration
|
||||
(simple_identifier) @name)) @definition.constant
|
||||
|
||||
; Enum entries
|
||||
(enum_entry
|
||||
(simple_identifier) @name) @definition.constant
|
||||
|
||||
; Type aliases
|
||||
(type_alias
|
||||
(type_identifier) @name) @definition.type
|
||||
|
||||
; Companion objects (only named ones)
|
||||
(companion_object
|
||||
(type_identifier) @name) @definition.class
|
||||
|
||||
; Function calls
|
||||
(call_expression
|
||||
(simple_identifier) @name) @reference.call
|
||||
|
||||
; Method calls via navigation
|
||||
(call_expression
|
||||
(navigation_expression
|
||||
(navigation_suffix
|
||||
(simple_identifier) @name))) @reference.call
|
||||
|
||||
; Constructor invocations (class references)
|
||||
(constructor_invocation
|
||||
(user_type
|
||||
(type_identifier) @name)) @reference.class
|
||||
Loading…
Add table
Reference in a new issue