@@ -36,6 +36,7 @@ export function activate(context: vscode.ExtensionContext): void {
3636
3737 ev3devBrowserProvider = new Ev3devBrowserProvider ( ) ;
3838 const factory = new Ev3devDebugAdapterDescriptorFactory ( ) ;
39+ const provider = new Ev3devDebugConfigurationProvider ( ) ;
3940 context . subscriptions . push (
4041 output , ev3devBrowserProvider ,
4142 vscode . window . registerTreeDataProvider ( 'ev3devBrowser' , ev3devBrowserProvider ) ,
@@ -57,6 +58,7 @@ export function activate(context: vscode.ExtensionContext): void {
5758 vscode . commands . registerCommand ( 'ev3devBrowser.action.refresh' , ( ) => refresh ( ) ) ,
5859 vscode . debug . onDidReceiveDebugSessionCustomEvent ( e => handleCustomDebugEvent ( e ) ) ,
5960 vscode . debug . registerDebugAdapterDescriptorFactory ( 'ev3devBrowser' , factory ) ,
61+ vscode . debug . registerDebugConfigurationProvider ( 'ev3devBrowser' , provider ) ,
6062 ) ;
6163}
6264
@@ -82,6 +84,45 @@ class Ev3devDebugAdapterDescriptorFactory implements vscode.DebugAdapterDescript
8284 }
8385}
8486
87+ class Ev3devDebugConfigurationProvider implements vscode . DebugConfigurationProvider {
88+ async resolveDebugConfiguration (
89+ _folder : vscode . WorkspaceFolder | undefined ,
90+ debugConfiguration : vscode . DebugConfiguration ,
91+ token ?: vscode . CancellationToken ,
92+ ) : Promise < vscode . DebugConfiguration | undefined > {
93+ if ( Object . keys ( debugConfiguration ) . length === 0 ) {
94+ type DebugConfigurationQuickPickItem = vscode . QuickPickItem & { interactiveTerminal : boolean } ;
95+ const items : DebugConfigurationQuickPickItem [ ] = [
96+ {
97+ label : "Download and run current file" ,
98+ description : "in interactive terminal" ,
99+ interactiveTerminal : true ,
100+ } ,
101+ {
102+ label : "Download and run current file" ,
103+ description : "in output pane" ,
104+ interactiveTerminal : false ,
105+ } ,
106+ ] ;
107+ const selected = await vscode . window . showQuickPick ( items , {
108+ matchOnDescription : true ,
109+ ignoreFocusOut : true ,
110+ placeHolder : "Debug configuration"
111+ } , token ) ;
112+ if ( selected ) {
113+ return {
114+ type : "ev3devBrowser" ,
115+ name : `${ selected . label } ${ selected . description } ` ,
116+ request : "launch" ,
117+ program : "/home/robot/${workspaceFolderBasename}/${relativeFile}" ,
118+ interactiveTerminal : selected . interactiveTerminal
119+ } ;
120+ }
121+ }
122+ return undefined ;
123+ }
124+ }
125+
85126// this method is called when your extension is deactivated
86127export function deactivate ( ) : void {
87128 // The "temp" module should clean up automatically, but do this just in case.
0 commit comments