mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 04:50:03 -04:00
feat(incremental_selection): don't require locals
This commit is contained in:
parent
3695e58dd3
commit
afd5d11519
2 changed files with 8 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ local configs = require'nvim-treesitter.configs'
|
|||
local ts_utils = require'nvim-treesitter.ts_utils'
|
||||
local locals = require'nvim-treesitter.locals'
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
local queries = require'nvim-treesitter.query'
|
||||
|
||||
local M = {}
|
||||
|
||||
|
|
@ -114,7 +115,12 @@ M.node_incremental = select_incremental(function(node)
|
|||
end)
|
||||
|
||||
M.scope_incremental = select_incremental(function(node)
|
||||
return locals.containing_scope(node:parent() or node)
|
||||
local lang = parsers.get_buf_lang()
|
||||
if queries.has_locals(lang) then
|
||||
return locals.containing_scope(node:parent() or node)
|
||||
else
|
||||
return node
|
||||
end
|
||||
end)
|
||||
|
||||
function M.node_decremental()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue