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

code completion of variables in quotes #236

Closed
nikita-skobov opened this issue May 16, 2020 · 6 comments · Fixed by #237
Closed

code completion of variables in quotes #236

nikita-skobov opened this issue May 16, 2020 · 6 comments · Fixed by #237
Assignees
Labels
enhancement New feature or request

Comments

@nikita-skobov
Copy link
Contributor

consider the scenario where you have a variable defined, and then you want to use that variable from within quotation marks:

my_var="world"
echo "hello $my_var"

Is it possible to do code completion when you type part of that variable name, consider:
If you type echo "hello $my_", can you get code completion to show up for variables that match my_

Is this something that the vscode-client extension can potentially do, or is this an issue with vscode itself?

@skovhus
Copy link
Collaborator

skovhus commented May 19, 2020

Thanks for reporting this issue. This is a feature we currently do not support, but we probably should.

The trigger characters needs to be adjusted in the capabilities object. Besides our parser needs to understand the $ symbol. Currently the wordAtPoint returns null... we need to figure out if the grammar should be updated or we can work around it.

@skovhus skovhus added the enhancement New feature or request label May 19, 2020
@nikita-skobov
Copy link
Contributor Author

I will take a look later today/tomorrow, and see if I can try adding this feature. Could you point me to which files/test cases are most relevant to this issue?

@skovhus skovhus self-assigned this May 19, 2020
@skovhus
Copy link
Collaborator

skovhus commented May 19, 2020

@nikita-skobov thanks for offering your help! :)

I actually already started having a look at this and possibly found some flaws in the wordAtPoint logic done in #192

I'll get back to you.

But if you want to help out improving the language server and you are curious to learn how the bash parser works, then https://github.com/tree-sitter/tree-sitter-bash needs some attention. This is the parser we use, and as you see it has a bunch of parsing issues currently. Half of our issues is related to the parser. See https://github.com/bash-lsp/bash-language-server/issues?q=is%3Aopen+is%3Aissue+label%3A%22grammar+bug%22

I can give you some pointers if you want to help out:

Again, thanks for offering your help. This is much appreciated.

@skovhus
Copy link
Collaborator

skovhus commented May 19, 2020

Maybe you can try out #237

I'll test some edges cases and document the PR with some before and after screenshots.

@nikita-skobov
Copy link
Contributor Author

Awesome thanks, I'll give it a go.

@skovhus
Copy link
Collaborator

skovhus commented May 20, 2020

This was released as vscode extension 1.10.1 and bash-language-server 1.16.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants