Skip to content

Commit bd53e22

Browse files
committed
WIP
1 parent 3db9798 commit bd53e22

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Diff for: server/src/util/declarations.ts

+17
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ export function getGlobalDeclarations({
5858
const word = symbol.name
5959
globalDeclarations[word] = symbol
6060
}
61+
} else if (node.type === 'command' && node.text.startsWith(': ')) {
62+
const variableNode = node.namedChildren
63+
.find((c) => c.type === 'string')
64+
?.namedChildren.find((c) => c.type === 'expansion')
65+
?.namedChildren.find((c) => c.type === 'variable_name')
66+
67+
if (variableNode) {
68+
const symbol = LSP.SymbolInformation.create(
69+
variableNode.text,
70+
LSP.SymbolKind.Variable,
71+
TreeSitterUtil.range(variableNode),
72+
uri,
73+
)
74+
if (!globalDeclarations[symbol.name]) {
75+
globalDeclarations[symbol.name] = symbol
76+
}
77+
}
6178
}
6279
})
6380

Diff for: testing/fixtures/extension.inc

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ extensionFunc() {
1414
innerExtensionFunc() {
1515
echo $LOCAL_VARIABLE
1616
}
17-
}
17+
}
18+
19+
: "${FILE_PATH:="/default/file"}"
20+
21+
printf 'Printing %s\n' "$FILE_PATH"

0 commit comments

Comments
 (0)