Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Fix prevention of completion popup in line comments. (fixes #1659) #1671

Merged
merged 3 commits into from
May 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/goSuggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider {
let lineTillCurrentPosition = lineText.substr(0, position.character);
let autocompleteUnimportedPackages = config['autocompleteUnimportedPackages'] === true && !lineText.match(/^(\s)*(import|package)(\s)+/);

if (lineText.match(/^\s*\/\//)) {
// prevent completion when typing in a line comment
const commentIndex = lineText.indexOf('//');
if (commentIndex >= 0 && position.character > commentIndex) {
return resolve([]);
}

Expand Down Expand Up @@ -327,4 +329,3 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider {
}
}
}