Support attach request

imgbot
Dmitry Sharshakov 3 years ago
parent b001008a69
commit 299da5a35b
No known key found for this signature in database
GPG Key ID: 471FD32E15FD8473

@ -24,6 +24,7 @@ use helix_lsp::{
}; };
use insert::*; use insert::*;
use movement::Movement; use movement::Movement;
use serde_json::Value;
use crate::{ use crate::{
compositor::{self, Component, Compositor}, compositor::{self, Component, Compositor},
@ -4454,7 +4455,7 @@ fn dap_start_impl(editor: &mut Editor, name: Option<&str>, params: Option<Vec<&s
}; };
let template = start_config.args.clone(); let template = start_config.args.clone();
let mut args = HashMap::new(); let mut args: HashMap<String, Value> = HashMap::new();
if let Some(params) = params { if let Some(params) = params {
for (k, t) in template { for (k, t) in template {
@ -4464,7 +4465,11 @@ fn dap_start_impl(editor: &mut Editor, name: Option<&str>, params: Option<Vec<&s
value = value.replace(format!("{{{}}}", i).as_str(), x); value = value.replace(format!("{{{}}}", i).as_str(), x);
} }
args.insert(k, value); if let Ok(integer) = value.parse::<usize>() {
args.insert(k, Value::Number(serde_json::Number::from(integer)));
} else {
args.insert(k, Value::String(value));
}
} }
} }

@ -32,6 +32,11 @@ name = "binary"
request = "launch" request = "launch"
args = { console = "internalConsole", program = "{0}" } args = { console = "internalConsole", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
args = { console = "internalConsole", pid = "{0}" }
[[language]] [[language]]
name = "toml" name = "toml"
scope = "source.toml" scope = "source.toml"
@ -94,6 +99,11 @@ name = "binary"
request = "launch" request = "launch"
args = { console = "internalConsole", program = "main" } args = { console = "internalConsole", program = "main" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
args = { console = "internalConsole", pid = "{0}" }
[[language]] [[language]]
name = "cpp" name = "cpp"
scope = "source.cpp" scope = "source.cpp"
@ -117,6 +127,11 @@ name = "binary"
request = "launch" request = "launch"
args = { console = "internalConsole", program = "main" } args = { console = "internalConsole", program = "main" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
args = { console = "internalConsole", pid = "{0}" }
[[language]] [[language]]
name = "go" name = "go"
scope = "source.go" scope = "source.go"
@ -152,6 +167,11 @@ name = "test"
request = "launch" request = "launch"
args = { mode = "test", program = "{0}" } args = { mode = "test", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
args = { mode = "local", processId = "{0}" }
[[language]] [[language]]
name = "javascript" name = "javascript"
scope = "source.js" scope = "source.js"

Loading…
Cancel
Save