Skip to content
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

Improve source command parser and diagnostics #673

Merged
merged 7 commits into from
Jan 10, 2023
Merged

Conversation

skovhus
Copy link
Collaborator

@skovhus skovhus commented Jan 10, 2023

Resolves #658

This PR improves the sourcing analysis by using the AST instead of the crude regular expression. This means source commands nested in function are now found + we can return proper diagnostics when source commands are not resolved or supported. More context can be found in #658

The added diagnostics should hopefully clarify to the user why jump to definition or similar features isn't currently working.

Example

Screenshot 2023-01-10 at 22 07 28

@skovhus skovhus enabled auto-merge January 10, 2023 21:12
@skovhus skovhus merged commit 7920729 into main Jan 10, 2023
@skovhus skovhus deleted the stable-sourcing branch January 10, 2023 21:13
@skovhus skovhus changed the title Improving sourcing analysis and diagnostics Improve source command parser and diagnostics Jan 10, 2023
akurtakov added a commit to akurtakov/shellwax that referenced this pull request Feb 24, 2023
Impovements in the LS:

- Support for bash options auto completions when using Brew or when
`pkg-config` fails, but bash completions are found in
`"${PREFIX:-/usr}/share/bash-completion/bash_completion"`
bash-lsp/bash-language-server#717

- Remove diagnostics for missing nodes that turns out to be unstable
(this was introduced in 4.5.3)
bash-lsp/bash-language-server#708

- Fix the ShellCheck code action feature that for some clients did not
return any code actions.
bash-lsp/bash-language-server#700

- Support parsing `: "${VARIABLE:="default"}"` as a variable definition
bash-lsp/bash-language-server#693

- Use sourcing info even if `includeAllWorkspaceSymbols` is true to
ensure that files not matching the `globPattern` (and therefore not part
of the background analysis) is still resolved based on source commands.
bash-lsp/bash-language-server#695

- Skip running ShellCheck for unsupported zsh files. We will still try
for files without a shebang and without a known file extension.
bash-lsp/bash-language-server#694

- Fix issue where some features would work as expected in case of a
syntax issue bash-lsp/bash-language-server#691

- Fixed `onReferences` to respect the `context.includeDeclaration` flag
bash-lsp/bash-language-server#688
- Removed unnecessary dependency `urijs`
bash-lsp/bash-language-server#688

- Include grouped variables and functions when finding global
declarations bash-lsp/bash-language-server#685
- Skip completions in the middle of a non word when the following
characters is not an empty list or whitespace.
bash-lsp/bash-language-server#684
- Remove infrequent and rather useless "Failed to parse" diagnostics
(and thereby the `HIGHLIGHT_PARSING_ERRORS` and `highlightParsingErrors`
configuration option) – the tree sitter parser is actually rather good
at error recovery. Note that these messages will now be shown in the
log. bash-lsp/bash-language-server#686

- Include 30 snippets for language constructs (e.g. `if`), builtins
(e.g. `test`), expansions (e.g. `[##]`), and external programs (e.g.
`sed`) bash-lsp/bash-language-server#683

- Improve source command parser and include diagnostics when parser
fails bash-lsp/bash-language-server#673
- Fix `onHover` bug where sourced symbols on the same line as a
reference would hide documentation
bash-lsp/bash-language-server#673
akurtakov added a commit to eclipse-shellwax/shellwax that referenced this pull request Feb 24, 2023
Impovements in the LS:

- Support for bash options auto completions when using Brew or when
`pkg-config` fails, but bash completions are found in
`"${PREFIX:-/usr}/share/bash-completion/bash_completion"`
bash-lsp/bash-language-server#717

- Remove diagnostics for missing nodes that turns out to be unstable
(this was introduced in 4.5.3)
bash-lsp/bash-language-server#708

- Fix the ShellCheck code action feature that for some clients did not
return any code actions.
bash-lsp/bash-language-server#700

- Support parsing `: "${VARIABLE:="default"}"` as a variable definition
bash-lsp/bash-language-server#693

- Use sourcing info even if `includeAllWorkspaceSymbols` is true to
ensure that files not matching the `globPattern` (and therefore not part
of the background analysis) is still resolved based on source commands.
bash-lsp/bash-language-server#695

- Skip running ShellCheck for unsupported zsh files. We will still try
for files without a shebang and without a known file extension.
bash-lsp/bash-language-server#694

- Fix issue where some features would work as expected in case of a
syntax issue bash-lsp/bash-language-server#691

- Fixed `onReferences` to respect the `context.includeDeclaration` flag
bash-lsp/bash-language-server#688
- Removed unnecessary dependency `urijs`
bash-lsp/bash-language-server#688

- Include grouped variables and functions when finding global
declarations bash-lsp/bash-language-server#685
- Skip completions in the middle of a non word when the following
characters is not an empty list or whitespace.
bash-lsp/bash-language-server#684
- Remove infrequent and rather useless "Failed to parse" diagnostics
(and thereby the `HIGHLIGHT_PARSING_ERRORS` and `highlightParsingErrors`
configuration option) – the tree sitter parser is actually rather good
at error recovery. Note that these messages will now be shown in the
log. bash-lsp/bash-language-server#686

- Include 30 snippets for language constructs (e.g. `if`), builtins
(e.g. `test`), expansions (e.g. `[##]`), and external programs (e.g.
`sed`) bash-lsp/bash-language-server#683

- Improve source command parser and include diagnostics when parser
fails bash-lsp/bash-language-server#673
- Fix `onHover` bug where sourced symbols on the same line as a
reference would hide documentation
bash-lsp/bash-language-server#673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inform about source commands that are not followed
1 participant