@@ -76,15 +76,13 @@ export class InvalidPythonInterpreterDiagnostic extends BaseDiagnostic {
76
76
}
77
77
}
78
78
79
+ type DefaultShellDiagnostics =
80
+ | DiagnosticCodes . InvalidComspecDiagnostic
81
+ | DiagnosticCodes . IncompletePathVarDiagnostic
82
+ | DiagnosticCodes . DefaultShellErrorDiagnostic ;
83
+
79
84
export class DefaultShellDiagnostic extends BaseDiagnostic {
80
- constructor (
81
- code :
82
- | DiagnosticCodes . InvalidComspecDiagnostic
83
- | DiagnosticCodes . IncompletePathVarDiagnostic
84
- | DiagnosticCodes . DefaultShellErrorDiagnostic ,
85
- resource : Resource ,
86
- scope = DiagnosticScope . Global ,
87
- ) {
85
+ constructor ( code : DefaultShellDiagnostics , resource : Resource , scope = DiagnosticScope . Global ) {
88
86
super ( code , messages [ code ] , DiagnosticSeverity . Error , scope , resource , undefined , 'always' ) ;
89
87
}
90
88
}
@@ -106,6 +104,7 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService
106
104
DiagnosticCodes . InvalidPythonInterpreterDiagnostic ,
107
105
DiagnosticCodes . InvalidComspecDiagnostic ,
108
106
DiagnosticCodes . IncompletePathVarDiagnostic ,
107
+ DiagnosticCodes . DefaultShellErrorDiagnostic ,
109
108
] ,
110
109
serviceContainer ,
111
110
disposableRegistry ,
@@ -262,35 +261,22 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService
262
261
263
262
private getCommandPrompts ( diagnostic : IDiagnostic ) : { prompt : string ; command ?: IDiagnosticCommand } [ ] {
264
263
const commandFactory = this . serviceContainer . get < IDiagnosticsCommandFactory > ( IDiagnosticsCommandFactory ) ;
265
- if ( diagnostic . code === DiagnosticCodes . InvalidComspecDiagnostic ) {
266
- return [
267
- {
268
- prompt : Common . seeInstructions ,
269
- command : commandFactory . createCommand ( diagnostic , {
270
- type : 'launch' ,
271
- options : 'https://aka.ms/AAk3djo' ,
272
- } ) ,
273
- } ,
274
- ] ;
275
- }
276
- if ( diagnostic . code === DiagnosticCodes . IncompletePathVarDiagnostic ) {
277
- return [
278
- {
279
- prompt : Common . seeInstructions ,
280
- command : commandFactory . createCommand ( diagnostic , {
281
- type : 'launch' ,
282
- options : 'https://aka.ms/AAk744c' ,
283
- } ) ,
284
- } ,
285
- ] ;
286
- }
287
- if ( diagnostic . code === DiagnosticCodes . DefaultShellErrorDiagnostic ) {
264
+ if (
265
+ diagnostic . code === DiagnosticCodes . InvalidComspecDiagnostic ||
266
+ diagnostic . code === DiagnosticCodes . IncompletePathVarDiagnostic ||
267
+ diagnostic . code === DiagnosticCodes . DefaultShellErrorDiagnostic
268
+ ) {
269
+ const links : Record < DefaultShellDiagnostics , string > = {
270
+ InvalidComspecDiagnostic : 'https://aka.ms/AAk3djo' ,
271
+ IncompletePathVarDiagnostic : 'https://aka.ms/AAk744c' ,
272
+ DefaultShellErrorDiagnostic : 'https://aka.ms/AAk7qix' ,
273
+ } ;
288
274
return [
289
275
{
290
276
prompt : Common . seeInstructions ,
291
277
command : commandFactory . createCommand ( diagnostic , {
292
278
type : 'launch' ,
293
- options : 'https://aka.ms/AAk7qix' ,
279
+ options : links [ diagnostic . code ] ,
294
280
} ) ,
295
281
} ,
296
282
] ;
0 commit comments