Open igorlfs opened 1 month ago
EDIT: this might be an issue with lazy loading, since I was defining the keys via lazy.nvim's keys property 🤔
I see the same issue.
return {
'nvim-treesitter/nvim-treesitter-textobjects',
branch = 'main',
opts = {
select = {
lookahead = true,
},
lsp_interop = {
floating_preview_opts = {},
},
move = {
set_jumps = true,
},
},
keys = {
--...
{
']A',
function()
require('nvim-treesitter-textobjects.swap').swap_next(
'@parameter.inner'
)
end,
desc = 'Swap argument',
},
-- ...
},
}
Mine works with this:
return {
{
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
branch = "master",
lazy = false,
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup {
ensure_installed = {
...
},
auto_install = true,
highlight = {
enable = true,
},
textobjects = {
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
}
end,
},
}
Mine works with this:
return { { "nvim-treesitter/nvim-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", }, branch = "master", lazy = false, build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup { ensure_installed = { ... }, auto_install = true, highlight = { enable = true, }, textobjects = { swap = { enable = true, swap_next = { ["<leader>a"] = "@parameter.inner", }, swap_previous = { ["<leader>A"] = "@parameter.inner", }, }, }, } end, }, }
we're discussing the main branch (not master) here, which addresses #503.
Trying to be helpful wasn't helpful 🤦♂️ 😁 sorry I didn't fully read the [main]
part.
Describe the bug The recommended setup for swapping text objects on main is:
But these keymaps don't work: nothing is swapped, and no error is thrown. Based on the setup for default branch, I think there's a typo and it should be
However, these keymaps also don't work.
To Reproduce Steps to reproduce the behavior:
<leader>a
on an argumentExpected behavior Arguments should be swapped
Output of
:checkhealth nvim-treesitter
============================================================================== nvim-treesitter: require("nvim-treesitter.health").check() Installation ~ - WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall) - OK `node` found v20.13.1 (only needed for :TSInstallFromGrammar) - OK `git` executable found. - OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: cc (GCC) 14.1.1 20240522 - OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI. OS Info: { machine = "x86_64", release = "6.9.1-arch1-2", sysname = "Linux", version = "#1 SMP PREEMPT_DYNAMIC Wed, 22 May 2024 13:47:07 +0000" } ~ Parser/Features H L F I J - bash ✓ ✓ ✓ . ✓ - bibtex ✓ . ✓ ✓ . - c ✓ ✓ ✓ ✓ ✓ - comment ✓ . . . . - cpp ✓ ✓ ✓ ✓ ✓ - css ✓ . ✓ ✓ ✓ - diff ✓ . . . . - gdscript ✓ ✓ ✓ ✓ ✓ - gitcommit ✓ . . . ✓ - gitignore ✓ . . . . - html ✓ ✓ ✓ ✓ ✓ - hyprlang ✓ . ✓ ✓ ✓ - java ✓ ✓ ✓ ✓ ✓ - javascript ✓ ✓ ✓ ✓ ✓ - jsdoc ✓ . . . . - json ✓ ✓ ✓ ✓ . - jsonc ✓ ✓ ✓ ✓ ✓ - lua ✓ ✓ ✓ ✓ ✓ - make ✓ . ✓ . ✓ - markdown ✓ . ✓ ✓ ✓ - markdown_inline ✓ . . . ✓ - python ✓ ✓ ✓ ✓ ✓ - query ✓ ✓ ✓ ✓ ✓ - regex ✓ . . . . - requirements ✓ . . . ✓ - rust ✓ ✓ ✓ ✓ ✓ - scss ✓ . ✓ ✓ . - sql ✓ . . ✓ ✓ - svelte ✓ ✓ ✓ ✓ ✓ - toml ✓ ✓ ✓ ✓ ✓ - tsx ✓ ✓ ✓ ✓ ✓ - typescript ✓ ✓ ✓ ✓ ✓ - typst ✓ . ✓ ✓ ✓ - vim ✓ ✓ ✓ . ✓ - vimdoc ✓ . . . ✓ - yaml ✓ ✓ ✓ ✓ ✓ - zathurarc ✓ . . . ✓ 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