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

fix: #2240 - gocode autocompletion not working when using // in Sprintf #2316

Merged
merged 4 commits into from
Mar 4, 2019
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
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