mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 12:06:55 -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
|
|
@ -37,7 +37,7 @@ local builtin_modules = {
|
|||
scope_incremental="grc",
|
||||
node_decremental="grm"
|
||||
},
|
||||
is_supported = queries.has_locals
|
||||
is_supported = function() return true end
|
||||
},
|
||||
indent = {
|
||||
module_path = 'nvim-treesitter.indent',
|
||||
|
|
|
|||
|
|
@ -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