@@ -215,7 +215,7 @@ namespace ts.server.typingsInstaller {
215215 this . knownCachesSet [ cacheLocation ] = true ;
216216 }
217217
218- private filterAndMapToScopedName ( typingsToInstall : string [ ] ) {
218+ private filterTypings ( typingsToInstall : string [ ] ) {
219219 if ( typingsToInstall . length === 0 ) {
220220 return typingsToInstall ;
221221 }
@@ -227,7 +227,7 @@ namespace ts.server.typingsInstaller {
227227 const validationResult = validatePackageName ( typing ) ;
228228 if ( validationResult === PackageNameValidationResult . Ok ) {
229229 if ( typing in this . typesRegistry ) {
230- result . push ( `@types/ ${ typing } ` ) ;
230+ result . push ( typing ) ;
231231 }
232232 else {
233233 if ( this . log . isEnabled ( ) ) {
@@ -280,7 +280,8 @@ namespace ts.server.typingsInstaller {
280280 if ( this . log . isEnabled ( ) ) {
281281 this . log . writeLine ( `Installing typings ${ JSON . stringify ( typingsToInstall ) } ` ) ;
282282 }
283- const scopedTypings = this . filterAndMapToScopedName ( typingsToInstall ) ;
283+ const filteredTypings = this . filterTypings ( typingsToInstall ) ;
284+ const scopedTypings = filteredTypings . map ( x => `@types/${ x } ` ) ;
284285 if ( scopedTypings . length === 0 ) {
285286 if ( this . log . isEnabled ( ) ) {
286287 this . log . writeLine ( `All typings are known to be missing or invalid - no need to go any further` ) ;
@@ -297,11 +298,18 @@ namespace ts.server.typingsInstaller {
297298 if ( this . telemetryEnabled ) {
298299 this . sendResponse ( < TypingsInstallEvent > {
299300 kind : EventInstall ,
300- packagesToInstall : scopedTypings
301+ packagesToInstall : scopedTypings ,
302+ installSuccess : ok
301303 } ) ;
302304 }
303305
304306 if ( ! ok ) {
307+ if ( this . log . isEnabled ( ) ) {
308+ this . log . writeLine ( `install request failed, marking packages as missing to prevent repeated requests: ${ JSON . stringify ( filteredTypings ) } ` ) ;
309+ }
310+ for ( const typing of filteredTypings ) {
311+ this . missingTypingsSet [ typing ] = true ;
312+ }
305313 return ;
306314 }
307315
0 commit comments