Skip to content

Commit 2668a2a

Browse files
authoredFeb 22, 2025
Fix AHK v2 debug command (#611)
1 parent c4e7447 commit 2668a2a

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed
 

‎demos/.vscode/launch.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99
"request": "launch",
1010
"name": "AutoHotkey v2 Debugger",
1111
"program": "${file}",
12-
"stopOnEntry": true,
13-
"runtime": "C:\\Program Files\\AutoHotkey\\v2\\AutoHotkey64.exe"
12+
"stopOnEntry": true
1413
},
1514
{
1615
"type": "ahk",
1716
"request": "launch",
1817
"name": "AutoHotkey v1 Debugger",
1918
"program": "${file}",
20-
"stopOnEntry": true,
21-
"runtime": "C:\\Program Files\\AutoHotkey\\v1.1.37.01\\AutoHotkeyU64.exe"
19+
"stopOnEntry": true
2220
}
2321
]
2422
}

‎demos/manualTests/debugger.ahk1

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
; Basic debugger test
55
; Ensure you've run `npm i` before running this test
6-
; 0. Debug button should appear in title bar
6+
; 0. Debug button should appear in title bar--click it!
77
; 1. Stop on breakpoint
88
; 2. Step forward works -- Global variables updates
99
; 3. No errors in Debug Console

‎demos/manualTests/debugger.ahk2

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
; Basic debugger test
55
; Ensure you've run `npm i` before running this test
6-
; 0. Debug button should appear in title bar
6+
; 0. Debug button should appear in title bar--click it!
77
; 1. Stop on breakpoint
88
; 2. Step forward works -- Global variables updates
99
; 3. No errors in Debug Console

‎src/service/runnerService.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ export const makeCompileCommand = (
2929
return `"${compilerPath}" ${guiCommand} /in "${scriptPath}" /out "${exePath}" ${compileIconCommand} ${compileBaseFileCommand} ${compileMpressCommand}`;
3030
};
3131

32-
/** Debugs and compiles AHK. Run is now located in ahk2 submodule. */
32+
/**
33+
* Debugs and compiles AHK v1 and AHK v2 scripts.
34+
* Running scripts is now located in ahk2 submodule.
35+
*/
3336
export class RunnerService {
3437
/** Start debug session */
3538
public static async startDebugger(script?: string) {
3639
const cwd = script
3740
? vscode.Uri.file(script)
3841
: vscode.window.activeTextEditor.document.uri;
3942
script = script ? script : await this.getPathByActive();
40-
const debugPlusExists = !!vscode.extensions.getExtension(
43+
const zppExists = !!vscode.extensions.getExtension(
4144
'zero-plusplus.vscode-autohotkey-debug',
4245
);
43-
const interpreterPathKey = isV1()
44-
? ConfigKey.interpreterPathV1
45-
: ConfigKey.interpreterPathV2;
46+
const debugType = zppExists ? 'autohotkey' : isV1() ? 'ahk' : 'ahk2';
4647
vscode.debug.startDebugging(vscode.workspace.getWorkspaceFolder(cwd), {
47-
type: debugPlusExists ? 'autohotkey' : 'ahk',
48+
type: debugType,
4849
request: 'launch',
4950
name: 'AutoHotkey Debugger',
50-
runtime: Global.getConfig<string>(interpreterPathKey),
5151
program: script,
5252
});
5353
}

0 commit comments

Comments
 (0)