You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Deleting a scala function using function.outer text object in some cases deletes also the next function, while using the same text-object to select code always highlights correctly only a single function.
and the cursor on methodA selecting the function outer object using: lua require("nvim-treesitter.textobjects.select").select_textobject('@function.outer', 'textobjects', 'x')
results in:
However if we try to call the same object but with a delete operation it results in both methods getting deleted:
Expected behavior
I would expect both operators - delete and select to work in a consistent way. Especially deleting using @fuction.outer should only delete a single function.
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)
- WARNING `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `git` executable found.
- OK `gcc` executable found. Selected from { "gcc", "cc", "gcc", "clang", "cl", "zig" }
Version: gcc (GCC) 12.3.0
- 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.1.52",
sysname = "Linux",
version = "#1-NixOS SMP PREEMPT_DYNAMIC Wed Sep 6 20:27:03 UTC 2023"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- comment ✓ . . . .
- devicetree ✓ ✓ ✓ ✓ ✓
- dockerfile ✓ . . . ✓
- go ✓ ✓ ✓ ✓ ✓
- graphql ✓ . . ✓ ✓
- hocon ✓ . . . ✓
- html ✓ ✓ ✓ ✓ ✓
- java ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- kotlin ✓ ✓ ✓ . ✓
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ ✓ ✓
- nix ✓ ✓ ✓ . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- rust ✓ ✓ ✓ ✓ ✓
- scala ✓ ✓ ✓ . ✓
- scheme ✓ . ✓ . ✓
- smithy ✓ . . . .
- sql ✓ . . ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- xml ✓ . ✓ ✓ ✓
- 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.9.2
Build type: Release
LuaJIT 2.1.1693350652
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "
/nix/store/1b4pbg130cdq5pjyi7vxqqrf7nqh63a5-neovim-unwrapped-0.9.2/share/nvim
"
Additional context
Add any other context about the problem here.
while trying to minimize the reproduction example I found following interesting cases:
If we remove the inner object but leave the indentation intact, both functions will be deleted:
but if we format the code (fix the redundant indentations) the delete operation will work correctly.
After compacting the first function to a single line it also works correctly:
It also works if the function that is being deleted is defined using braces:
Describe the bug
Deleting a scala function using
function.outer
text object in some cases deletes also the next function, while using the same text-object to select code always highlights correctly only a single function.To Reproduce
Given the following code:
and the cursor on
methodA
selecting the function outer object using:lua require("nvim-treesitter.textobjects.select").select_textobject('@function.outer', 'textobjects', 'x')
results in:
However if we try to call the same object but with a delete operation it results in both methods getting deleted:
Expected behavior
I would expect both operators - delete and select to work in a consistent way. Especially deleting using
@fuction.outer
should only delete a single function.Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
Add any other context about the problem here.
while trying to minimize the reproduction example I found following interesting cases:
If we remove the inner object but leave the indentation intact, both functions will be deleted:
but if we format the code (fix the redundant indentations) the delete operation will work correctly.
After compacting the first function to a single line it also works correctly:
It also works if the function that is being deleted is defined using braces:
treesitter-scala rev: 70afdd5632d57dd63a960972ab25945e353a52f6
The text was updated successfully, but these errors were encountered: