bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

Cannot go-to-definition when using `source` with string concatenation

Open superDross opened this issue 1 year ago • 0 comments

Code editor

Neovim

Platform

Linux & OS X

Version

4.9.0

What steps will reproduce the bug?

This is a very rough example

Create the following file:

#!/bin/sh
# lib.sh

hello() {
	echo "Hello, world!"
}

Source the file via string concatenation:

#!/bin/sh
# main.sh

PROJECT_DIR="/Users/David.Ross/temp"

source "${PROJECT_DIR}/libs/lib.sh"

hello

Hover over hello and execute go to definition. This will not work.

Edit the main.sh to the following:

#!/bin/sh
# main.sh

PROJECT_DIR="/Users/David.Ross/temp"

source /Users/David.Ross/temp/libs/lib.sh

hello

Hover over hello and execute go to definition, this will now work.

Is go-to-definition not intended to work when part of the path is part of a variable?

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

It should go to definition even when sourcing a path by string concatenation (var + substring).

Additional information

No response

superDross avatar Apr 05 '23 16:04 superDross