on master help sign in
Support attach request
299da5aDmitry Sharshakov
helix-term/src/commands.rs+7−2
@@ -24,6 +24,7 @@ use helix_lsp::{
24};
24};
25use insert::*;
25use insert::*;
26use movement::Movement;
26use movement::Movement;
27+use serde_json::Value;
27
28
28use crate::{
29use crate::{
29 compositor::{self, Component, Compositor},
30 compositor::{self, Component, Compositor},
@@ -4454,7 +4455,7 @@ fn dap_start_impl(editor: &mut Editor, name: Option<&str>, params: Option<Vec<&s
4454 };
4455 };
4455
4456
4456 let template = start_config.args.clone();
4457 let template = start_config.args.clone();
4457− let mut args = HashMap::new();
4458+ let mut args: HashMap<String, Value> = HashMap::new();
4458
4459
4459 if let Some(params) = params {
4460 if let Some(params) = params {
4460 for (k, t) in template {
4461 for (k, t) in template {
@@ -4464,7 +4465,11 @@ fn dap_start_impl(editor: &mut Editor, name: Option<&str>, params: Option<Vec<&s
4464 value = value.replace(format!("{{{}}}", i).as_str(), x);
4465 value = value.replace(format!("{{{}}}", i).as_str(), x);
4465 }
4466 }
4466
4467
4468+ if let Ok(integer) = value.parse::<usize>() {
4469+ args.insert(k, Value::Number(serde_json::Number::from(integer)));
4470+ } else {
4467− args.insert(k, value);
4471+ args.insert(k, Value::String(value));
4472+ }
4468 }
4473 }
4469 }
4474 }
4470
4475
languages.toml+20
@@ -32,6 +32,11 @@ name = "binary"
32request = "launch"
32request = "launch"
33args = { console = "internalConsole", program = "{0}" }
33args = { console = "internalConsole", program = "{0}" }
34
34
35+[[language.debugger.templates]]
36+name = "attach"
37+request = "attach"
38+args = { console = "internalConsole", pid = "{0}" }
39+
35[[language]]
40[[language]]
36name = "toml"
41name = "toml"
37scope = "source.toml"
42scope = "source.toml"
@@ -94,6 +99,11 @@ name = "binary"
94request = "launch"
99request = "launch"
95args = { console = "internalConsole", program = "main" }
100args = { console = "internalConsole", program = "main" }
96
101
102+[[language.debugger.templates]]
103+name = "attach"
104+request = "attach"
105+args = { console = "internalConsole", pid = "{0}" }
106+
97[[language]]
107[[language]]
98name = "cpp"
108name = "cpp"
99scope = "source.cpp"
109scope = "source.cpp"
@@ -117,6 +127,11 @@ name = "binary"
117request = "launch"
127request = "launch"
118args = { console = "internalConsole", program = "main" }
128args = { console = "internalConsole", program = "main" }
119
129
130+[[language.debugger.templates]]
131+name = "attach"
132+request = "attach"
133+args = { console = "internalConsole", pid = "{0}" }
134+
120[[language]]
135[[language]]
121name = "go"
136name = "go"
122scope = "source.go"
137scope = "source.go"
@@ -152,6 +167,11 @@ name = "test"
152request = "launch"
167request = "launch"
153args = { mode = "test", program = "{0}" }
168args = { mode = "test", program = "{0}" }
154
169
170+[[language.debugger.templates]]
171+name = "attach"
172+request = "attach"
173+args = { mode = "local", processId = "{0}" }
174+
155[[language]]
175[[language]]
156name = "javascript"
176name = "javascript"
157scope = "source.js"
177scope = "source.js"