Skip to content

Commit 784424f

Browse files
committed
Fix edge case where onHover same line sourced variables failed
1 parent 7ad67fd commit 784424f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server/src/server.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ export default class BashServer {
364364
symbol: LSP.SymbolInformation
365365
currentUri: string
366366
}): LSP.MarkupContent {
367+
logger.debug(
368+
`getDocumentationForSymbol: symbol=${symbol.name} uri=${symbol.location.uri}`,
369+
)
367370
const symbolUri = symbol.location.uri
368371
const symbolStartLine = symbol.location.range.start.line
369372

@@ -665,6 +668,9 @@ export default class BashServer {
665668
Builtins.isBuiltin(word) ||
666669
(this.executables.isExecutableOnPATH(word) && symbolsMatchingWord.length == 0)
667670
) {
671+
logger.debug(
672+
`onHover: getting shell documentation for reserved word or builtin or executable`,
673+
)
668674
const shellDocumentation = await getShellDocumentation({ word })
669675
if (shellDocumentation) {
670676
return { contents: getMarkdownContent(shellDocumentation, 'man') }
@@ -675,7 +681,11 @@ export default class BashServer {
675681
currentUri,
676682
})
677683
// do not return hover referencing for the current line
678-
.filter((symbol) => symbol.location.range.start.line !== params.position.line)
684+
.filter(
685+
(symbol) =>
686+
symbol.location.uri !== currentUri ||
687+
symbol.location.range.start.line !== params.position.line,
688+
)
679689
.map((symbol: LSP.SymbolInformation) =>
680690
this.getDocumentationForSymbol({ currentUri, symbol }),
681691
)

0 commit comments

Comments
 (0)