Improve workflow step view (#16329)
* Improve the tab title: give it an icon, and indicate the step index. * Display the line number ranges that the symbols resolve to. * Don't open duplicate tabs for the same step Release Notes: - N/A
This commit is contained in:
parent
364a58a262
commit
09b6e3f2a6
3 changed files with 63 additions and 25 deletions
|
@ -2407,7 +2407,7 @@ impl ContextEditor {
|
|||
let Some(step) = self
|
||||
.context
|
||||
.read(cx)
|
||||
.workflow_step_for_range(step_range.clone())
|
||||
.workflow_step_for_range(step_range.clone(), cx)
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
@ -2630,13 +2630,22 @@ impl ContextEditor {
|
|||
.ok()??;
|
||||
let context = self.context.read(cx);
|
||||
let language_registry = context.language_registry();
|
||||
let step = context.workflow_step_for_range(step_range)?;
|
||||
let view = cx.new_view(|cx| {
|
||||
WorkflowStepView::new(self.context.clone(), step, language_registry, cx)
|
||||
});
|
||||
let step = context.workflow_step_for_range(step_range, cx)?;
|
||||
let context = self.context.clone();
|
||||
cx.deref_mut().defer(move |cx| {
|
||||
pane.update(cx, |pane, cx| {
|
||||
pane.add_item(Box::new(view), true, true, None, cx);
|
||||
let existing_item = pane
|
||||
.items_of_type::<WorkflowStepView>()
|
||||
.find(|item| *item.read(cx).step() == step.downgrade());
|
||||
if let Some(item) = existing_item {
|
||||
if let Some(index) = pane.index_for_item(&item) {
|
||||
pane.activate_item(index, true, true, cx);
|
||||
}
|
||||
} else {
|
||||
let view = cx
|
||||
.new_view(|cx| WorkflowStepView::new(context, step, language_registry, cx));
|
||||
pane.add_item(Box::new(view), true, true, None, cx);
|
||||
}
|
||||
});
|
||||
});
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue