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

Commit

Permalink
fix: #2240 - gocode autocompletion not working when using // in Sprin…
Browse files Browse the repository at this point in the history
…tf (#2316)
  • Loading branch information
oneslash authored and ramya-rao-a committed Mar 4, 2019
1 parent da664d7 commit 1f621cc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/goSuggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,20 @@ export class GoCompletionItemProvider implements vscode.CompletionItemProvider,
let suggestionItem: vscode.CompletionItem;
if (memberType && memberType.length === 4) {
suggestionItem = new vscode.CompletionItem(memberType[3], vscodeKindFromGoCodeClass(memberType[1], ''));
}
return resolve(suggestionItem ? [suggestionItem] : []);
}
return resolve(suggestionItem ? [suggestionItem] : []);
}

// prevent completion when typing in a line comment that doesnt start from the beginning of the line
const commentIndex = lineText.indexOf('//');

if (commentIndex >= 0 && position.character > commentIndex) {
return resolve([]);
const commentPosition = new vscode.Position(position.line, commentIndex);
const isCommentInString = isPositionInString(document, commentPosition);

if (!isCommentInString) {
return resolve([]);
}
}

let inString = isPositionInString(document, position);
Expand Down

0 comments on commit 1f621cc

Please sign in to comment.