Skip to content

Commit

Permalink
Merge branch '#236' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-plusplus committed Jul 15, 2022
2 parents 4952b78 + a74e318 commit 5c669a7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 48 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Also want to check the development status, check the [commit history](https://gi
* [#229](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/229) Raw error message on Critical Error
* [#232](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/232) Output of members in bracketed notation in Output directive, Watch expression, etc. may not be evaluated correctly
* [#234](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/234) Breakpoint do not work when `runtime` is a UNC path (e.g. `//server/folder`)
* [#236](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/236) Debugging gets stuck if the last line of the included script is a debug directive

## [1.11.0] - 2022-02-11
### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This extension is a debugger adapter for [VSCode](https://code.visualstudio.com/
* Fixed: [#229](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/229) Raw error message on Critical Error
* Fixed: [#232](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/232) Output of members in bracketed notation in Output directive, Watch expression, etc. may not be evaluated correctly
* Fixed: [#234](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/234) Breakpoint do not work when `runtime` is a UNC path (e.g. `//server/folder`)
* Fixed: [#236](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/236) Debugging gets stuck if the last line of the included script is a debug directive

* `1.11.0` - 2022-02-11
* Added: [#201](https://github.com/zero-plusplus/vscode-autohotkey-debug/issues/201) Add `useLoadedScripts` to launch.json
Expand Down
103 changes: 55 additions & 48 deletions src/ahkDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ export class AhkDebugSession extends LoggingDebugSession {
for await (const filePathList of filePathListChunked) {
await Promise.all(filePathList.map(async(filePath) => {
const document = await vscode.workspace.openTextDocument(filePath);
const fileUri = URI.file(filePath).toString();
const fileUri = toFileUri(filePath);

await Promise.all(range(document.lineCount).map(async(line_0base) => {
const textLine = document.lineAt(line_0base);
Expand All @@ -882,57 +882,64 @@ export class AhkDebugSession extends LoggingDebugSession {
logMessage += '\n';
}

const line = line_0base + 1;
if (useBreakpointDirective && directiveType === 'breakpoint') {
if (0 < params.length) {
return;
}

const advancedData = {
condition,
hitCondition,
logMessage,
hidden: true,
} as BreakpointAdvancedData;
await this.breakpointManager!.registerBreakpoint(fileUri, line, advancedData);
}
else if (useOutputDirective && directiveType === 'output') {
let logGroup: string | undefined;
if (0 < params.length) {
if (equalsIgnoreCase(params[0], 'start')) {
logGroup = 'start';
}
else if (equalsIgnoreCase(params[0], 'startCollapsed')) {
logGroup = 'startCollapsed';
try {
const line = line_0base + 1;
if (useBreakpointDirective && directiveType === 'breakpoint') {
if (0 < params.length) {
return;
}
else if (equalsIgnoreCase(params[0], 'end')) {
logGroup = 'end';

const advancedData = {
condition,
hitCondition,
logMessage,
hidden: true,
} as BreakpointAdvancedData;
await this.breakpointManager!.registerBreakpoint(fileUri, line, advancedData);
}
else if (useOutputDirective && directiveType === 'output') {
let logGroup: string | undefined;
if (0 < params.length) {
if (equalsIgnoreCase(params[0], 'start')) {
logGroup = 'start';
}
else if (equalsIgnoreCase(params[0], 'startCollapsed')) {
logGroup = 'startCollapsed';
}
else if (equalsIgnoreCase(params[0], 'end')) {
logGroup = 'end';
}
}
const newCondition = condition;
const advancedData = {
condition: newCondition,
hitCondition,
logMessage,
logGroup,
hidden: true,
} as BreakpointAdvancedData;
await this.breakpointManager!.registerBreakpoint(fileUri, line, advancedData);
}
else if (useClearConsoleDirective && directiveType === 'clearconsole') {
const advancedData = {
condition,
hitCondition,
logMessage,
hidden: true,
action: async() => {
// There is a lag between the execution of a command and the console being cleared. This lag can be eliminated by executing the command multiple times.
await vscode.commands.executeCommand('workbench.debug.panel.action.clearReplAction');
await vscode.commands.executeCommand('workbench.debug.panel.action.clearReplAction');
await vscode.commands.executeCommand('workbench.debug.panel.action.clearReplAction');
},
} as BreakpointAdvancedData;
await this.breakpointManager!.registerBreakpoint(fileUri, line, advancedData);
}
const newCondition = condition;
const advancedData = {
condition: newCondition,
hitCondition,
logMessage,
logGroup,
hidden: true,
} as BreakpointAdvancedData;
await this.breakpointManager!.registerBreakpoint(fileUri, line, advancedData);
}
else if (useClearConsoleDirective && directiveType === 'clearconsole') {
const advancedData = {
condition,
hitCondition,
logMessage,
hidden: true,
action: async() => {
// There is a lag between the execution of a command and the console being cleared. This lag can be eliminated by executing the command multiple times.
await vscode.commands.executeCommand('workbench.debug.panel.action.clearReplAction');
await vscode.commands.executeCommand('workbench.debug.panel.action.clearReplAction');
await vscode.commands.executeCommand('workbench.debug.panel.action.clearReplAction');
},
} as BreakpointAdvancedData;
await this.breakpointManager!.registerBreakpoint(fileUri, line, advancedData);
catch (e: unknown) {
if (e instanceof Error) {
console.log(e.message);
}
}
}));
}));
Expand Down

0 comments on commit 5c669a7

Please sign in to comment.