File tree Expand file tree Collapse file tree 3 files changed +23
-12
lines changed Expand file tree Collapse file tree 3 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ export class DebugAdapterTracker implements vscode.DebugAdapterTracker {
33
33
private get isCoverage ( ) : boolean {
34
34
return this . debugSession . configuration . isCoverage ;
35
35
}
36
+ private get processExe ( ) : string {
37
+ return this . debugSession . configuration . processExe ;
38
+ }
36
39
private get context ( ) {
37
40
return DebugConfigurationProvider . getContextForSession ( this . sessionID ) ! ;
38
41
}
@@ -48,15 +51,15 @@ export class DebugAdapterTracker implements vscode.DebugAdapterTracker {
48
51
this . debugSession = debugSession ;
49
52
this . problemResolver = problemResolver ;
50
53
this . _stream = fs . createWriteStream ( getFilePathInWorkspace ( this . logPath ) , { flags : "a+" } ) ;
51
- this . simulatorInteractor = new SimulatorFocus ( this . context . commandContext ) ;
54
+ this . simulatorInteractor = new SimulatorFocus ( ) ;
52
55
}
53
56
54
57
private get logPath ( ) : string {
55
58
return this . debugSession . configuration . logPath ;
56
59
}
57
60
58
61
onWillStartSession ( ) {
59
- this . simulatorInteractor . init ( ) ;
62
+ this . simulatorInteractor . init ( this . context . commandContext . projectEnv , this . processExe ) ;
60
63
console . log ( "Session is starting" ) ;
61
64
vscode . debug . activeDebugSession ;
62
65
this . disList . push (
Original file line number Diff line number Diff line change @@ -167,12 +167,16 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
167
167
if ( testToRun . length === 0 ) {
168
168
continue ;
169
169
}
170
+ const device = await context . projectEnv . debugDeviceID ;
170
171
const debugSession : vscode . DebugConfiguration = {
171
172
type : "xcode-lldb" ,
172
173
name : `Xcode: Testing: ${ session . target } ` ,
173
174
request : "launch" ,
174
175
target : "tests" ,
175
- isDebuggable : isDebuggable ,
176
+ isDebuggable :
177
+ device . platform === "macOS" && session . host . includes ( "-Runner.app" )
178
+ ? false
179
+ : isDebuggable , // for macOS, we can not debug UITests as it freezes for some reason
176
180
sessionId : sessionId ,
177
181
testsToRun : testToRun ,
178
182
buildBeforeLaunch : "never" ,
@@ -386,6 +390,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
386
390
deviceID : deviceID . id ,
387
391
xctestrun : dbgConfig . xctestrun ,
388
392
isCoverage : dbgConfig . isCoverage ,
393
+ processExe : processExe ,
389
394
} ;
390
395
return debugSession ;
391
396
} else {
@@ -434,6 +439,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
434
439
deviceID : deviceID . id ,
435
440
xctestrun : dbgConfig . xctestrun ,
436
441
isCoverage : dbgConfig . isCoverage ,
442
+ processExe : processExe ,
437
443
} ;
438
444
return debugSession ;
439
445
}
Original file line number Diff line number Diff line change 1
1
import { execSync } from "child_process" ;
2
- import { CommandContext } from "../CommandManagement/CommandContext " ;
3
- import { DeviceID } from "../env " ;
2
+ import { DeviceID , ProjectEnv } from "../env " ;
3
+ import path from "path " ;
4
4
5
5
export class SimulatorFocus {
6
- private context : CommandContext ;
7
6
private deviceID ?: DeviceID ;
8
7
private productName ?: string ;
9
8
10
- constructor ( context : CommandContext ) {
11
- this . context = context ;
12
- }
9
+ constructor ( ) { }
13
10
14
- async init ( ) {
15
- this . deviceID = await this . context . projectEnv . debugDeviceID ;
16
- this . productName = await this . context . projectEnv . productName ;
11
+ async init ( projectEnv : ProjectEnv , processExe : string ) {
12
+ this . deviceID = await projectEnv . debugDeviceID ;
13
+ this . productName = processExe . split ( path . sep ) . at ( 0 ) ;
14
+ if ( this . productName === undefined ) {
15
+ this . productName = await projectEnv . productName ;
16
+ } else if ( this . productName . endsWith ( ".app" ) ) {
17
+ this . productName = this . productName . slice ( 0 , - ".app" . length ) ;
18
+ }
17
19
}
18
20
19
21
focus ( ) {
You can’t perform that action at this time.
0 commit comments