Skip to content

Does not correctly identify variable creation #318

Closed
@DazWilkin

Description

@DazWilkin

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions