@@ -12,7 +12,7 @@ import {
1212 SUPPORTED_LANGUAGES ,
1313 SUPPORTED_SUITE_FILE_EXTENSIONS ,
1414} from "./languageclientsmanger" ;
15- import { filterAsync , Mutex , sleep , WeakValueMap } from "./utils" ;
15+ import { filterAsync , Mutex , sleep , truncateAndReplaceNewlines , WeakValueMap } from "./utils" ;
1616import { CONFIG_SECTION } from "./config" ;
1717import { Range , Diagnostic , DiagnosticSeverity } from "vscode-languageclient/node" ;
1818
@@ -189,6 +189,10 @@ export class TestControllerManager {
189189 break ;
190190 }
191191 }
192+ this . updateRunProfiles ( ) . then (
193+ ( _ ) => undefined ,
194+ ( _ ) => undefined ,
195+ ) ;
192196 } ) ,
193197 vscode . workspace . onDidCloseTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
194198 vscode . workspace . onDidSaveTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
@@ -281,7 +285,7 @@ export class TestControllerManager {
281285 }
282286
283287 private async updateRunProfiles ( ) : Promise < void > {
284- await this . runProfilesMutex . dispatch ( ( ) => {
288+ await this . runProfilesMutex . dispatch ( async ( ) => {
285289 for ( const a of this . runProfiles ) {
286290 a . dispose ( ) ;
287291 }
@@ -292,7 +296,7 @@ export class TestControllerManager {
292296 for ( const folder of vscode . workspace . workspaceFolders ?? [ ] ) {
293297 const folderTag = this . getFolderTag ( folder ) ;
294298
295- const folderName = multiFolders ? ` ( ${ folder . name } ) ` : "" ;
299+ const folderName = multiFolders ? ` [ ${ folder . name } ] ` : "" ;
296300
297301 const runProfile = this . testController . createRunProfile (
298302 "Run" + folderName ,
@@ -334,7 +338,9 @@ export class TestControllerManager {
334338
335339 configurations ?. forEach ( ( config , index ) => {
336340 if ( config . type === "robotcode" && config . purpose == "test-profile" ) {
337- const name = ( ( config . name || `Profile ${ index } ` ) as string ) + folderName ;
341+ const name =
342+ ( config . name ? truncateAndReplaceNewlines ( ( config . name as string ) . trim ( ) ) : `Profile ${ index } ` ) +
343+ folderName ;
338344
339345 const runProfile = this . testController . createRunProfile (
340346 "Run " + name ,
@@ -357,6 +363,35 @@ export class TestControllerManager {
357363 this . runProfiles . push ( debugProfile ) ;
358364 }
359365 } ) ;
366+
367+ const profiles = await this . getRobotCodeProfiles ( folder ) ;
368+
369+ profiles . profiles . forEach ( ( profile , index ) => {
370+ const name =
371+ ( truncateAndReplaceNewlines ( profile . name . trim ( ) ) || `Profile ${ index } ` ) +
372+ ( profile . description ? ` - ${ truncateAndReplaceNewlines ( profile . description . trim ( ) ) } ` : "" ) +
373+ folderName ;
374+
375+ const runProfile = this . testController . createRunProfile (
376+ "Run " + name ,
377+ vscode . TestRunProfileKind . Run ,
378+ async ( request , token ) => this . runTests ( request , token , [ profile . name ] ) ,
379+ false ,
380+ folderTag ,
381+ ) ;
382+
383+ this . runProfiles . push ( runProfile ) ;
384+
385+ const debugProfile = this . testController . createRunProfile (
386+ "Debug " + name ,
387+ vscode . TestRunProfileKind . Debug ,
388+ async ( request , token ) => this . runTests ( request , token , [ profile . name ] ) ,
389+ false ,
390+ folderTag ,
391+ ) ;
392+
393+ this . runProfiles . push ( debugProfile ) ;
394+ } ) ;
360395 }
361396 } ) ;
362397 }
0 commit comments