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
Swapping @function.outer in Python doesn't work when inside a decorated function. Take the example:
deftest():
print("This is a test")
@some_decoratordeftest2():
print("This is a test")
deftest3():
print("This is a test")
When in either of the un-decorated functions, swapping with the decorated function works just fine. When in the decorated function, nothing happens when you try to swap, unless the cursor is on the decorator line.
My guess is that this happens because when inside the decorated function, the non-decorated @function.outer match is the closest match and is selected for swapping, but since it's inside a (decorated_definition ..., it doesn't have any siblings to swap with:
WARNING tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
OK node found v20.11.0 (only needed for :TSInstallFromGrammar)
OK git executable found.
OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: gcc (GCC) 13.2.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.9.3",
sysname = "Linux",
version = "#1-NixOS SMP PREEMPT_DYNAMIC Thu May 30 07:45:04 UTC 2024"
} ~
Parser/Features H L F I J
bash ✓ ✓ ✓ . ✓
c ✓ ✓ ✓ ✓ ✓
css ✓ . ✓ ✓ ✓
diff ✓ . . . .
dockerfile ✓ . . . ✓
git_config ✓ . ✓ . ✓
git_rebase ✓ . . . ✓
gitcommit ✓ . . . ✓
gitignore ✓ . . . ✓
hyprlang ✓ . ✓ ✓ ✓
ini ✓ . ✓ . ✓
javascript ✓ ✓ ✓ ✓ ✓
json ✓ ✓ ✓ ✓ .
just ✓ ✓ ✓ ✓ ✓
lua ✓ ✓ ✓ ✓ ✓
make ✓ . ✓ . ✓
markdown ✓ . ✓ ✓ ✓
markdown_inline ✓ . . . ✓
nix ✓ ✓ ✓ . ✓
python ✓ ✓ ✓ ✓ ✓
query ✓ ✓ ✓ ✓ ✓
requirements ✓ . . . ✓
robot ✓ . ✓ ✓ ✓
sql ✓ . . ✓ ✓
ssh_config ✓ ✓ ✓ ✓ ✓
tmux ✓ . . . ✓
toml ✓ ✓ ✓ ✓ ✓
tsx ✓ ✓ ✓ ✓ ✓
typescript ✓ ✓ ✓ ✓ ✓
vim ✓ ✓ ✓ . ✓
vimdoc ✓ . . . ✓
xml ✓ ✓ ✓ ✓ ✓
yaml ✓ ✓ ✓ ✓ ✓
yang ✓ . ✓ ✓ ✓
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.0-dev-2295+g672556525
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634
Run "nvim -V1 -v" for more info```
Additional context
-
The text was updated successfully, but these errors were encountered:
And the commands ts_swap.swap_next("@function.outer") and ts_swap.swap_previous("@function.outer"), the decorated functions no longer register as functions at all. The normal functions can be moved up and down, but jump right past the decorated functions. The decorated functions can't be moved whether the cursor is placed in the decorator or in the function.
Describe the bug
Swapping
@function.outer
in Python doesn't work when inside a decorated function. Take the example:When in either of the un-decorated functions, swapping with the decorated function works just fine. When in the decorated function, nothing happens when you try to swap, unless the cursor is on the decorator line.
Given the queries:
My guess is that this happens because when inside the decorated function, the non-decorated
@function.outer
match is the closest match and is selected for swapping, but since it's inside a(decorated_definition ...
, it doesn't have any siblings to swap with:So nothing happens.
To Reproduce
Steps to reproduce the behavior:
(See above)
I'm using these functions:
Expected behavior
If the current cursor position matches both a function_definition and a decorated_definition, the latter should have higher priority.
Output of
:checkhealth nvim-treesitter
nvim-treesitter: require("nvim-treesitter.health").check()- WARNING
- OK
- OK
- OK
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- css ✓ . ✓ ✓ ✓
- diff ✓ . . . .
- dockerfile ✓ . . . ✓
- git_config ✓ . ✓ . ✓
- git_rebase ✓ . . . ✓
- gitcommit ✓ . . . ✓
- gitignore ✓ . . . ✓
- hyprlang ✓ . ✓ ✓ ✓
- ini ✓ . ✓ . ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- just ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- make ✓ . ✓ . ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- nix ✓ ✓ ✓ . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- requirements ✓ . . . ✓
- robot ✓ . ✓ ✓ ✓
- sql ✓ . . ✓ ✓
- ssh_config ✓ ✓ ✓ ✓ ✓
- tmux ✓ . . . ✓
- toml ✓ ✓ ✓ ✓ ✓
- tsx ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- xml ✓ ✓ ✓ ✓ ✓
- yaml ✓ ✓ ✓ ✓ ✓
- yang ✓ . ✓ ✓ ✓
Installation ~
tree-sitter
executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)node
found v20.11.0 (only needed for :TSInstallFromGrammar)git
executable found.cc
executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }Version: gcc (GCC) 13.2.0
OS Info:
{
machine = "x86_64",
release = "6.9.3",
sysname = "Linux",
version = "#1-NixOS SMP PREEMPT_DYNAMIC Thu May 30 07:45:04 UTC 2024"
} ~
Parser/Features H L F I J
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
-
The text was updated successfully, but these errors were encountered: