Skip to content

Commit 8d06692

Browse files
committed
dedupe calls to getCompletionEntriesFromSymbols
1 parent 2ca6762 commit 8d06692

File tree

1 file changed

+28
-57
lines changed

1 file changed

+28
-57
lines changed

src/services/completions.ts

Lines changed: 28 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -508,38 +508,35 @@ namespace ts.Completions {
508508

509509
const entries = createSortedArray<CompletionEntry>();
510510
const isChecked = isCheckedFile(sourceFile, compilerOptions);
511-
if (isChecked) {
512-
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) {
513-
return undefined;
514-
}
515-
516-
getCompletionEntriesFromSymbols(
517-
symbols,
518-
entries,
519-
/*replacementToken*/ undefined,
520-
contextToken,
521-
location,
522-
sourceFile,
523-
host,
524-
program,
525-
getEmitScriptTarget(compilerOptions),
526-
log,
527-
completionKind,
528-
preferences,
529-
compilerOptions,
530-
formatContext,
531-
isTypeOnlyLocation,
532-
propertyAccessToConvert,
533-
isJsxIdentifierExpected,
534-
isJsxInitializer,
535-
importCompletionNode,
536-
recommendedCompletion,
537-
symbolToOriginInfoMap,
538-
symbolToSortTextMap,
539-
isJsxIdentifierExpected,
540-
isRightOfOpenTag,
541-
);
511+
if (isChecked && !isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) {
512+
return undefined;
542513
}
514+
const uniqueNames = getCompletionEntriesFromSymbols(
515+
symbols,
516+
entries,
517+
/*replacementToken*/ undefined,
518+
contextToken,
519+
location,
520+
sourceFile,
521+
host,
522+
program,
523+
getEmitScriptTarget(compilerOptions),
524+
log,
525+
completionKind,
526+
preferences,
527+
compilerOptions,
528+
formatContext,
529+
isTypeOnlyLocation,
530+
propertyAccessToConvert,
531+
isJsxIdentifierExpected,
532+
isJsxInitializer,
533+
importCompletionNode,
534+
recommendedCompletion,
535+
symbolToOriginInfoMap,
536+
symbolToSortTextMap,
537+
isJsxIdentifierExpected,
538+
isRightOfOpenTag,
539+
);
543540

544541
if (keywordFilters !== KeywordCompletionFilters.None) {
545542
const entryNames = new Set(entries.map(e => e.name));
@@ -562,32 +559,6 @@ namespace ts.Completions {
562559
}
563560

564561
if (!isChecked) {
565-
const uniqueNames = getCompletionEntriesFromSymbols(
566-
symbols,
567-
entries,
568-
/*replacementToken*/ undefined,
569-
contextToken,
570-
location,
571-
sourceFile,
572-
host,
573-
program,
574-
getEmitScriptTarget(compilerOptions),
575-
log,
576-
completionKind,
577-
preferences,
578-
compilerOptions,
579-
formatContext,
580-
isTypeOnlyLocation,
581-
propertyAccessToConvert,
582-
isJsxIdentifierExpected,
583-
isJsxInitializer,
584-
importCompletionNode,
585-
recommendedCompletion,
586-
symbolToOriginInfoMap,
587-
symbolToSortTextMap,
588-
isJsxIdentifierExpected,
589-
isRightOfOpenTag,
590-
);
591562
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, getEmitScriptTarget(compilerOptions), entries);
592563
}
593564

0 commit comments

Comments
 (0)