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

Does not correctly identify variable creation #318

Closed
DazWilkin opened this issue Dec 3, 2021 · 3 comments
Closed

Does not correctly identify variable creation #318

DazWilkin opened this issue Dec 3, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@DazWilkin
Copy link

Thank you for creating bash-lsp. I use LSPs with Golang, Rust etc. and have missed the functionality when writing Bash.

I was delighted when I inadvertently hovered over a variable in a script and its declaration was documented but these variable (re)declarations appear to not be identified correctly.

#!/usr/bin/env bash

X="Freddie"

X="Frederik"

function test () {
  local X="Dog"
  printf "${X}"
}

In the above, the use of X in printf "${X}" (IMO) refers to its definition in local X="Dog" but bash-lsp reports line #3 (X="Freddie").

If I comment local X="Dog", I expect (perhaps incorrectly) that the redefinition X="Frederik" should be used but it continues to refer back to line #3 (X="Freddie")

@skovhus skovhus added the bug Something isn't working label Nov 25, 2022
@skovhus
Copy link
Collaborator

skovhus commented Nov 25, 2022

Thanks for reporting this and sorry for the late reply. This is clearly a bug. Let me know if you are interested in fixing it.

@DazWilkin
Copy link
Author

@skovhus thank you for taking the time to reply.

Unfortunately, I don't have the relevant skills to implement the fix.

@skovhus
Copy link
Collaborator

skovhus commented Jan 2, 2023

A much better heuristic for symbol resolution has been released as [email protected] and for vscode in the latest extension 1.24.0. It opens up for implementing renaming of symbols, and I also believe this solves the issue here.

Please let me know if it works for you or if you have any feedback to the new version.

@skovhus skovhus closed this as completed Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants