Skip to content

Commit

Permalink
Remove use of memoize
Browse files Browse the repository at this point in the history
Fixes #95324
  • Loading branch information
mjbvz committed Apr 16, 2020
1 parent b89738c commit c189b2b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { nulToken } from '../utils/cancellation';
import { applyCodeAction } from '../utils/codeAction';
import { Command, CommandManager } from '../utils/commandManager';
import { ConfigurationDependentRegistration } from '../utils/dependentRegistration';
import { memoize } from '../utils/memoize';
import * as Previewer from '../utils/previewer';
import { snippetForFunctionCall } from '../utils/snippetForFunctionCall';
import { TelemetryReporter } from '../utils/telemetry';
Expand Down Expand Up @@ -68,7 +67,9 @@ class MyCompletionItem extends vscode.CompletionItem {
this.preselect = tsEntry.isRecommended;
this.position = position;
this.useCodeSnippet = completionContext.useCodeSnippetsOnMethodSuggest && (this.kind === vscode.CompletionItemKind.Function || this.kind === vscode.CompletionItemKind.Method);

this.range = this.getRangeFromReplacementSpan(tsEntry, completionContext, position);
this.commitCharacters = MyCompletionItem.getCommitCharacters(completionContext, tsEntry);
this.insertText = tsEntry.insertText;
this.filterText = this.getFilterText(completionContext.line, tsEntry.insertText);

Expand Down Expand Up @@ -268,14 +269,13 @@ class MyCompletionItem extends vscode.CompletionItem {
}
}

@memoize
public get commitCharacters(): string[] | undefined {
if (this.completionContext.isNewIdentifierLocation || !this.completionContext.isInValidCommitCharacterContext) {
private static getCommitCharacters(context: CompletionContext, entry: Proto.CompletionEntry): string[] | undefined {
if (context.isNewIdentifierLocation || !context.isInValidCommitCharacterContext) {
return undefined;
}

const commitCharacters: string[] = [];
switch (this.tsEntry.kind) {
switch (entry.kind) {
case PConst.Kind.memberGetAccessor:
case PConst.Kind.memberSetAccessor:
case PConst.Kind.constructSignature:
Expand All @@ -299,7 +299,7 @@ class MyCompletionItem extends vscode.CompletionItem {
case PConst.Kind.keyword:
case PConst.Kind.parameter:
commitCharacters.push('.', ',', ';');
if (this.completionContext.enableCallCompletions) {
if (context.enableCallCompletions) {
commitCharacters.push('(');
}
break;
Expand Down

0 comments on commit c189b2b

Please sign in to comment.