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 106106 },
107107 "port" : {
108108 "description" : " Port to connect to." ,
109- "type" : " number"
109+ "type" : [ " number" , " string " ]
110110 }
111111 },
112112 "required" : [
147147 },
148148 "port" : {
149149 "description" : " Port to listen on." ,
150- "type" : " number"
150+ "type" : [ " number" , " string " ]
151151 }
152152 },
153153 "required" : [
Original file line number Diff line number Diff line change @@ -58,10 +58,13 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
5858 configuration . connect . port
5959 } `,
6060 ) ;
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+ ) ;
6265 } else if ( configuration . port !== undefined ) {
6366 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' ) ;
6568 } else if ( configuration . listen === undefined && configuration . processId === undefined ) {
6669 throw new Error ( '"request":"attach" requires either "connect", "listen", or "processId"' ) ;
6770 }
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export type PathMapping = {
4545
4646type Connection = {
4747 host ?: string ;
48- port ?: number ;
48+ port ?: number | string ;
4949} ;
5050
5151export interface IAutomaticCodeReload {
@@ -64,7 +64,7 @@ interface ICommonDebugArguments {
6464 justMyCode ?: boolean ;
6565 logToFile ?: boolean ;
6666 debugOptions ?: DebugOptions [ ] ;
67- port ?: number ;
67+ port ?: number | string ;
6868 host ?: string ;
6969 // Show return values of functions while stepping.
7070 showReturnValue ?: boolean ;
Original file line number Diff line number Diff line change @@ -182,6 +182,16 @@ suite('Debugging - Adapter Factory', () => {
182182 assert . deepStrictEqual ( descriptor , debugServer ) ;
183183 } ) ;
184184
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+
185195 test ( 'Return Debug Adapter executable if request is "attach", and listen is specified' , async ( ) => {
186196 const session = createSession ( { request : 'attach' , listen : { port : 5678 , host : 'localhost' } } ) ;
187197 const debugExecutable = new DebugAdapterExecutable ( pythonPath , [ debugAdapterPath ] ) ;
You can’t perform that action at this time.
0 commit comments