aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorDmitry Sharshakov2021-09-26 18:36:06 +0000
committerDmitry Sharshakov2021-09-26 18:36:06 +0000
commitd943a51e3e8e2cd77cc336c30eb954378e81fe31 (patch)
tree6a6cc9d6bc58669045806bf04fbe77b18aa58527 /helix-term
parent0e51e5fbaf6eeffa25b8660b96f2486174671492 (diff)
editor: add Node.js debugger
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands/dap.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index 65a0d33f..3f925490 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -5,7 +5,7 @@ use crate::{
job::Callback,
ui::{FilePicker, Prompt, PromptEvent},
};
-use helix_core::Selection;
+use helix_core::{syntax::DebugConfigCompletion, Selection};
use helix_dap::{self as dap, Client};
use helix_lsp::block_on;
@@ -206,6 +206,8 @@ pub fn dap_start_impl(
return;
}
+ debugger.quirks = config.quirks;
+
let start_config = match name {
Some(name) => config.templates.iter().find(|t| t.name == name),
None => config.templates.get(0),
@@ -225,8 +227,18 @@ pub fn dap_start_impl(
for (k, t) in template {
let mut value = t;
for (i, x) in params.iter().enumerate() {
+ let mut param = x.to_string();
+ if let Some(DebugConfigCompletion::Advanced(cfg)) = start_config.completion.get(i) {
+ if cfg.completion == Some("filename".to_owned())
+ || cfg.completion == Some("directory".to_owned())
+ {
+ param = std::fs::canonicalize(x).ok()
+ .and_then(|pb| pb.into_os_string().into_string().ok())
+ .unwrap_or(x.to_string());
+ }
+ }
// For param #0 replace {0} in args
- value = value.replace(format!("{{{}}}", i).as_str(), x);
+ value = value.replace(format!("{{{}}}", i).as_str(), &param);
}
if let Ok(integer) = value.parse::<usize>() {