@@ -10,6 +10,22 @@ interface KitSnapshot {
1010 addedCode : InternalHelpers . AddedCode [ ] ;
1111}
1212
13+ declare module 'typescript/lib/tsserverlibrary' {
14+ interface LanguageServiceHost {
15+ /** @internal */ getCachedExportInfoMap ?( ) : unknown ;
16+ /** @internal */ getModuleSpecifierCache ?( ) : unknown ;
17+ /** @internal */ getGlobalTypingsCacheLocation ?( ) : string | undefined ;
18+ /** @internal */ getSymlinkCache ?( files : readonly ts . SourceFile [ ] ) : unknown ;
19+ /** @internal */ getPackageJsonsVisibleToFile ?(
20+ fileName : string ,
21+ rootDir ?: string
22+ ) : readonly unknown [ ] ;
23+ /** @internal */ getPackageJsonAutoImportProvider ?( ) : ts . Program | undefined ;
24+
25+ /** @internal */ getModuleResolutionCache ?( ) : ts . ModuleResolutionCache ;
26+ }
27+ }
28+
1329const cache = new WeakMap <
1430 ts . server . PluginCreateInfo ,
1531 {
@@ -719,6 +735,51 @@ function getProxiedLanguageService(info: ts.server.PluginCreateInfo, ts: _ts, lo
719735 ? ( ...args : Parameters < NonNullable < ts . LanguageServiceHost [ 'realpath' ] > > ) =>
720736 originalLanguageServiceHost . realpath ! ( ...args )
721737 : undefined ;
738+
739+ getProjectReferences = originalLanguageServiceHost . getProjectReferences
740+ ? ( ) => originalLanguageServiceHost . getProjectReferences ! ( )
741+ : undefined ;
742+
743+ getParsedCommandLine = originalLanguageServiceHost . getParsedCommandLine
744+ ? ( fileName : string ) => originalLanguageServiceHost . getParsedCommandLine ! ( fileName )
745+ : undefined ;
746+
747+ getCachedExportInfoMap = originalLanguageServiceHost . getCachedExportInfoMap
748+ ? ( ) => originalLanguageServiceHost . getCachedExportInfoMap ! ( )
749+ : undefined ;
750+
751+ getModuleSpecifierCache = originalLanguageServiceHost . getModuleSpecifierCache
752+ ? ( ) => originalLanguageServiceHost . getModuleSpecifierCache ! ( )
753+ : undefined ;
754+
755+ getGlobalTypingsCacheLocation = originalLanguageServiceHost . getGlobalTypingsCacheLocation
756+ ? ( ) => originalLanguageServiceHost . getGlobalTypingsCacheLocation ! ( )
757+ : undefined ;
758+
759+ getSymlinkCache = originalLanguageServiceHost . getSymlinkCache
760+ ? ( ...args : any [ ] ) =>
761+ originalLanguageServiceHost . getSymlinkCache ! (
762+ // @ts -ignore
763+ ...args
764+ )
765+ : undefined ;
766+
767+ getPackageJsonsVisibleToFile = originalLanguageServiceHost . getPackageJsonsVisibleToFile
768+ ? ( ...args : any [ ] ) =>
769+ originalLanguageServiceHost . getPackageJsonsVisibleToFile ! (
770+ // @ts -ignore
771+ ...args
772+ )
773+ : undefined ;
774+
775+ getPackageJsonAutoImportProvider =
776+ originalLanguageServiceHost . getPackageJsonAutoImportProvider
777+ ? ( ) => originalLanguageServiceHost . getPackageJsonAutoImportProvider ! ( )
778+ : undefined ;
779+
780+ getModuleResolutionCache = originalLanguageServiceHost . getModuleResolutionCache
781+ ? ( ) => originalLanguageServiceHost . getModuleResolutionCache ! ( )
782+ : undefined ;
722783 }
723784
724785 // Ideally we'd create a full Proxy of the language service, but that seems to have cache issues
0 commit comments