on master help sign in
Drop old commands
7bdead5Dmitry Sharshakov
helix-term/src/commands.rs+2−102
@@ -1998,62 +1998,6 @@ mod cmd {
1998 i.map(|i| (i, breakpoints.get(i).unwrap().clone()))
1998 i.map(|i| (i, breakpoints.get(i).unwrap().clone()))
1999 }
1999 }
2000
2000
2001− fn edit_breakpoint_impl(
2002− cx: &mut compositor::Context,
2003− condition: Option<String>,
2004− log_message: Option<String>,
2005− ) -> anyhow::Result<()> {
2006− use helix_lsp::block_on;
2007−
2008− let (_, doc) = current!(cx.editor);
2009− let path = match doc.path() {
2010− Some(path) => path.to_path_buf(),
2011− None => {
2012− bail!("Can't edit breakpoint: document has no path")
2013− }
2014− };
2015−
2016− if let Some((pos, mut bp)) = get_breakpoint_at_current_line(cx.editor) {
2017− let breakpoints = cx.editor.breakpoints.entry(path.clone()).or_default();
2018− breakpoints.remove(pos);
2019−
2020− bp.condition = condition;
2021− bp.log_message = log_message;
2022− breakpoints.push(bp);
2023−
2024− if let Some(debugger) = &mut cx.editor.debugger {
2025− // TODO: handle capabilities correctly again, by filterin breakpoints when emitting
2026− // if breakpoint.condition.is_some()
2027− // && !debugger
2028− // .caps
2029− // .as_ref()
2030− // .unwrap()
2031− // .supports_conditional_breakpoints
2032− // .unwrap_or_default()
2033− // {
2034− // bail!(
2035− // "Can't edit breakpoint: debugger does not support conditional breakpoints"
2036− // )
2037− // }
2038− // if breakpoint.log_message.is_some()
2039− // && !debugger
2040− // .caps
2041− // .as_ref()
2042− // .unwrap()
2043− // .supports_log_points
2044− // .unwrap_or_default()
2045− // {
2046− // bail!("Can't edit breakpoint: debugger does not support logpoints")
2047− // }
2048− let request = debugger.set_breakpoints(path, breakpoints.clone());
2049− if let Err(e) = block_on(request) {
2050− bail!("Failed to set breakpoints: {:?}", e)
2051− }
2052− }
2053− }
2054− Ok(())
2055− }
2056−
2057 fn debug_start(
2001 fn debug_start(
2058 cx: &mut compositor::Context,
2002 cx: &mut compositor::Context,
2059 args: &[&str],
2003 args: &[&str],
@@ -2087,36 +2031,6 @@ mod cmd {
2087 Ok(())
2031 Ok(())
2088 }
2032 }
2089
2033
2090− fn debug_breakpoint_condition(
2091− cx: &mut compositor::Context,
2092− args: &[&str],
2093− _event: PromptEvent,
2094− ) -> anyhow::Result<()> {
2095− let condition = args.join(" ");
2096− let condition = if condition.is_empty() {
2097− None
2098− } else {
2099− Some(condition)
2100− };
2101−
2102− edit_breakpoint_impl(cx, condition, None)
2103− }
2104−
2105− fn debug_set_logpoint(
2106− cx: &mut compositor::Context,
2107− args: &[&str],
2108− _event: PromptEvent,
2109− ) -> anyhow::Result<()> {
2110− let log_message = args.join(" ");
2111− let log_message = if log_message.is_empty() {
2112− None
2113− } else {
2114− Some(log_message)
2115− };
2116−
2117− edit_breakpoint_impl(cx, None, log_message)
2118− }
2119−
2120 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2034 pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2121 TypableCommand {
2035 TypableCommand {
2122 name: "quit",
2036 name: "quit",
@@ -2361,14 +2275,14 @@ mod cmd {
2361 alias: Some("dbg"),
2275 alias: Some("dbg"),
2362 doc: "Start a debug session from a given template with given parameters.",
2276 doc: "Start a debug session from a given template with given parameters.",
2363 fun: debug_start,
2277 fun: debug_start,
2364− completer: Some(completers::filename),
2278+ completer: None,
2365 },
2279 },
2366 TypableCommand {
2280 TypableCommand {
2367 name: "debug-remote",
2281 name: "debug-remote",
2368 alias: Some("dbg-tcp"),
2282 alias: Some("dbg-tcp"),
2369 doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.",
2283 doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.",
2370 fun: debug_remote,
2284 fun: debug_remote,
2371− completer: Some(completers::filename),
2285+ completer: None,
2372 },
2286 },
2373 TypableCommand {
2287 TypableCommand {
2374 name: "debug-eval",
2288 name: "debug-eval",
@@ -2377,20 +2291,6 @@ mod cmd {
2377 fun: debug_eval,
2291 fun: debug_eval,
2378 completer: None,
2292 completer: None,
2379 },
2293 },
2380− TypableCommand {
2381− name: "debug-breakpoint-condition",
2382− alias: None,
2383− doc: "Set current breakpoint condition.",
2384− fun: debug_breakpoint_condition,
2385− completer: None,
2386− },
2387− TypableCommand {
2388− name: "debug-set-logpoint",
2389− alias: None,
2390− doc: "Make current breakpoint a log point.",
2391− fun: debug_set_logpoint,
2392− completer: None,
2393− },
2394 TypableCommand {
2294 TypableCommand {
2395 name: "vsplit",
2295 name: "vsplit",
2396 alias: Some("vs"),
2296 alias: Some("vs"),