Fix relative path completions when self package.json has typesVersions (#54842)

This commit is contained in:
Andrew Branch 2023-06-30 10:13:22 -07:00 committed by GitHub
parent 4d7738ca21
commit 76869eeda1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -598,7 +598,7 @@ function getCompletionEntriesForRelativeModules(literalValue: string, scriptDire
compilerOptions.rootDirs, literalValue, scriptDirectory, extensionOptions, compilerOptions, host, scriptPath);
}
else {
return arrayFrom(getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensionOptions, host, /*moduleSpecifierIsRelative*/ false, scriptPath).values());
return arrayFrom(getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, extensionOptions, host, /*moduleSpecifierIsRelative*/ true, scriptPath).values());
}
}

View File

@ -0,0 +1,22 @@
/// <reference path="fourslash.ts" />
// @Filename: /package.json
//// {
//// "typesVersions": {
//// "*": {
//// "*": ["./src/*"]
//// }
//// }
//// }
// @Filename: /src/add.ts
//// export function add(a: number, b: number) { return a + b; }
// @Filename: /src/index.ts
//// import { add } from ".//**/";
verify.completions({
marker: "",
isNewIdentifierLocation: true,
exact: ["add"],
});