on master help sign in
editor: go to pos where stack pointer is located
commit132198323ca8af409ecac56e14f8029c9d252621 authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateSun 22 Aug 2021, 11:56 (5 years ago) parentbe9dc58
2 files changed+20−4
helix-term/src/application.rs+18−2 helix-term/src/commands.rs+2−2
helix-term/src/application.rs+18−2
@@ -1,9 +1,16 @@
1−use helix_core::syntax;
1+use helix_core::{syntax, Selection};
22use helix_dap::Payload;
33use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
44use helix_view::{theme, Editor};
55
6−use crate::{args::Args, compositor::Compositor, config::Config, job::Jobs, ui};
6+use crate::{
7+ args::Args,
8+ commands::{align_view, Align},
9+ compositor::Compositor,
10+ config::Config,
11+ job::Jobs,
12+ ui,
13+};
714
815use log::error;
916
@@ -300,13 +307,22 @@ impl Application {
300307 Some(helix_dap::Source {
301308 path: Some(src), ..
302309 }),
310+ line,
311+ column,
303312 ..
304313 }) = &debugger.stack_pointer
305314 {
306315 let path = src.clone();
316+ let line = *line;
317+ let column = *column;
307318 self.editor
308319 .open(path, helix_view::editor::Action::Replace)
309320 .unwrap();
321+
322+ let (view, doc) = current!(self.editor);
323+ let pos = doc.text().line_to_char(line - 1) + column;
324+ doc.set_selection(view.id, Selection::point(pos));
325+ align_view(doc, view, Align::Center);
310326 }
311327 self.editor.set_status(status);
312328 }
helix-term/src/commands.rs+2−2
@@ -98,13 +98,13 @@ impl<'a> Context<'a> {
9898 }
9999}
100100
101−enum Align {
101+pub enum Align {
102102 Top,
103103 Center,
104104 Bottom,
105105}
106106
107−fn align_view(doc: &Document, view: &mut View, align: Align) {
107+pub fn align_view(doc: &Document, view: &mut View, align: Align) {
108108 let pos = doc
109109 .selection(view.id)
110110 .primary()