File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -142,21 +142,19 @@ export default class BashServer {
142
142
symbol : LSP . SymbolInformation
143
143
currentUri : string
144
144
} ) : string {
145
- const getCommentsAbove = ( uri : string , line : number ) : string => {
146
- const comment = this . analyzer . commentsAbove ( uri , line )
147
- return comment ? `\n\n${ comment } ` : ''
148
- }
145
+ const symbolUri = symbol . location . uri
146
+ const symbolStarLine = symbol . location . range . start . line
147
+
148
+ const commentAboveSymbol = this . analyzer . commentsAbove ( symbolUri , symbolStarLine )
149
+ const symbolDocumentation = commentAboveSymbol ? `\n\n${ commentAboveSymbol } ` : ''
149
150
150
- return symbol . location . uri !== currentUri
151
+ return symbolUri !== currentUri
151
152
? `${ symbolKindToDescription ( symbol . kind ) } defined in ${ path . relative (
152
153
currentUri ,
153
- symbol . location . uri ,
154
- ) } ${ getCommentsAbove ( symbol . location . uri , symbol . location . range . start . line ) } `
155
- : `${ symbolKindToDescription ( symbol . kind ) } defined on line ${ symbol . location . range
156
- . start . line + 1 } ${ getCommentsAbove (
157
- currentUri ,
158
- symbol . location . range . start . line ,
159
- ) } `
154
+ symbolUri ,
155
+ ) } ${ symbolDocumentation } `
156
+ : `${ symbolKindToDescription ( symbol . kind ) } defined on line ${ symbolStarLine +
157
+ 1 } ${ symbolDocumentation } `
160
158
}
161
159
162
160
private getCompletionItemsForSymbols ( {
You can’t perform that action at this time.
0 commit comments