diff --git a/.tsqueryrc.json b/.tsqueryrc.json index cd3a692d5..0c456a4fe 100644 --- a/.tsqueryrc.json +++ b/.tsqueryrc.json @@ -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" } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f376ed802..90e22b308 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/runtime/queries/starlark/locals.scm b/runtime/queries/starlark/locals.scm index 82ec0b5d2..aa50ce3df 100644 --- a/runtime/queries/starlark/locals.scm +++ b/runtime/queries/starlark/locals.scm @@ -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"))