@@ -12,7 +12,7 @@ import {
12
12
SUPPORTED_LANGUAGES ,
13
13
SUPPORTED_SUITE_FILE_EXTENSIONS ,
14
14
} from "./languageclientsmanger" ;
15
- import { filterAsync , Mutex , sleep , WeakValueMap } from "./utils" ;
15
+ import { filterAsync , Mutex , sleep , truncateAndReplaceNewlines , WeakValueMap } from "./utils" ;
16
16
import { CONFIG_SECTION } from "./config" ;
17
17
import { Range , Diagnostic , DiagnosticSeverity } from "vscode-languageclient/node" ;
18
18
@@ -189,6 +189,10 @@ export class TestControllerManager {
189
189
break ;
190
190
}
191
191
}
192
+ this . updateRunProfiles ( ) . then (
193
+ ( _ ) => undefined ,
194
+ ( _ ) => undefined ,
195
+ ) ;
192
196
} ) ,
193
197
vscode . workspace . onDidCloseTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
194
198
vscode . workspace . onDidSaveTextDocument ( ( document ) => this . refreshDocument ( document ) ) ,
@@ -281,7 +285,7 @@ export class TestControllerManager {
281
285
}
282
286
283
287
private async updateRunProfiles ( ) : Promise < void > {
284
- await this . runProfilesMutex . dispatch ( ( ) => {
288
+ await this . runProfilesMutex . dispatch ( async ( ) => {
285
289
for ( const a of this . runProfiles ) {
286
290
a . dispose ( ) ;
287
291
}
@@ -292,7 +296,7 @@ export class TestControllerManager {
292
296
for ( const folder of vscode . workspace . workspaceFolders ?? [ ] ) {
293
297
const folderTag = this . getFolderTag ( folder ) ;
294
298
295
- const folderName = multiFolders ? ` ( ${ folder . name } ) ` : "" ;
299
+ const folderName = multiFolders ? ` [ ${ folder . name } ] ` : "" ;
296
300
297
301
const runProfile = this . testController . createRunProfile (
298
302
"Run" + folderName ,
@@ -334,7 +338,9 @@ export class TestControllerManager {
334
338
335
339
configurations ?. forEach ( ( config , index ) => {
336
340
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 ;
338
344
339
345
const runProfile = this . testController . createRunProfile (
340
346
"Run " + name ,
@@ -357,6 +363,35 @@ export class TestControllerManager {
357
363
this . runProfiles . push ( debugProfile ) ;
358
364
}
359
365
} ) ;
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
+ } ) ;
360
395
}
361
396
} ) ;
362
397
}
0 commit comments