File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,13 @@ export default class Analyzer {
359
359
return getAllDeclarationsInTree ( { uri, tree } )
360
360
}
361
361
362
+ /**
363
+ * Get the document for the given URI.
364
+ */
365
+ public getDocument ( uri : string ) : TextDocument | undefined {
366
+ return this . uriToAnalyzedDocument [ uri ] ?. document
367
+ }
368
+
362
369
// TODO: move somewhere else than the analyzer...
363
370
public async getExplainshellDocumentation ( {
364
371
params,
Original file line number Diff line number Diff line change @@ -450,6 +450,18 @@ export default class BashServer {
450
450
return [ ]
451
451
}
452
452
453
+ if ( ! word ) {
454
+ const nextCharacter = this . analyzer . getDocument ( params . textDocument . uri ) ?. getText ( {
455
+ start : params . position ,
456
+ end : { ...params . position , character : params . position . character + 1 } ,
457
+ } )
458
+ const isNextCharacterSpaceOrEmpty = nextCharacter === '' || nextCharacter === ' '
459
+ if ( ! isNextCharacterSpaceOrEmpty ) {
460
+ // We are in the middle of something, so don't complete
461
+ return [ ]
462
+ }
463
+ }
464
+
453
465
let options : string [ ] = [ ]
454
466
if ( word && word . startsWith ( '-' ) ) {
455
467
const commandName = this . analyzer . commandNameAtPoint (
You can’t perform that action at this time.
0 commit comments