Skip to content

Commit

Permalink
Fix AHK v2 debug command (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-wiemer authored Feb 22, 2025
1 parent c4e7447 commit 2668a2a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions demos/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"request": "launch",
"name": "AutoHotkey v2 Debugger",
"program": "${file}",
"stopOnEntry": true,
"runtime": "C:\\Program Files\\AutoHotkey\\v2\\AutoHotkey64.exe"
"stopOnEntry": true
},
{
"type": "ahk",
"request": "launch",
"name": "AutoHotkey v1 Debugger",
"program": "${file}",
"stopOnEntry": true,
"runtime": "C:\\Program Files\\AutoHotkey\\v1.1.37.01\\AutoHotkeyU64.exe"
"stopOnEntry": true
}
]
}
2 changes: 1 addition & 1 deletion demos/manualTests/debugger.ahk1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

; Basic debugger test
; Ensure you've run `npm i` before running this test
; 0. Debug button should appear in title bar
; 0. Debug button should appear in title bar--click it!
; 1. Stop on breakpoint
; 2. Step forward works -- Global variables updates
; 3. No errors in Debug Console
Expand Down
2 changes: 1 addition & 1 deletion demos/manualTests/debugger.ahk2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

; Basic debugger test
; Ensure you've run `npm i` before running this test
; 0. Debug button should appear in title bar
; 0. Debug button should appear in title bar--click it!
; 1. Stop on breakpoint
; 2. Step forward works -- Global variables updates
; 3. No errors in Debug Console
Expand Down
14 changes: 7 additions & 7 deletions src/service/runnerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ export const makeCompileCommand = (
return `"${compilerPath}" ${guiCommand} /in "${scriptPath}" /out "${exePath}" ${compileIconCommand} ${compileBaseFileCommand} ${compileMpressCommand}`;
};

/** Debugs and compiles AHK. Run is now located in ahk2 submodule. */
/**
* Debugs and compiles AHK v1 and AHK v2 scripts.
* Running scripts is now located in ahk2 submodule.
*/
export class RunnerService {
/** Start debug session */
public static async startDebugger(script?: string) {
const cwd = script
? vscode.Uri.file(script)
: vscode.window.activeTextEditor.document.uri;
script = script ? script : await this.getPathByActive();
const debugPlusExists = !!vscode.extensions.getExtension(
const zppExists = !!vscode.extensions.getExtension(
'zero-plusplus.vscode-autohotkey-debug',
);
const interpreterPathKey = isV1()
? ConfigKey.interpreterPathV1
: ConfigKey.interpreterPathV2;
const debugType = zppExists ? 'autohotkey' : isV1() ? 'ahk' : 'ahk2';
vscode.debug.startDebugging(vscode.workspace.getWorkspaceFolder(cwd), {
type: debugPlusExists ? 'autohotkey' : 'ahk',
type: debugType,
request: 'launch',
name: 'AutoHotkey Debugger',
runtime: Global.getConfig<string>(interpreterPathKey),
program: script,
});
}
Expand Down

0 comments on commit 2668a2a

Please sign in to comment.