From 4e1d780554e9864ef8e6da8a2a2202ee1b53f6f0 Mon Sep 17 00:00:00 2001 From: ivanwonder Date: Fri, 6 Mar 2020 12:24:26 +0800 Subject: [PATCH] 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 --- packages/language-service/src/reflector_host.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/language-service/src/reflector_host.ts b/packages/language-service/src/reflector_host.ts index 5e60375e6e..13ba23a885 100644 --- a/packages/language-service/src/reflector_host.ts +++ b/packages/language-service/src/reflector_host.ts @@ -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 {