From 7c62a9d716285d734cadccd4e75e7b365ee5c127 Mon Sep 17 00:00:00 2001 From: Filip Dutescu Date: Tue, 11 Oct 2022 22:18:58 +0300 Subject: [PATCH 1/2] feat(csharp,debug): add C# debugger support Add C# debugger support in the `languages.toml` file. This includes "launch" and "attach" configurations that employ [netcoredbg][netdbg]. In order to make it work with the aforementioned debugger, the `Initialized` DAP event response is changed to include an optional `DebuggerCapabilities` response, as per the specification. [netdbg]: https://github.com/Samsung/netcoredbg Closes: #4212 Signed-off-by: Filip Dutescu --- helix-dap/src/types.rs | 2 +- helix-view/src/handlers/dap.rs | 2 +- languages.toml | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index 45f45cca5cdc..51ecfe1b60de 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -726,7 +726,7 @@ pub mod events { #[serde(tag = "event", content = "body")] // seq is omitted as unused and is not sent by some implementations pub enum Event { - Initialized, + Initialized(Option), Stopped(Stopped), Continued(Continued), Exited(Exited), diff --git a/helix-view/src/handlers/dap.rs b/helix-view/src/handlers/dap.rs index e39584c3fb0f..2e86871b5fae 100644 --- a/helix-view/src/handlers/dap.rs +++ b/helix-view/src/handlers/dap.rs @@ -262,7 +262,7 @@ impl Editor { log::info!("{}", output); self.set_status(format!("{} {}", prefix, output)); } - Event::Initialized => { + Event::Initialized(_) => { // send existing breakpoints for (path, breakpoints) in &mut self.breakpoints { // TODO: call futures in parallel, await all diff --git a/languages.toml b/languages.toml index 08645af8c273..6315be6a7c56 100644 --- a/languages.toml +++ b/languages.toml @@ -233,6 +233,25 @@ comment-token = "//" indent = { tab-width = 4, unit = "\t" } language-server = { command = "OmniSharp", args = [ "--languageserver" ] } +[language.debugger] +name = "netcoredbg" +transport = "tcp" +command = "netcoredbg" +args = [ "--interpreter=vscode" ] +port-arg = "--server={}" + +[[language.debugger.templates]] +name = "launch" +request = "launch" +completion = [ { name = "path to dll", completion = "filename" } ] +args = { type="coreclr", console = "internalConsole", internalConsoleOptions = "openOnSessionStart", program = "{0}" } + +[[language.debugger.templates]] +name = "attach" +request = "attach" +completion = [ "pid" ] +args = { processId = "{0}" } + [[grammar]] name = "c-sharp" source = { git = "https://github.com/tree-sitter/tree-sitter-c-sharp", rev = "5b60f99545fea00a33bbfae5be956f684c4c69e2" } From ae90724ec7bbb033f4c913076491e8d93bd9032e Mon Sep 17 00:00:00 2001 From: Filip Dutescu Date: Wed, 12 Oct 2022 10:38:54 +0300 Subject: [PATCH 2/2] chore: address review comments Signed-off-by: Filip Dutescu --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 6315be6a7c56..8d058e31ea09 100644 --- a/languages.toml +++ b/languages.toml @@ -244,7 +244,7 @@ port-arg = "--server={}" name = "launch" request = "launch" completion = [ { name = "path to dll", completion = "filename" } ] -args = { type="coreclr", console = "internalConsole", internalConsoleOptions = "openOnSessionStart", program = "{0}" } +args = { type = "coreclr", console = "internalConsole", internalConsoleOptions = "openOnSessionStart", program = "{0}" } [[language.debugger.templates]] name = "attach"