@@ -218,7 +218,7 @@ namespace ts.server.typingsInstaller {
218218 this . knownCachesSet [ cacheLocation ] = true ;
219219 }
220220
221- private filterAndMapToScopedName ( typingsToInstall : string [ ] ) {
221+ private filterTypings ( typingsToInstall : string [ ] ) {
222222 if ( typingsToInstall . length === 0 ) {
223223 return typingsToInstall ;
224224 }
@@ -230,7 +230,7 @@ namespace ts.server.typingsInstaller {
230230 const validationResult = validatePackageName ( typing ) ;
231231 if ( validationResult === PackageNameValidationResult . Ok ) {
232232 if ( typing in this . typesRegistry ) {
233- result . push ( `@types/ ${ typing } ` ) ;
233+ result . push ( typing ) ;
234234 }
235235 else {
236236 if ( this . log . isEnabled ( ) ) {
@@ -286,7 +286,8 @@ namespace ts.server.typingsInstaller {
286286 if ( this . log . isEnabled ( ) ) {
287287 this . log . writeLine ( `Installing typings ${ JSON . stringify ( typingsToInstall ) } ` ) ;
288288 }
289- const scopedTypings = this . filterAndMapToScopedName ( typingsToInstall ) ;
289+ const filteredTypings = this . filterTypings ( typingsToInstall ) ;
290+ const scopedTypings = filteredTypings . map ( x => `@types/${ x } ` ) ;
290291 if ( scopedTypings . length === 0 ) {
291292 if ( this . log . isEnabled ( ) ) {
292293 this . log . writeLine ( `All typings are known to be missing or invalid - no need to go any further` ) ;
@@ -303,11 +304,18 @@ namespace ts.server.typingsInstaller {
303304 if ( this . telemetryEnabled ) {
304305 this . sendResponse ( < TypingsInstallEvent > {
305306 kind : EventInstall ,
306- packagesToInstall : scopedTypings
307+ packagesToInstall : scopedTypings ,
308+ installSuccess : ok
307309 } ) ;
308310 }
309311
310312 if ( ! ok ) {
313+ if ( this . log . isEnabled ( ) ) {
314+ this . log . writeLine ( `install request failed, marking packages as missing to prevent repeated requests: ${ JSON . stringify ( filteredTypings ) } ` ) ;
315+ }
316+ for ( const typing of filteredTypings ) {
317+ this . missingTypingsSet [ typing ] = true ;
318+ }
311319 return ;
312320 }
313321
0 commit comments