Remove use of memoize

Fixes #95324
This commit is contained in:
Matt Bierner 2020-04-16 10:16:44 -07:00
parent b89738c83b
commit c189b2bb05

View file

@ -13,7 +13,6 @@ import { nulToken } from '../utils/cancellation';
import { applyCodeAction } from '../utils/codeAction'; import { applyCodeAction } from '../utils/codeAction';
import { Command, CommandManager } from '../utils/commandManager'; import { Command, CommandManager } from '../utils/commandManager';
import { ConfigurationDependentRegistration } from '../utils/dependentRegistration'; import { ConfigurationDependentRegistration } from '../utils/dependentRegistration';
import { memoize } from '../utils/memoize';
import * as Previewer from '../utils/previewer'; import * as Previewer from '../utils/previewer';
import { snippetForFunctionCall } from '../utils/snippetForFunctionCall'; import { snippetForFunctionCall } from '../utils/snippetForFunctionCall';
import { TelemetryReporter } from '../utils/telemetry'; import { TelemetryReporter } from '../utils/telemetry';
@ -68,7 +67,9 @@ class MyCompletionItem extends vscode.CompletionItem {
this.preselect = tsEntry.isRecommended; this.preselect = tsEntry.isRecommended;
this.position = position; this.position = position;
this.useCodeSnippet = completionContext.useCodeSnippetsOnMethodSuggest && (this.kind === vscode.CompletionItemKind.Function || this.kind === vscode.CompletionItemKind.Method); this.useCodeSnippet = completionContext.useCodeSnippetsOnMethodSuggest && (this.kind === vscode.CompletionItemKind.Function || this.kind === vscode.CompletionItemKind.Method);
this.range = this.getRangeFromReplacementSpan(tsEntry, completionContext, position); this.range = this.getRangeFromReplacementSpan(tsEntry, completionContext, position);
this.commitCharacters = MyCompletionItem.getCommitCharacters(completionContext, tsEntry);
this.insertText = tsEntry.insertText; this.insertText = tsEntry.insertText;
this.filterText = this.getFilterText(completionContext.line, tsEntry.insertText); this.filterText = this.getFilterText(completionContext.line, tsEntry.insertText);
@ -268,14 +269,13 @@ class MyCompletionItem extends vscode.CompletionItem {
} }
} }
@memoize private static getCommitCharacters(context: CompletionContext, entry: Proto.CompletionEntry): string[] | undefined {
public get commitCharacters(): string[] | undefined { if (context.isNewIdentifierLocation || !context.isInValidCommitCharacterContext) {
if (this.completionContext.isNewIdentifierLocation || !this.completionContext.isInValidCommitCharacterContext) {
return undefined; return undefined;
} }
const commitCharacters: string[] = []; const commitCharacters: string[] = [];
switch (this.tsEntry.kind) { switch (entry.kind) {
case PConst.Kind.memberGetAccessor: case PConst.Kind.memberGetAccessor:
case PConst.Kind.memberSetAccessor: case PConst.Kind.memberSetAccessor:
case PConst.Kind.constructSignature: case PConst.Kind.constructSignature:
@ -299,7 +299,7 @@ class MyCompletionItem extends vscode.CompletionItem {
case PConst.Kind.keyword: case PConst.Kind.keyword:
case PConst.Kind.parameter: case PConst.Kind.parameter:
commitCharacters.push('.', ',', ';'); commitCharacters.push('.', ',', ';');
if (this.completionContext.enableCallCompletions) { if (context.enableCallCompletions) {
commitCharacters.push('('); commitCharacters.push('(');
} }
break; break;