Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

Commit 4375913

Browse files
authored
Suppress completion in comments (#278)
1 parent fa87d87 commit 4375913

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/completion/completion_manager.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,13 @@ export class CompletionManager {
373373
});
374374
}
375375

376-
private completionProvider(document: TextDocument, position: Position): Thenable<CompletionItem[]> {
376+
private completionProvider(document: TextDocument, position: Position): Thenable<CompletionItem[]> | undefined {
377377
const commandArgs = [position.line + 1, position.character, document.fileName, this.tmpFile];
378+
const range = new Range(position.line, 0, position.line, position.character);
379+
const text = document.getText(range).trim();
380+
if (text.startsWith('//')) {
381+
return undefined;
382+
}
378383
return this.runCommand(document, 'complete-with-snippet', commandArgs).then(lines => {
379384
lines.shift();
380385
// Split on MATCH, as a definition can span more than one line

0 commit comments

Comments
 (0)