mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Eagerly resolve module specifiers for auto-import completions in --moduleResolution node12+ (#48752)
* Add failing test * Block auto-import module specifiers including node_modules path * Eagerly resolve module specifiers in completions in nodenext so failures can be filtered * Add completion info flags for telemetry * Update API baseline * Update completions baselines * Fix missed boolean flip * Fix remaining tests
This commit is contained in:
@@ -52,6 +52,7 @@ namespace ts.projectSystem {
|
||||
assert.isString(exportMapKey);
|
||||
delete (response?.entries[0].data as any).exportMapKey;
|
||||
assert.deepEqual<protocol.CompletionInfo | undefined>(response, {
|
||||
flags: CompletionInfoFlags.MayIncludeAutoImports,
|
||||
isGlobalCompletion: true,
|
||||
isIncomplete: undefined,
|
||||
isMemberCompletion: false,
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace ts.projectSystem {
|
||||
command: protocol.CommandTypes.CompletionInfo,
|
||||
arguments: completionRequestArgs
|
||||
}, {
|
||||
flags: 0,
|
||||
isGlobalCompletion: false,
|
||||
isMemberCompletion: true,
|
||||
isNewIdentifierLocation: false,
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ts.projectSystem {
|
||||
describe("unittests:: tsserver:: moduleSpecifierCache", () => {
|
||||
it("caches importability within a file", () => {
|
||||
const { moduleSpecifierCache } = setup();
|
||||
assert.isTrue(moduleSpecifierCache.get(bTs.path as Path, aTs.path as Path, {}, {})?.isAutoImportable);
|
||||
assert.isFalse(moduleSpecifierCache.get(bTs.path as Path, aTs.path as Path, {}, {})?.isBlockedByPackageJsonDependencies);
|
||||
});
|
||||
|
||||
it("caches module specifiers within a file", () => {
|
||||
@@ -54,7 +54,7 @@ namespace ts.projectSystem {
|
||||
isRedirect: false
|
||||
}],
|
||||
moduleSpecifiers: ["mobx"],
|
||||
isAutoImportable: true,
|
||||
isBlockedByPackageJsonDependencies: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace ts.projectSystem {
|
||||
const { host, moduleSpecifierCache } = setup();
|
||||
host.writeFile("/src/a2.ts", aTs.content);
|
||||
host.runQueuedTimeoutCallbacks();
|
||||
assert.isTrue(moduleSpecifierCache.get(bTs.path as Path, aTs.path as Path, {}, {})?.isAutoImportable);
|
||||
assert.isFalse(moduleSpecifierCache.get(bTs.path as Path, aTs.path as Path, {}, {})?.isBlockedByPackageJsonDependencies);
|
||||
});
|
||||
|
||||
it("invalidates the cache when symlinks are added or removed", () => {
|
||||
|
||||
Reference in New Issue
Block a user