Closed kvietcong closed 1 year ago
So none of the combinations daf
(delete a function) vaf
(select a function) would work for? Not even the go-to commands?
Yes, none of those work. It just puts me into visual mode (no cursor movement) or waits for a text object. The go tos dont work either
@kvietcong did you fix this? It happens to me as well sometimes, although for me swap
doenst work, but move
does. I dont think I changed anything.
@dmatos2012 Sadly I have not been able to fix this. I haven't tested this yet but this might be a Windows problem. I'll have to test it out on Linux later
I have same problem. I defined mapping with config below but swap
and lsp_interop
are not defined at all - cannot see it in mappings. Only select
andmove
seem to work fine :thinking:
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = { ["<leader>z"] = "@parameter.inner" },
swap_previous = { ["<leader>Z"] = "@parameter.inner" },
},
lsp_interop = {
enable = true,
border = "none",
peek_definition_code = {
["<leader>df"] = "@function.outer",
["<leader>dF"] = "@class.outer",
},
},
}
Yeah even after removing swap and lsp_interop, it sadly doesn't work
Same for me, lsp_interop peek_definition doesn't work since many days now :/ selection is ok though
--- https://github.com/nvim-treesitter/nvim-treesitter
require('nvim-treesitter.configs').setup({
ensure_installed = 'maintained',
highlight = {
enable = true,
},
playground = {
enable = false,
},
indent = {
enable = true,
},
textobjects = {
lsp_interop = {
enable = true,
border = 'rounded',
peek_definition_code = {
['df'] = '@function.outer',
['dF'] = '@class.outer',
},
},
select = {
enable = true,
lookahead = true,
keymaps = {
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
},
autopairs = {
enable = true, -- check for autopairs (see nvim-autopairs)
},
-- https://github.com/nvim-treesitter/nvim-treesitter-refactor
refactor = {
highlight_definitions = {
enable = true,
},
smart_rename = {
enable = true,
keymaps = {
smart_rename = 'R',
},
},
navigation = {
enable = true,
keymaps = {
goto_definition_lsp_fallback = 'gnd',
list_definitions = 'gnD',
list_definitions_toc = 'gO',
goto_next_usage = '<a-*>',
goto_previous_usage = '<a-µ>',
},
},
},
})
Did anyone manage to solve this bug? Select does not work for me as well
@artemrakov Even, :TSTextobjectSelect @function.outer
wouldn't work for you?
Sorry, my bad. Didn't install TreeSitter parser (TSIntall
) :D. After installation, it worked.
:TSTextobjectSelect @function.outer
actually showed me the error. Thanks @theHamsta
I have the same problem. With the defaullt config taken from the README neither daf
, dif
, vaf
or any other binding works. Running :TSTextobjectSelect @function.outer
directly does work as intended.
^^ Yep, same issue. Command works. But binds from the readme are broke.
@sozomon i had the problem because i put the config in the lua/plugin
directory instead of after/plugin
. Now everything works.
@Nimmidev Fixed after reinstalling treesitter cargo cli. Idk why it did not work on last reinstall
Closing as many people resolved the issue. Feel free to reopen
I came across this issue too, following this guide helped me install it correctly for lazy.nvim.
Describe the bug The text objects I set are non-existent. When I try the bindings within the configuration (at the bottom), nothing happens. There's no error messages or anything like that. It is as if they weren't set. Thanks for any help
Expected behavior I was expecting the text objects to be selected, cleared, etc when I acted upon them
Output of
:checkhealth nvim_treesitter
health#nvim_treesitter#check ======================================================================== ## Installation - WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall) - OK: `node` found v16.4.1 (only needed for :TSInstallFromGrammar) - OK: `git` executable found. - OK: `gcc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl" } - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI. ## Parser/Features H L F I J - python ✓ ✓ ✓ ✓ ✓ - haskell ✓ . . . ✓ - yaml ✓ ✓ ✓ ✓ ✓ - javascript ✓ ✓ ✓ ✓ ✓ - commonlisp ✓ ✓ ✓ . . - json ✓ ✓ ✓ ✓ . - rust ✓ ✓ ✓ ✓ ✓ - c ✓ ✓ ✓ ✓ ✓ - html ✓ ✓ ✓ ✓ ✓ - css ✓ . ✓ ✓ ✓ - lua ✓ ✓ ✓ ✓ ✓ Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections +) multiple parsers found, only one will be used x) errors found in the query, try to run :TSUpdate {lang}
Output of
nvim --version
Additional context My Text Objects Configuration