mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Use static list of commit characters
Testing this for the TS side. We think that being consistent may be better than trying to be smart here
This commit is contained in:
parent
2cddf0f039
commit
76885d753d
|
@ -89,7 +89,7 @@ class MyCompletionItem extends vscode.CompletionItem {
|
|||
this.useCodeSnippet = completionContext.useCodeSnippetsOnMethodSuggest && (this.kind === vscode.CompletionItemKind.Function || this.kind === vscode.CompletionItemKind.Method);
|
||||
|
||||
this.range = this.getRangeFromReplacementSpan(tsEntry, completionContext);
|
||||
this.commitCharacters = MyCompletionItem.getCommitCharacters(completionContext, tsEntry);
|
||||
this.commitCharacters = MyCompletionItem.getCommitCharacters(completionContext);
|
||||
this.insertText = isSnippet && tsEntry.insertText ? new vscode.SnippetString(tsEntry.insertText) : tsEntry.insertText;
|
||||
this.filterText = this.getFilterText(completionContext.line, tsEntry.insertText);
|
||||
|
||||
|
@ -489,42 +489,17 @@ class MyCompletionItem extends vscode.CompletionItem {
|
|||
}
|
||||
}
|
||||
|
||||
private static getCommitCharacters(context: CompletionContext, entry: Proto.CompletionEntry): string[] | undefined {
|
||||
private static getCommitCharacters(context: CompletionContext): string[] | undefined {
|
||||
if (context.isNewIdentifierLocation || !context.isInValidCommitCharacterContext) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const commitCharacters: string[] = [];
|
||||
switch (entry.kind) {
|
||||
case PConst.Kind.memberGetAccessor:
|
||||
case PConst.Kind.memberSetAccessor:
|
||||
case PConst.Kind.constructSignature:
|
||||
case PConst.Kind.callSignature:
|
||||
case PConst.Kind.indexSignature:
|
||||
case PConst.Kind.enum:
|
||||
case PConst.Kind.interface:
|
||||
commitCharacters.push('.', ';');
|
||||
break;
|
||||
|
||||
case PConst.Kind.module:
|
||||
case PConst.Kind.alias:
|
||||
case PConst.Kind.const:
|
||||
case PConst.Kind.let:
|
||||
case PConst.Kind.variable:
|
||||
case PConst.Kind.localVariable:
|
||||
case PConst.Kind.memberVariable:
|
||||
case PConst.Kind.class:
|
||||
case PConst.Kind.function:
|
||||
case PConst.Kind.method:
|
||||
case PConst.Kind.keyword:
|
||||
case PConst.Kind.parameter:
|
||||
commitCharacters.push('.', ',', ';');
|
||||
if (context.enableCallCompletions) {
|
||||
commitCharacters.push('(');
|
||||
}
|
||||
break;
|
||||
const commitCharacters: string[] = ['.', ',', ';'];
|
||||
if (context.enableCallCompletions) {
|
||||
commitCharacters.push('(');
|
||||
}
|
||||
return commitCharacters.length === 0 ? undefined : commitCharacters;
|
||||
|
||||
return commitCharacters;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue