@@ -31,7 +31,7 @@ import { isDebuggerMainContribution } from 'vs/workbench/contrib/debug/common/de
3131
3232export class Debugger implements IDebugger {
3333
34- private debuggerContribution : IDebuggerContribution = { } ;
34+ private debuggerContribution : IDebuggerContribution ;
3535 private mergedExtensionDescriptions : IExtensionDescription [ ] = [ ] ;
3636 private mainExtensionDescription : IExtensionDescription | undefined ;
3737
@@ -42,6 +42,7 @@ export class Debugger implements IDebugger {
4242 @IConfigurationResolverService private readonly configurationResolverService : IConfigurationResolverService ,
4343 @ITelemetryService private readonly telemetryService : ITelemetryService ,
4444 ) {
45+ this . debuggerContribution = { type : dbgContribution . type } ;
4546 this . merge ( dbgContribution , extensionDescription ) ;
4647 }
4748
@@ -149,12 +150,15 @@ export class Debugger implements IDebugger {
149150 if ( this . debuggerContribution . adapterExecutableCommand ) {
150151 console . info ( 'debugAdapterExecutable attribute in package.json is deprecated and support for it will be removed soon; please use DebugAdapterDescriptorFactory.createDebugAdapterDescriptor instead.' ) ;
151152 const rootFolder = session . root ? session . root . uri . toString ( ) : undefined ;
152- return this . commandService . executeCommand < IDebugAdapterExecutable > ( this . debuggerContribution . adapterExecutableCommand , rootFolder ) . then ( ( ae : { command : string , args : string [ ] } ) => {
153- return < IAdapterDescriptor > {
154- type : 'executable' ,
155- command : ae . command ,
156- args : ae . args || [ ]
157- } ;
153+ return this . commandService . executeCommand < IDebugAdapterExecutable > ( this . debuggerContribution . adapterExecutableCommand , rootFolder ) . then ( ae => {
154+ if ( ae ) {
155+ return < IAdapterDescriptor > {
156+ type : 'executable' ,
157+ command : ae . command ,
158+ args : ae . args || [ ]
159+ } ;
160+ }
161+ throw new Error ( 'command adapterExecutableCommand did not return proper command.' ) ;
158162 } ) ;
159163 }
160164
@@ -197,15 +201,15 @@ export class Debugger implements IDebugger {
197201 return this . debuggerContribution . type ;
198202 }
199203
200- get variables ( ) : { [ key : string ] : string } {
204+ get variables ( ) : { [ key : string ] : string } | undefined {
201205 return this . debuggerContribution . variables ;
202206 }
203207
204- get configurationSnippets ( ) : IJSONSchemaSnippet [ ] {
208+ get configurationSnippets ( ) : IJSONSchemaSnippet [ ] | undefined {
205209 return this . debuggerContribution . configurationSnippets ;
206210 }
207211
208- get languages ( ) : string [ ] {
212+ get languages ( ) : string [ ] | undefined {
209213 return this . debuggerContribution . languages ;
210214 }
211215
@@ -254,8 +258,11 @@ export class Debugger implements IDebugger {
254258 }
255259
256260 @memoize
257- getCustomTelemetryService ( ) : Promise < TelemetryService > {
258- if ( ! this . debuggerContribution . aiKey ) {
261+ getCustomTelemetryService ( ) : Promise < TelemetryService | undefined > {
262+
263+ const aiKey = this . debuggerContribution . aiKey ;
264+
265+ if ( ! aiKey ) {
259266 return Promise . resolve ( undefined ) ;
260267 }
261268
@@ -270,7 +277,7 @@ export class Debugger implements IDebugger {
270277 {
271278 serverName : 'Debug Telemetry' ,
272279 timeout : 1000 * 60 * 5 ,
273- args : [ `${ this . getMainExtensionDescriptor ( ) . publisher } .${ this . type } ` , JSON . stringify ( data ) , this . debuggerContribution . aiKey ] ,
280+ args : [ `${ this . getMainExtensionDescriptor ( ) . publisher } .${ this . type } ` , JSON . stringify ( data ) , aiKey ] ,
274281 env : {
275282 ELECTRON_RUN_AS_NODE : 1 ,
276283 PIPE_LOGGING : 'true' ,
@@ -286,10 +293,12 @@ export class Debugger implements IDebugger {
286293 } ) ;
287294 }
288295
289- getSchemaAttributes ( ) : IJSONSchema [ ] {
296+ getSchemaAttributes ( ) : IJSONSchema [ ] | null {
297+
290298 if ( ! this . debuggerContribution . configurationAttributes ) {
291299 return null ;
292300 }
301+
293302 // fill in the default configuration attributes shared by all adapters.
294303 const taskSchema = TaskDefinitionRegistry . getJsonSchema ( ) ;
295304 return Object . keys ( this . debuggerContribution . configurationAttributes ) . map ( request => {
@@ -339,9 +348,9 @@ export class Debugger implements IDebugger {
339348 } ;
340349 properties [ 'internalConsoleOptions' ] = INTERNAL_CONSOLE_OPTIONS_SCHEMA ;
341350 // Clear out windows, linux and osx fields to not have cycles inside the properties object
342- properties [ 'windows' ] = undefined ;
343- properties [ 'osx' ] = undefined ;
344- properties [ 'linux' ] = undefined ;
351+ delete properties [ 'windows' ] ;
352+ delete properties [ 'osx' ] ;
353+ delete properties [ 'linux' ] ;
345354
346355 const osProperties = objects . deepClone ( properties ) ;
347356 properties [ 'windows' ] = {
@@ -359,11 +368,10 @@ export class Debugger implements IDebugger {
359368 description : nls . localize ( 'debugLinuxConfiguration' , "Linux specific launch configuration attributes." ) ,
360369 properties : osProperties
361370 } ;
362- Object . keys ( attributes . properties ) . forEach ( name => {
371+ Object . keys ( properties ) . forEach ( name => {
363372 // Use schema allOf property to get independent error reporting #21113
364- ConfigurationResolverUtils . applyDeprecatedVariableMessage ( attributes . properties [ name ] ) ;
373+ ConfigurationResolverUtils . applyDeprecatedVariableMessage ( properties [ name ] ) ;
365374 } ) ;
366-
367375 return attributes ;
368376 } ) ;
369377 }
0 commit comments