mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
feat(locals)!: switch to upstream captures
This commit is contained in:
parent
306367a7f4
commit
8fb218dbfd
95 changed files with 1154 additions and 1154 deletions
|
|
@ -89,8 +89,8 @@ end
|
|||
-- The accumulator function is given
|
||||
-- * The table of the node
|
||||
-- * The node
|
||||
-- * The full definition match `@definition.var.something` -> 'var.something'
|
||||
-- * The last definition match `@definition.var.something` -> 'something'
|
||||
-- * The full definition match `@local.definition.var.something` -> 'var.something'
|
||||
-- * The last definition match `@local.definition.var.something` -> 'something'
|
||||
---@param local_def TSLocal The locals result
|
||||
---@param accumulator function The accumulator function
|
||||
---@param full_match? string The full match path to append to
|
||||
|
|
@ -201,20 +201,20 @@ M.get = memoize(function(bufnr)
|
|||
|
||||
local scope = 'local' ---@type string
|
||||
for k, v in pairs(metadata) do
|
||||
if type(k) == 'string' and vim.endswith(k, 'scope') then
|
||||
if type(k) == 'string' and vim.endswith(k, 'local.scope') then
|
||||
scope = v
|
||||
end
|
||||
end
|
||||
|
||||
if node and vim.startswith(kind, 'definition') then
|
||||
if node and vim.startswith(kind, 'local.definition') then
|
||||
table.insert(definitions, { kind = kind, node = node, scope = scope })
|
||||
end
|
||||
|
||||
if node and kind == 'scope' then
|
||||
if node and kind == 'local.scope' then
|
||||
table.insert(scopes, node)
|
||||
end
|
||||
|
||||
if node and kind == 'reference' then
|
||||
if node and kind == 'local.reference' then
|
||||
table.insert(references, { kind = kind, node = node, scope = scope })
|
||||
end
|
||||
end
|
||||
|
|
@ -352,7 +352,7 @@ function M.find_usages(node, scope_node, bufnr)
|
|||
local kind = query.captures[id]
|
||||
if
|
||||
node_capture
|
||||
and kind == 'reference'
|
||||
and kind == 'local.reference'
|
||||
and ts.get_node_text(node_capture, bufnr) == node_text
|
||||
then
|
||||
table.insert(usages, node_capture)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue