Skip to content

Commit

Permalink
Change: #60
Browse files Browse the repository at this point in the history
Change to suppress error dialogs
if runtime supports them
  • Loading branch information
zero-plusplus committed Dec 18, 2022
1 parent 4d93be3 commit 03f248b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Also want to check the development status, check the [commit history](https://gi
* [#257](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/257) Add Exception Breakpoint

### Changed
* [#60](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/60) Change to suppress error dialogs if runtime supports them
* [#225](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/225) Remove escape process of output text in debug directives
* [#238](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/238) Change breakpoint directive to break regardless of output
* [#239](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/239) Raise the supported vscode version from `1.49.0` to `1.63.0` for using the pre-release
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This extension is a debugger adapter for [VSCode](https://code.visualstudio.com/
* Added: [#224](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/224) Add `{callstack.trace}` to the MetaVariable
* Added: [#248](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/248) Add pseudo-variable `${ahk:pinnedFile}` valid only for `program`, `openFileOnExit` and `skipFiles` in launch.json
* Added: [#257](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/257) Add Exception Breakpoint
* Changed: [#60](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/60) Change to suppress error dialogs if runtime supports them
* Changed: [#225](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/225) Remove escape process of output text in debug directives
* Changed: [#238](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/238) Change breakpoint directive to break regardless of output
* Changed: [#239](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/239) Raise the supported vscode version from `1.49.0` to `1.63.0` for using the pre-release
Expand Down
5 changes: 1 addition & 4 deletions demo/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"runtimeArgs": [
"/CP65001",
"/ErrorStdOut=UTF-8",
"/include ${ahk:suppressErrorDialog}"
],
"args": [],
"port": "9002-9010",
Expand All @@ -25,9 +24,7 @@
"useOutputDebug": {
"useTrailingLinebreak": true
},
"skipFiles": [
"${ahk:suppressErrorDialog}"
],
"useExceptionBreakpoint": true,
"useAnnounce": "detail",
"useFunctionBreakpoint": true,
"variableCategories": "recommend"
Expand Down
3 changes: 2 additions & 1 deletion demo/demo.ahk2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#SingleInstance Force
#Warn All, StdOut
#SingleInstance Force
; #Include <Util>
#Include "%A_LineFile%/../lib/Util.ahk"

Expand Down
12 changes: 12 additions & 0 deletions src/ahkDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export class AhkDebugSession extends LoggingDebugSession {
return;
}

await this.trySuppressAutoHotkeyDialog();
const classNameProperty = exception.children.find((child) => equalsIgnoreCase(child.name, '__CLASS'));
const exceptionId = classNameProperty instanceof dbgp.PrimitiveProperty ? classNameProperty.value : '<exception>';
const messageProperty = exception.children.find((child) => equalsIgnoreCase(child.name, 'Message'));
Expand Down Expand Up @@ -966,6 +967,17 @@ export class AhkDebugSession extends LoggingDebugSession {

return Promise.resolve(this.loadedSources);
}
private async trySuppressAutoHotkeyDialog(): Promise<void> {
if (!this.session) {
return;
}

try {
await this.session.sendExceptionSetCommand();
}
catch (e: unknown) {
}
}
private async registerDebugDirective(): Promise<void> {
if (!this.config.useDebugDirective) {
return;
Expand Down
3 changes: 3 additions & 0 deletions src/dbgpSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ export class Session extends EventEmitter {
public async sendPropertySetCommand(property: { context: Context; fullName: string; typeName: PropertyType; data: string }): Promise<PropertySetResponse> {
return new PropertySetResponse(await this.sendCommand('property_set', `-c ${property.context.id} -d ${property.context.stackFrame.level} -n ${property.fullName} -t ${property.typeName}`, property.data));
}
public async sendExceptionSetCommand(): Promise<PropertySetResponse> {
return new PropertySetResponse(await this.sendCommand('property_set', `-n <exception>`, ''));
}
public async sendRunCommand(): Promise<ContinuationResponse> {
return this.sendContinuationCommand('run');
}
Expand Down

0 comments on commit 03f248b

Please sign in to comment.