File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 106
106
},
107
107
"port" : {
108
108
"description" : " Port to connect to." ,
109
- "type" : " number"
109
+ "type" : [ " number" , " string " ]
110
110
}
111
111
},
112
112
"required" : [
147
147
},
148
148
"port" : {
149
149
"description" : " Port to listen on." ,
150
- "type" : " number"
150
+ "type" : [ " number" , " string " ]
151
151
}
152
152
},
153
153
"required" : [
Original file line number Diff line number Diff line change @@ -58,10 +58,13 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
58
58
configuration . connect . port
59
59
} `,
60
60
) ;
61
- return new DebugAdapterServer ( configuration . connect . port , configuration . connect . host ?? '127.0.0.1' ) ;
61
+ return new DebugAdapterServer (
62
+ Number ( configuration . connect . port ) ,
63
+ configuration . connect . host ?? '127.0.0.1' ,
64
+ ) ;
62
65
} else if ( configuration . port !== undefined ) {
63
66
traceLog ( `Connecting to DAP Server at: ${ configuration . host ?? '127.0.0.1' } :${ configuration . port } ` ) ;
64
- return new DebugAdapterServer ( configuration . port , configuration . host ?? '127.0.0.1' ) ;
67
+ return new DebugAdapterServer ( Number ( configuration . port ) , configuration . host ?? '127.0.0.1' ) ;
65
68
} else if ( configuration . listen === undefined && configuration . processId === undefined ) {
66
69
throw new Error ( '"request":"attach" requires either "connect", "listen", or "processId"' ) ;
67
70
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export type PathMapping = {
45
45
46
46
type Connection = {
47
47
host ?: string ;
48
- port ?: number ;
48
+ port ?: number | string ;
49
49
} ;
50
50
51
51
export interface IAutomaticCodeReload {
@@ -64,7 +64,7 @@ interface ICommonDebugArguments {
64
64
justMyCode ?: boolean ;
65
65
logToFile ?: boolean ;
66
66
debugOptions ?: DebugOptions [ ] ;
67
- port ?: number ;
67
+ port ?: number | string ;
68
68
host ?: string ;
69
69
// Show return values of functions while stepping.
70
70
showReturnValue ?: boolean ;
Original file line number Diff line number Diff line change @@ -182,6 +182,16 @@ suite('Debugging - Adapter Factory', () => {
182
182
assert . deepStrictEqual ( descriptor , debugServer ) ;
183
183
} ) ;
184
184
185
+ test ( 'Return Debug Adapter server if request is "attach", and connect is specified with port as string' , async ( ) => {
186
+ const session = createSession ( { request : 'attach' , connect : { port : '5678' , host : 'localhost' } } ) ;
187
+ const debugServer = new DebugAdapterServer ( 5678 , session . configuration . connect . host ) ;
188
+ const descriptor = await factory . createDebugAdapterDescriptor ( session , nodeExecutable ) ;
189
+
190
+ // Interpreter not needed for connect
191
+ sinon . assert . neverCalledWith ( getInterpretersStub ) ;
192
+ assert . deepStrictEqual ( descriptor , debugServer ) ;
193
+ } ) ;
194
+
185
195
test ( 'Return Debug Adapter executable if request is "attach", and listen is specified' , async ( ) => {
186
196
const session = createSession ( { request : 'attach' , listen : { port : 5678 , host : 'localhost' } } ) ;
187
197
const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ debugAdapterPath ] ) ;
You can’t perform that action at this time.
0 commit comments