mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-07 14:00:00 -04:00
feat(starlark): build targets as locals
Problem: I have very big BUILD files I want to navigate quickly. I have Telescope, so I can use `:Telescope treesitter` for an outline, but build targets aren't emitted as definitions. Solution: Add a query that catches build targets. One thing I'm unclear on is: - I want to filter to just build targets. - Build targets are absolutely not any of the mentioned types in the CONTRIBUTING file. - Build targets do not actually create identifiers in buck2/bazel: they create objects which are observable to the outside world and which the user generally *cares* about, but they aren't in the same namespace as normal identifiers. This means that they *especially* don't fit into any of the existing categories. I would like guidance as to whether this is the right approach.
This commit is contained in:
parent
0606c7a9dc
commit
7815bfb108
3 changed files with 13 additions and 0 deletions
|
|
@ -156,6 +156,7 @@
|
|||
"local.definition.namespace": "modules or namespaces",
|
||||
"local.definition.import": "imported names",
|
||||
"local.definition.associated": "the associated type of a variable",
|
||||
"local.definition.target": "build targets",
|
||||
"local.scope": "scope block",
|
||||
"local.reference": "identifier reference"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,6 +494,7 @@ are only provided for limited backwards compatibility.
|
|||
@local.definition.namespace ; modules or namespaces
|
||||
@local.definition.import ; imported names
|
||||
@local.definition.associated ; the associated type of a variable
|
||||
@local.definition.target ; a build target (which may not be an identifier)
|
||||
|
||||
@local.scope ; scope block
|
||||
@local.reference ; identifier reference
|
||||
|
|
|
|||
|
|
@ -94,3 +94,14 @@
|
|||
arguments: (argument_list
|
||||
(string) @local.definition.import))
|
||||
(#eq? @_fn "load"))
|
||||
|
||||
; Build target definitions
|
||||
((module
|
||||
(expression_statement
|
||||
(call
|
||||
arguments: (argument_list
|
||||
(keyword_argument
|
||||
name: (identifier) @_name
|
||||
value: (string
|
||||
(string_content) @local.definition.target))))))
|
||||
(#eq? @_name "name"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue