Remove unnecessary filtering of tsx completions (#24004)

This commit is contained in:
Andy
2018-05-09 15:18:45 -07:00
committed by GitHub
parent 11e3e2470d
commit da413d6fef
3 changed files with 25 additions and 8 deletions

View File

@@ -899,7 +899,7 @@ namespace FourSlash {
}
else {
const found = actualByName.get(exclude.name);
if (found.source === exclude.source) {
if (found && found.source === exclude.source) {
this.raiseError(`Did not expect to get a completion named ${exclude.name} with source ${exclude.source}`);
}
}

View File

@@ -972,12 +972,8 @@ namespace ts.Completions {
}
else if (isRightOfOpenTag) {
const tagSymbols = Debug.assertEachDefined(typeChecker.getJsxIntrinsicTagNamesAt(location), "getJsxIntrinsicTagNames() should all be defined");
if (tryGetGlobalSymbols()) {
symbols = tagSymbols.concat(symbols.filter(s => !!(s.flags & (SymbolFlags.Value | SymbolFlags.Alias))));
}
else {
symbols = tagSymbols;
}
tryGetGlobalSymbols();
symbols = tagSymbols.concat(symbols);
completionKind = CompletionKind.MemberLike;
}
else if (isStartingCloseTag) {
@@ -1298,7 +1294,7 @@ namespace ts.Completions {
const exportedSymbols = typeChecker.getExportsOfModule(symbol);
// If the exported symbols contains type,
// symbol can be referenced at locations where type is allowed
return forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation);
return exportedSymbols.some(symbolCanBeReferencedAtTypeLocation);
}
}

View File

@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />
// @noLib: true
// @nolib: true
// @jsx: preserve
// @Filename: /a.tsx
////export type Bar = 0;
////export default function Foo() {};
// @Filename: /b.tsx
////<Fo/**/ />;
verify.completions({
marker: "",
includes: { name: "Foo", source: "/a.tsx", hasAction: true },
excludes: "Bar",
preferences: {
includeCompletionsForModuleExports: true,
},
});