Updates to treesitter queries to support upstream changes (#425)

* Adjusted local.scm queries to fix crashes when using treesitter post-v0.9.2

* Accounted for 'local' subtable in treesitter matches when querying locals
pull/420/head
Allen Horine 3 months ago committed by GitHub
parent 974b2f8518
commit 41c126718a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,15 +1,15 @@
; extends
(var_spec) @scope
(var_spec) @local.scope
(field_declaration
name: (field_identifier) @definition.field)
name: (field_identifier) @local.definition.field)
(method_spec
name: (field_identifier) @method.name
parameters: (parameter_list) @method.parameter_list) @interface.method.declaration
name: (field_identifier) @function.method.name
parameters: (parameter_list) @function.method.parameter_list) @local.interface.method.declaration
(type_declaration
(type_spec
name: (type_identifier) @name
type: [(struct_type) (interface_type)] @type)) @start
name: (type_identifier) @local.name
type: [(struct_type) (interface_type)] @local.type)) @local.start

@ -40,6 +40,7 @@ local function get_definitions(bufnr)
-- Make sure the nodes are unique.
local nodes_set = {}
for _, loc in ipairs(local_nodes) do
loc = loc["local"]
if loc.definition then
locals.recurse_local_nodes(loc.definition, function(_, node, _, match)
-- lua doesn't compare tables by value,

Loading…
Cancel
Save