nvim-treesitter / nvim-treesitter-textobjects

Apache License 2.0
2.2k stars 200 forks source link

Rust: `@parameter` doesn't work correctly in macros #698

Open kamack38 opened 1 month ago

kamack38 commented 1 month ago

Describe the bug The @parameter.inner and @parameter.outer selectors does not work correctly inside function which are inside a macro.

To Reproduce

assert!(fu^nc("arg"), &r^ef, So^me(4));

Now run dia (Delete @parameter.inner) with cursour in every ^ separately. The results are:

assert!(("arg"), &ref, Some(4));
assert!(func("arg"), &, Some(4));
assert!(func("arg"), &ref,(4));

Expected behavior

assert!(, &ref, Some(4));
assert!(func("arg"), , Some(4));
assert!(func("arg"), &ref,);

If we remove the shabang (!) and treat it as a function assert, then every keybinding works as expected.

Output of :checkhealth nvim-treesitter

Paste the output here ============================================================================== 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.11.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.2.1 20240805 - 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.10.6-arch1-1.1-g14", sysname = "Linux", version = "#1 SMP PREEMPT_DYNAMIC Thu, 29 Aug 2024 07:08:56 +0000" } ~ Parser/Features H L F I J - bash ✓ ✓ ✓ . ✓ - c ✓ ✓ ✓ ✓ ✓ - cpp ✓ ✓ ✓ ✓ ✓ - css ✓ . ✓ ✓ ✓ - fish ✓ ✓ ✓ ✓ ✓ - html ✓ ✓ ✓ ✓ ✓ - hyprlang ✓ . ✓ ✓ ✓ - javascript ✓ ✓ ✓ ✓ ✓ - json ✓ ✓ ✓ ✓ . - lua ✓ ✓ ✓ ✓ ✓ - luadoc ✓ . . . . - markdown ✓ . ✓ ✓ ✓ - markdown_inline ✓ . . . ✓ - nix ✓ ✓ ✓ ✓ ✓ - norg . . . . . - printf ✓ . . . . - python ✓ ✓ ✓ ✓ ✓ - query ✓ ✓ ✓ ✓ ✓ - rasi ✓ ✓ ✓ ✓ ✓ - rust ✓ ✓ ✓ ✓ ✓ - toml ✓ ✓ ✓ ✓ ✓ - tsx ✓ ✓ ✓ ✓ ✓ - typescript ✓ ✓ ✓ ✓ ✓ - typst ✓ . ✓ ✓ ✓ - vim ✓ ✓ ✓ . ✓ - vimdoc ✓ . . . ✓ - yaml ✓ ✓ ✓ ✓ ✓ 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

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1723675123
Run "nvim -V1 -v" for more info

Additional context Add any other context about the problem here.