mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -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",
|
scope_incremental="grc",
|
||||||
node_decremental="grm"
|
node_decremental="grm"
|
||||||
},
|
},
|
||||||
is_supported = queries.has_locals
|
is_supported = function() return true end
|
||||||
},
|
},
|
||||||
indent = {
|
indent = {
|
||||||
module_path = 'nvim-treesitter.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 ts_utils = require'nvim-treesitter.ts_utils'
|
||||||
local locals = require'nvim-treesitter.locals'
|
local locals = require'nvim-treesitter.locals'
|
||||||
local parsers = require'nvim-treesitter.parsers'
|
local parsers = require'nvim-treesitter.parsers'
|
||||||
|
local queries = require'nvim-treesitter.query'
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
@ -114,7 +115,12 @@ M.node_incremental = select_incremental(function(node)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
M.scope_incremental = select_incremental(function(node)
|
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)
|
end)
|
||||||
|
|
||||||
function M.node_decremental()
|
function M.node_decremental()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue