|
|
@ -227,9 +227,7 @@ pub fn dap_start_impl(
|
|
|
|
for (i, x) in params.iter().enumerate() {
|
|
|
|
for (i, x) in params.iter().enumerate() {
|
|
|
|
let mut param = x.to_string();
|
|
|
|
let mut param = x.to_string();
|
|
|
|
if let Some(DebugConfigCompletion::Advanced(cfg)) = template.completion.get(i) {
|
|
|
|
if let Some(DebugConfigCompletion::Advanced(cfg)) = template.completion.get(i) {
|
|
|
|
if cfg.completion == Some("filename".to_owned())
|
|
|
|
if matches!(cfg.completion.as_deref(), Some("filename" | "directory")) {
|
|
|
|
|| cfg.completion == Some("directory".to_owned())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
param = std::fs::canonicalize(x)
|
|
|
|
param = std::fs::canonicalize(x)
|
|
|
|
.ok()
|
|
|
|
.ok()
|
|
|
|
.and_then(|pb| pb.into_os_string().into_string().ok())
|
|
|
|
.and_then(|pb| pb.into_os_string().into_string().ok())
|
|
|
@ -330,27 +328,23 @@ fn debug_parameter_prompt(
|
|
|
|
config_name: String,
|
|
|
|
config_name: String,
|
|
|
|
mut params: Vec<String>,
|
|
|
|
mut params: Vec<String>,
|
|
|
|
) -> Prompt {
|
|
|
|
) -> Prompt {
|
|
|
|
let i = params.len();
|
|
|
|
let completion = completions.get(params.len()).unwrap();
|
|
|
|
let completion = completions.get(i).unwrap();
|
|
|
|
|
|
|
|
let field_type = if let DebugConfigCompletion::Advanced(cfg) = completion {
|
|
|
|
let field_type = if let DebugConfigCompletion::Advanced(cfg) = completion {
|
|
|
|
cfg.completion.clone().unwrap_or_else(|| "".to_owned())
|
|
|
|
cfg.completion.as_deref().unwrap_or("")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
"".to_owned()
|
|
|
|
""
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let name = match completion {
|
|
|
|
let name = match completion {
|
|
|
|
DebugConfigCompletion::Advanced(cfg) => {
|
|
|
|
DebugConfigCompletion::Advanced(cfg) => cfg.name.as_deref().unwrap_or(field_type),
|
|
|
|
cfg.name.clone().unwrap_or_else(|| field_type.to_owned())
|
|
|
|
DebugConfigCompletion::Named(name) => name.as_str(),
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugConfigCompletion::Named(name) => name.clone(),
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let default_val = match completion {
|
|
|
|
let default_val = match completion {
|
|
|
|
DebugConfigCompletion::Advanced(cfg) => {
|
|
|
|
DebugConfigCompletion::Advanced(cfg) => cfg.default.as_deref().unwrap_or(""),
|
|
|
|
cfg.default.clone().unwrap_or_else(|| "".to_owned())
|
|
|
|
_ => "",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => "".to_owned(),
|
|
|
|
.to_owned();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let completer = match &field_type[..] {
|
|
|
|
let completer = match field_type {
|
|
|
|
"filename" => ui::completers::filename,
|
|
|
|
"filename" => ui::completers::filename,
|
|
|
|
"directory" => ui::completers::directory,
|
|
|
|
"directory" => ui::completers::directory,
|
|
|
|
_ => |_input: &str| Vec::new(),
|
|
|
|
_ => |_input: &str| Vec::new(),
|
|
|
|