60a1b1dc1a
* Move package.json related utils to utilities * Add failing test * Make first test pass * Don’t filter when there’s no package.json, fix scoped package imports * Use type acquisition as a heuristic for whether a JS project is using node core * Make same fix in getCompletionDetails * Fix re-exporting * Change JS node core module heuristic to same-file utilization * Remove unused method * Remove other unused method * Remove unused triple-slash ref * Update comment * Refactor findAlias to forEachAlias to reduce iterations * Really fix re-exporting * Use getModuleSpecifier instead of custom hack * Fix offering auto imports to paths within node modules * Rename things and make comments better * Add another reexport test * Inline `symbolHasBeenSeen` * Simplify forEachAlias to findAlias * Add note that symbols is mutated * Symbol order doesn’t matter here * Style nits * Add test with nested package.jsons * Fix and add tests for export * re-exports
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/// <reference path="fourslash.ts" />
|
|
|
|
// Tests that we don't filter out a completion for an alias,
|
|
// so long as it's not an alias to a different module.
|
|
|
|
// @module: esnext
|
|
|
|
// @Filename: /a.ts
|
|
////const foo = 0;
|
|
////export { foo };
|
|
|
|
// @Filename: /a_reexport.ts
|
|
// Should not show up in completions
|
|
////export { foo } from "./a";
|
|
|
|
// @Filename: /a_reexport_2.ts
|
|
////export * from "./a";
|
|
|
|
// @Filename: /a_reexport_3.ts
|
|
////export { foo } from "./a_reexport";
|
|
|
|
// @Filename: /b.ts
|
|
////fo/**/
|
|
|
|
verify.completions({
|
|
marker: "",
|
|
includes: [
|
|
completion.undefinedVarEntry,
|
|
{
|
|
name: "foo",
|
|
source: "/a",
|
|
sourceDisplay: "./a",
|
|
text: "(alias) const foo: 0\nexport foo",
|
|
kind: "alias",
|
|
hasAction: true,
|
|
sortText: completion.SortText.AutoImportSuggestions
|
|
},
|
|
...completion.statementKeywordsWithTypes,
|
|
],
|
|
preferences: { includeCompletionsForModuleExports: true },
|
|
});
|
|
|
|
verify.applyCodeActionFromCompletion("", {
|
|
name: "foo",
|
|
source: "/a",
|
|
description: `Import 'foo' from module "./a"`,
|
|
newFileContent: `import { foo } from "./a";
|
|
|
|
fo`,
|
|
});
|