@@ -1924,42 +1924,30 @@ mod cmd {
19241924 Ok(())
19251925 }
19261926
1927− fn debug_breakpoint_condition(
1927+ fn impl_edit_breakpoint(
19281928 cx: &mut compositor::Context,
1929− args: &[&str],
1930− _event: PromptEvent,
1931− ) -> anyhow::Result<()> {
1929+ condition: Option<String>,
1930+ log_message: Option<String>,
1931+ ) {
19321932 use helix_lsp::block_on;
19331933
1934− let condition = args.join(" ");
1935− let condition = if condition.is_empty() {
1936− None
1937− } else {
1938− Some(condition)
1939− };
1940−
19411934 let (view, doc) = current!(cx.editor);
19421935 let text = doc.text().slice(..);
19431936 let pos = doc.selection(view.id).primary().cursor(text);
1944−
19451937 let breakpoint = helix_dap::SourceBreakpoint {
19461938 line: text.char_to_line(pos) + 1, // convert from 0-indexing to 1-indexing (TODO: could set debugger to 0-indexing on init)
19471939 condition,
1940+ log_message,
19481941 ..Default::default()
19491942 };
1950−
19511943 let path = match doc.path() {
19521944 Some(path) => path.to_path_buf(),
19531945 None => {
19541946 cx.editor
19551947 .set_error("Can't edit breakpoint: document has no path".to_string());
1956− return Ok(());
1948+ return;
19571949 }
19581950 };
1959−
1960− // TODO: need to map breakpoints over edits and update them?
1961− // we shouldn't really allow editing while debug is running though
1962−
19631951 if let Some(debugger) = &mut cx.editor.debugger {
19641952 let breakpoints = debugger.breakpoints.entry(path.clone()).or_default();
19651953 if let Some(pos) = breakpoints.iter().position(|b| b.line == breakpoint.line) {
@@ -1972,6 +1960,37 @@ mod cmd {
19721960 let _ = block_on(request).unwrap();
19731961 }
19741962 }
1963+ }
1964+
1965+ fn debug_breakpoint_condition(
1966+ cx: &mut compositor::Context,
1967+ args: &[&str],
1968+ _event: PromptEvent,
1969+ ) -> anyhow::Result<()> {
1970+ let condition = args.join(" ");
1971+ let condition = if condition.is_empty() {
1972+ None
1973+ } else {
1974+ Some(condition)
1975+ };
1976+
1977+ impl_edit_breakpoint(cx, condition, None);
1978+ Ok(())
1979+ }
1980+
1981+ fn debug_set_logpoint(
1982+ cx: &mut compositor::Context,
1983+ args: &[&str],
1984+ _event: PromptEvent,
1985+ ) -> anyhow::Result<()> {
1986+ let log_message = args.join(" ");
1987+ let log_message = if log_message.is_empty() {
1988+ None
1989+ } else {
1990+ Some(log_message)
1991+ };
1992+
1993+ impl_edit_breakpoint(cx, None, log_message);
19751994 Ok(())
19761995 }
19771996
@@ -2227,6 +2246,13 @@ mod cmd {
22272246 doc: "Set current breakpoint condition.",
22282247 fun: debug_breakpoint_condition,
22292248 completer: None,
2249+ },
2250+ TypableCommand {
2251+ name: "debug-set-logpoint",
2252+ alias: None,
2253+ doc: "Make current breakpoint a log point.",
2254+ fun: debug_set_logpoint,
2255+ completer: None,
22302256 }
22312257 ];
22322258