generated from nvim-treesitter/module-template
-
Notifications
You must be signed in to change notification settings - Fork 247
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Sometimes inner parameter selection ignores the current scope and selects the first parameter in the nested scope instead.
To Reproduce
Steps to reproduce the behavior:
init.lua:
local thisInitFile = debug.getinfo(1).source:match('@?(.*)')
local cwd = vim.fs.dirname(thisInitFile)
local appname = vim.env.NVIM_APPNAME or 'nvim'
vim.env.XDG_CONFIG_HOME = cwd
vim.env.XDG_DATA_HOME = vim.fs.joinpath(cwd, '.xdg', 'data')
vim.env.XDG_STATE_HOME = vim.fs.joinpath(cwd, '.xdg', 'state')
vim.env.XDG_CACHE_HOME = vim.fs.joinpath(cwd, '.xdg', 'cache')
vim.fn.mkdir(vim.fs.joinpath(vim.env.XDG_CACHE_HOME, appname), 'p')
local stdPathConfig = vim.fn.stdpath('config')
vim.opt.runtimepath:prepend(stdPathConfig)
vim.opt.packpath:prepend(stdPathConfig)
local function gitClone(url, installPath, branch)
if vim.fn.isdirectory(installPath) ~= 0 then
return
end
local command = {'git', 'clone', '--', url, installPath}
if branch then
table.insert(command, 3, '--branch')
table.insert(command, 4, branch)
end
vim.notify(('Cloning %s dependency into %s...'):format(url, installPath), vim.log.levels.INFO, {})
local sysObj = vim.system(command, {}):wait()
if sysObj.code ~= 0 then
error(sysObj.stderr)
end
vim.notify(sysObj.stdout)
vim.notify(sysObj.stderr, vim.log.levels.WARN)
end
local pluginsPath = vim.fs.joinpath(cwd, 'nvim/pack/plugins/opt')
vim.fn.mkdir(pluginsPath, 'p')
pluginsPath = vim.uv.fs_realpath(pluginsPath)
--- @type table<string, {url:string, branch: string?}>
local plugins = {
['nvim-treesitter-textobjects'] = {url = 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', branch = 'main'},
}
for name, repo in pairs(plugins) do
local installPath = vim.fs.joinpath(pluginsPath, name)
gitClone(repo.url, installPath, repo.branch)
vim.cmd.packadd({args = {name}, bang = true})
end
vim.keymap.set({'x', 'o'}, 'ip', function ()
require 'nvim-treesitter-textobjects.select'.select_textobject('@parameter.inner', 'textobjects')
end)
vim.go.hlsearch = false
local function foo()
vim.print(1, tonumber('1'), {'x'})
end
vim.api.nvim_feedkeys(vim.keycode('/tonumber<CR>'), 'n', false)nvim --clean -u init.lua init.lua- type
vip(for me'1'is selected) - escape visual mode, go to space before
{x}and typevipagain (for me'x'is selected).
Expected behavior
Selected:
tonumber('1')in step 2.{'x'}in step 3.
Output of :checkhealth vim.treesitter
Details
vim.treesitter: require("vim.treesitter.health").check()
- Nvim runtime ABI version: 14
- OK Parser: c ABI: 14, path: .../nvim-from-src/lib/nvim/parser/c.so
- OK Parser: lua ABI: 14, path: .../nvim-from-src/lib/nvim/parser/lua.so
- OK Parser: markdown ABI: 14, path: .../nvim-from-src/lib/nvim/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: .../nvim-from-src/lib/nvim/parser/markdown_inline.so
- OK Parser: query ABI: 14, path: .../nvim-from-src/lib/nvim/parser/query.so
- OK Parser: vim ABI: 14, path: .../nvim-from-src/lib/nvim/parser/vim.so
- OK Parser: vimdoc ABI: 14, path: .../nvim-from-src/lib/nvim/parser/vimdoc.so
- Can load WASM parsers: false
Output of nvim --version
v0.11.0-dev-941+gcd8e15e33
PMassicotte and miduddin
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working