-
Notifications
You must be signed in to change notification settings - Fork 132
Sourcing: support basic variable expansions #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
enhancement
New feature or request
Comments
With #673 we now just miss basic variable expansion support. |
aarondill
added a commit
to aarondill/bash-language-server
that referenced
this issue
Jan 21, 2024
This does the same thing that ShellCheck does ([here](https://github.com/koalaman/shellcheck/blob/ba86c6363c30a5dbefd0b8b9a7c5f4ab0478dc91/src/ShellCheck/Parser.hs#L2277-L2283)). `To support the common pattern of . "$CONFIGDIR/mylib.sh", ShellCheck strips one leading, dynamic section before trying to locate the rest.` fixes bash-lsp#926, fixes bash-lsp#659
aarondill
added a commit
to aarondill/bash-language-server
that referenced
this issue
Feb 6, 2024
This does the same thing that ShellCheck does ([here](https://github.com/koalaman/shellcheck/blob/ba86c6363c30a5dbefd0b8b9a7c5f4ab0478dc91/src/ShellCheck/Parser.hs#L2277-L2283)). `To support the common pattern of . "$CONFIGDIR/mylib.sh", ShellCheck strips one leading, dynamic section before trying to locate the rest.` fixes bash-lsp#926, fixes bash-lsp#659
aarondill
added a commit
to aarondill/bash-language-server
that referenced
this issue
Apr 13, 2025
This does the same thing that ShellCheck does ([here](https://github.com/koalaman/shellcheck/blob/ba86c6363c30a5dbefd0b8b9a7c5f4ab0478dc91/src/ShellCheck/Parser.hs#L2277-L2283)). `To support the common pattern of . "$CONFIGDIR/mylib.sh", ShellCheck strips one leading, dynamic section before trying to locate the rest.` fixes bash-lsp#926, fixes bash-lsp#659 fix: handle leading dynamic source paths when concatenating This fixes `${var}/path` and `"${var}"/path` as well as countless variations of these patterns Note: this turned out to be rather complex task, so it's broken out into a seperate function, which allows for early returns refactor: move resolveStaticString to util/tree-sitter.ts This seemed the most appropriate place for it. tests: fix existing snapshot and add test for dynamic source paths Adds a simple test for dynamic source paths and updates the snapshot to match new tests / behaivor. Note: all the line numbers in the snapshot increased by 2 because I added two new lines (the test and a blank one) tests: add new test in fixtures/sourcing.sh I added this to the bottom of the file to minimize snapshot diffs. they're large enough as it is.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#244 introduced sourcing aware symbol resolution where source commands (e.g.
. myfile.sh
orsource ./file.bash
) is used for figure out which symbols are available in a given context.The current implementation is fairly crude and can be extended a bit to resolve basic variable expansions and sourcing statements in functions and loops.
The text was updated successfully, but these errors were encountered: