For example, I have the following script:
greet() {
echo "Hello"
}
greet
If I try to rename the function greet with new_name it will rename the function declaration, or the individual function call I have my cursor on, but not all the other references to than function.
The function will look something like this:
new_name() {
echo "Hello"
}
greet
Expected behavior
After I rename one reference to a function I expect that all the renamed references were renamed too.
Output of :checkhealth nvim_treesitter
Installation
- OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v20.8.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: Apple clang version 15.0.0 (clang-1500.0.40.1)
- 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 = "23.0.0",
sysname = "Darwin",
version = "Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- cmake ✓ . ✓ ✓ .
- cpp ✓ ✓ ✓ ✓ ✓
- diff ✓ . . . .
- git_rebase ✓ . . . ✓
- gitcommit ✓ . . . ✓
- gitignore ✓ . . . .
- java ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- lua ✓ ✓ ✓ ✓ ✓
- make ✓ . ✓ . ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- requirements ✓ . . . ✓
- teal ✓ ✓ ✓ ✓ ✓
- toml ✓ ✓ ✓ ✓ ✓
- 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
Note
Appens also on stable release
NVIM v0.10.0-dev-1280+g3079fa1f9
Build type: RelWithDebInfo
LuaJIT 2.1.1695653777
Run "nvim -V1 -v" for more info
Additional context
I'm pretty sure is a problem with the bash parser, but wanna make sure that it is the case.
The parser will produce the following AST for the example script above:
Describe the bug
Considering the following script:
If I try to rename the function
greet
withnew_name
it will rename the function declaration, or the individual function call I have my cursor on, but not all the other references to than function.The function will look something like this:
Expected behavior
After I rename one reference to a function I expect that all the renamed references were renamed too.
Output of
:checkhealth nvim_treesitter
Installation - OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar) - OK `node` found v20.8.0 (only needed for :TSInstallFromGrammar) - OK `git` executable found. - OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: Apple clang version 15.0.0 (clang-1500.0.40.1) - 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 = "23.0.0", sysname = "Darwin", version = "Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64" } ~ Parser/Features H L F I J - bash ✓ ✓ ✓ . ✓ - c ✓ ✓ ✓ ✓ ✓ - cmake ✓ . ✓ ✓ . - cpp ✓ ✓ ✓ ✓ ✓ - diff ✓ . . . . - git_rebase ✓ . . . ✓ - gitcommit ✓ . . . ✓ - gitignore ✓ . . . . - java ✓ ✓ ✓ ✓ ✓ - javascript ✓ ✓ ✓ ✓ ✓ - json ✓ ✓ ✓ ✓ . - lua ✓ ✓ ✓ ✓ ✓ - make ✓ . ✓ . ✓ - markdown ✓ . ✓ ✓ ✓ - markdown_inline ✓ . . . ✓ - python ✓ ✓ ✓ ✓ ✓ - query ✓ ✓ ✓ ✓ ✓ - requirements ✓ . . . ✓ - teal ✓ ✓ ✓ ✓ ✓ - toml ✓ ✓ ✓ ✓ ✓ - 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
Additional context
I'm pretty sure is a problem with the bash parser, but wanna make sure that it is the case.
The parser will produce the following AST for the example script above:
When you call a function it doesn't distinguish if you are calling a function or an executable. I think this is the issue.