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
To preserve a top-down structuring in my scripts, I tend to create a main function at the top of the file, any other functions below it, and call the main function in the last line. Shellcheck has no problem with this, but the bash-language-server enforces functions to be defined before they are called, even if the load order is correct.
The following code might describe the problem a little better:
#!/bin/bash
function1() { :; }
main() {
function1 # GoToDefinition etc works
function2 # GoToDefinition not available
}
function2() { :; }
main "$@"
How often does it reproduce? Is there a required condition?
always
What is the expected behavior?
For the bash-language-server to support language features despite custom function ordering similar to shellcheck.
What do you see instead?
Language features don't work for function2 despite valid availability in the scope.
Additional information
If this is hard to fix/change, I could also imagine a ALWAYS_IN_SCOPE type config option, that simply puts the whole file in scope. Shellcheck seems to catch any scoping errors as a fallback.
The text was updated successfully, but these errors were encountered:
Code editor
neovim
Platform
Linux
Version
5.1.2
What steps will reproduce the bug?
To preserve a top-down structuring in my scripts, I tend to create a
main
function at the top of the file, any other functions below it, and call themain
function in the last line. Shellcheck has no problem with this, but the bash-language-server enforces functions to be defined before they are called, even if the load order is correct.The following code might describe the problem a little better:
How often does it reproduce? Is there a required condition?
always
What is the expected behavior?
For the bash-language-server to support language features despite custom function ordering similar to shellcheck.
What do you see instead?
Language features don't work for
function2
despite valid availability in the scope.Additional information
If this is hard to fix/change, I could also imagine a
ALWAYS_IN_SCOPE
type config option, that simply puts the whole file in scope. Shellcheck seems to catch any scoping errors as a fallback.The text was updated successfully, but these errors were encountered: