Skip to content

Commit 9c2951a

Browse files
authored
Add support for debugging REST services (#1043)
1 parent 9399783 commit 9c2951a

File tree

9 files changed

+616
-7
lines changed

9 files changed

+616
-7
lines changed

docs/RunDebug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ This extension uses WebSockets to communicate with the InterSystems server durin
114114

115115
Debugging commands and items on the **Run** menu function much as they do for other languages supported by VS Code. For information on VS Code debugging, see the documentation resources listed at the start of this section.
116116

117+
{: #rest}
118+
## Debugging a REST Service
119+
120+
The InterSystems ObjectScript Extension provides a [Webview](https://code.visualstudio.com/api/extension-guides/webview)-based graphical user interface that allows you to send a REST request and automatically start debugging the process on the server that handles it. With the InterSystems file that you want to debug open in the active text editor, you can show the GUI using the `Debug REST Service...` command. The command can be accessed in the command palette, editor context menu or editor tab context menu. Follow the directions in the GUI to build your REST request and click the `Start Debugging` button to send the request and connect the debugger. Be sure you have a breakpoint set somewhere in the code that handles the request.
121+
117122
## Troubleshooting Debugger Issues
118123

119124
If you are experiencing issues using the debugger, please follow these steps before opening an issue on GitHub:

package.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@
323323
{
324324
"command": "vscode-objectscript.importLocalFilesServerSide",
325325
"when": "false"
326+
},
327+
{
328+
"command": "vscode-objectscript.showRESTDebugWebview",
329+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
326330
}
327331
],
328332
"view/title": [
@@ -489,6 +493,11 @@
489493
"command": "vscode-objectscript.exportCurrentFile",
490494
"when": "resourceScheme == objectscript && vscode-objectscript.connectActive",
491495
"group": "objectscript@8"
496+
},
497+
{
498+
"command": "vscode-objectscript.showRESTDebugWebview",
499+
"when": "editorLangId =~ /^objectscript/ && vscode-objectscript.connectActive",
500+
"group": "objectscript@9"
492501
}
493502
],
494503
"editor/title": [
@@ -513,6 +522,11 @@
513522
"command": "vscode-objectscript.showClassDocumentationPreview",
514523
"group": "1_open",
515524
"when": "resourceLangId == objectscript-class"
525+
},
526+
{
527+
"command": "vscode-objectscript.showRESTDebugWebview",
528+
"group": "1_open",
529+
"when": "resourceLangId =~ /^objectscript/ && vscode-objectscript.connectActive"
516530
}
517531
],
518532
"touchBar": [
@@ -1064,6 +1078,11 @@
10641078
"category": "ObjectScript",
10651079
"command": "vscode-objectscript.importLocalFilesServerSide",
10661080
"title": "Import Local Files..."
1081+
},
1082+
{
1083+
"category": "ObjectScript",
1084+
"command": "vscode-objectscript.showRESTDebugWebview",
1085+
"title": "Debug REST Service..."
10671086
}
10681087
],
10691088
"keybindings": [
@@ -1484,13 +1503,20 @@
14841503
"number",
14851504
"string"
14861505
],
1487-
"description": "ID of process to attach to.",
1506+
"description": "ID of the process to attach to.",
14881507
"default": "${command:PickProcess}"
14891508
},
14901509
"system": {
14911510
"type": "boolean",
1492-
"description": "Enable to attach to system process.",
1511+
"description": "Enable attaching to system processes.",
14931512
"default": false
1513+
},
1514+
"cspDebugId": {
1515+
"type": [
1516+
"number",
1517+
"string"
1518+
],
1519+
"description": "The CSP debug ID to use to identify the target process. If provided, 'processId' is ignored."
14941520
}
14951521
}
14961522
}

src/api/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,4 +715,9 @@ export class AtelierAPI {
715715
public async getEnsClassList(type: number): Promise<Atelier.Response> {
716716
return this.request(1, "GET", `${this.ns}/ens/classes/${type}`);
717717
}
718+
719+
// v2+
720+
public async getCSPDebugId(): Promise<Atelier.Response<Atelier.Content<number>>> {
721+
return this.request(2, "GET", "%SYS/cspdebugid");
722+
}
718723
}

0 commit comments

Comments
 (0)