diff --git a/docs/dap/DAP.md b/docs/dap/DAP.md index ff7b8cb04..aede8e4bf 100644 --- a/docs/dap/DAP.md +++ b/docs/dap/DAP.md @@ -26,9 +26,38 @@ To configure debugging with DAP, you need to fill in: ![DAP Configuration Type/Server](./images/DAP_config_type_server.png) +## Evaluate expression + +Evaluate expression is available by consuming the [Evaluate request](https://microsoft.github.io/debug-adapter-protocol//specification.html#Requests_Evaluate) + +![Evaluate expression](./images/DAP_debugging_evaluate.png) + +### Completion + +If debug adapter [supports the `completions` request](https://microsoft.github.io/debug-adapter-protocol//specification.html#Types_Capabilities), +completion should be available in the expression editor by consuming the +[Completion request](https://microsoft.github.io/debug-adapter-protocol//specification.html#Requests_Completions): + +![Completion](images/DAP_debugging_completion.png) + +## Set value + +If debug adapter [supports setting a variable to a value](https://microsoft.github.io/debug-adapter-protocol//specification.html#Types_Capabilities), +the `Set Value...` contextual menu should be available: + +![Set Value/Menu](images/DAP_debugging_setValue_menu.png) + +You should edit the variable: + +![Set Value/Edit](images/DAP_debugging_setValue_edit.png) + +the edit apply will consume the +[SetVariable request](https://microsoft.github.io/debug-adapter-protocol//specification.html#Requests_SetVariable): + ## Templates -- [Go Delv DAP server](./user-defined-dap/go-delve.md) -- [Swift DAP Server](./user-defined-dap/swift-lldb.md) -- [VSCode JS Debug DAP Server](./user-defined-dap/vscode-js-debug.md) +LSP4IJ provides DAP templates that allow to initialize a given DAP server very quickly: +- [Go Delve DAP server](./user-defined-dap/go-delve.md) which allows you to debug `Go` files. +- [Swift DAP Server](./user-defined-dap/swift-lldb.md) which allows you to debug `Swift` files. +- [VSCode JS Debug DAP Server](./user-defined-dap/vscode-js-debug.md) which allows you to debug `JavaScript/TypeScript` files. \ No newline at end of file diff --git a/docs/dap/images/DAP_debugging_completion.png b/docs/dap/images/DAP_debugging_completion.png new file mode 100644 index 000000000..8b2539831 Binary files /dev/null and b/docs/dap/images/DAP_debugging_completion.png differ diff --git a/docs/dap/images/DAP_debugging_evaluate.png b/docs/dap/images/DAP_debugging_evaluate.png new file mode 100644 index 000000000..ee45fb864 Binary files /dev/null and b/docs/dap/images/DAP_debugging_evaluate.png differ diff --git a/docs/dap/images/DAP_debugging_setValue_edit.png b/docs/dap/images/DAP_debugging_setValue_edit.png new file mode 100644 index 000000000..b1c6b797b Binary files /dev/null and b/docs/dap/images/DAP_debugging_setValue_edit.png differ diff --git a/docs/dap/images/DAP_debugging_setValue_menu.png b/docs/dap/images/DAP_debugging_setValue_menu.png new file mode 100644 index 000000000..87bb5cfc7 Binary files /dev/null and b/docs/dap/images/DAP_debugging_setValue_menu.png differ diff --git a/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPClient.java b/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPClient.java index b6b20e77b..fa1535d9e 100644 --- a/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPClient.java +++ b/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPClient.java @@ -469,14 +469,36 @@ public CompletableFuture setVariable(String name, // Capabilities + /** + * Returns true if the debug adapter supports the 'terminate' request and false otherwise. + * + * @return true if the debug adapter supports the 'terminate' request and false otherwise. + */ public boolean isSupportsTerminateRequest() { + var capabilities = getCapabilities(); return capabilities != null && Boolean.TRUE.equals(capabilities.getSupportsTerminateRequest()); } + /** + * Returns true if the debug adapter supports the 'completions' request and false otherwise. + * + * @return true if the debug adapter supports the 'completions' request and false otherwise. + */ public boolean isSupportsCompletionsRequest() { + var capabilities = getCapabilities(); return capabilities != null && Boolean.TRUE.equals(capabilities.getSupportsCompletionsRequest()); } + /** + * Returns true if the debug adapter supports setting a variable to a value and false otherwise. + * + * @return true if the debug adapter supports setting a variable to a value and false otherwise. + */ + public boolean isSupportsSetVariable() { + var capabilities = getCapabilities(); + return capabilities != null && Boolean.TRUE.equals(capabilities.getSupportsSetVariable()); + } + @NotNull public DebugAdapterDescriptor getServerDescriptor() { return debugProcess.getServerDescriptor(); diff --git a/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPValue.java b/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPValue.java index caa245a76..8723096ec 100644 --- a/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPValue.java +++ b/src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPValue.java @@ -74,6 +74,10 @@ public void computeChildren(@NotNull XCompositeNode node) { @Nullable @Override public XValueModifier getModifier() { + if (!client.isSupportsSetVariable()) { + // The DAP server doesn't support the setting variable, Disable the 'Set Value...' menu. + return null; + } return new DAPValueModifier(this); }