mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 02:30:15 -06:00
This commit is contained in:
parent
0a1d427f63
commit
c63b206d4f
@ -1153,7 +1153,8 @@ namespace ts.Completions {
|
||||
}
|
||||
}
|
||||
|
||||
if (options.includeExternalModuleExports) {
|
||||
// Don't suggest import completions for a commonjs-only module
|
||||
if (options.includeExternalModuleExports && !(sourceFile.commonJsModuleIndicator && !sourceFile.externalModuleIndicator)) {
|
||||
getSymbolsFromOtherSourceFileExports(symbols, previousToken && isIdentifier(previousToken) ? previousToken.text : "", target);
|
||||
}
|
||||
filterGlobalCompletion(symbols);
|
||||
|
||||
@ -14,20 +14,8 @@
|
||||
////fo/*c*/
|
||||
|
||||
goTo.marker("b");
|
||||
verify.completionListContains({ name: "foo", source: "/a" }, "const foo: 0", "", "const", /*spanIndex*/ undefined, /*hasAction*/ true, {
|
||||
includeExternalModuleExports: true,
|
||||
sourceDisplay: "./a",
|
||||
});
|
||||
|
||||
verify.applyCodeActionFromCompletion("b", {
|
||||
name: "foo",
|
||||
source: "/a",
|
||||
description: `Import 'foo' from module "./a"`,
|
||||
newFileContent: `import { foo } from "./a";
|
||||
|
||||
const a = require("./a");
|
||||
fo`,
|
||||
});
|
||||
// Doesn't activate for commonjs-only module
|
||||
verify.not.completionListContains({ name: "foo", source: "/a" });
|
||||
|
||||
goTo.marker("c");
|
||||
verify.completionListContains({ name: "foo", source: "/a" }, "const foo: 0", "", "const", /*spanIndex*/ undefined, /*hasAction*/ true, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user