fix(language-service): resolve the real path for symlink (#35895)

when AOT resolves the module name, it will preserve the path of the symlink, but the ts-server will return the real path for symlink.

PR Close #35895
This commit is contained in:
ivanwonder 2020-03-06 12:24:26 +08:00 committed by Matias Niemelä
parent 44f9fa6ce5
commit 4e1d780554
1 changed files with 5 additions and 0 deletions

View File

@ -19,6 +19,8 @@ class ReflectorModuleModuleResolutionHost implements ts.ModuleResolutionHost, Me
});
readonly directoryExists?: (directoryName: string) => boolean;
// Resolve a symbolic link.
realpath?: (path: string) => string;
constructor(
private readonly tsLSHost: ts.LanguageServiceHost,
@ -26,6 +28,9 @@ class ReflectorModuleModuleResolutionHost implements ts.ModuleResolutionHost, Me
if (tsLSHost.directoryExists) {
this.directoryExists = directoryName => tsLSHost.directoryExists !(directoryName);
}
if (tsLSHost.realpath) {
this.realpath = path => tsLSHost.realpath !(path);
}
}
fileExists(fileName: string): boolean {