Fix bug: normalize path after combining (#21100)
This commit is contained in:
parent
191b9750c3
commit
fed34cd616
|
@ -216,7 +216,8 @@ namespace ts.Completions.PathCompletions {
|
||||||
const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory;
|
const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + getDirectoryPath(fragment)) : normalizedPrefixDirectory;
|
||||||
|
|
||||||
const normalizedSuffix = normalizePath(parsed.suffix);
|
const normalizedSuffix = normalizePath(parsed.suffix);
|
||||||
const baseDirectory = combinePaths(baseUrl, expandedPrefixDirectory);
|
// Need to normalize after combining: If we combinePaths("a", "../b"), we want "b" and not "a/../b".
|
||||||
|
const baseDirectory = normalizePath(combinePaths(baseUrl, expandedPrefixDirectory));
|
||||||
const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;
|
const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;
|
||||||
|
|
||||||
// If we have a suffix, then we need to read the directory all the way down. We could create a glob
|
// If we have a suffix, then we need to read the directory all the way down. We could create a glob
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/// <reference path="fourslash.ts" />
|
||||||
|
|
||||||
|
// @Filename: /src/a.ts
|
||||||
|
////import { } from "foo/[|/**/|]";
|
||||||
|
|
||||||
|
// @Filename: /oof/x.ts
|
||||||
|
////export const x = 0;
|
||||||
|
|
||||||
|
// @Filename: /tsconfig.json
|
||||||
|
////{
|
||||||
|
//// "compilerOptions": {
|
||||||
|
//// "baseUrl": "src",
|
||||||
|
//// "paths": {
|
||||||
|
//// "foo/*": ["../oof/*"]
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
////}
|
||||||
|
|
||||||
|
const [replacementSpan] = test.ranges();
|
||||||
|
verify.completionsAt("", [{ name: "x", replacementSpan }]);
|
Loading…
Reference in a new issue