Merge branch 'main' into auto-update
This commit is contained in:
commit
fb87bacc7e
341 changed files with 21713 additions and 5967 deletions
|
@ -1,18 +1,19 @@
|
|||
use crate::{ItemHandle, Settings, StatusItemView};
|
||||
use crate::{ItemHandle, StatusItemView};
|
||||
use futures::StreamExt;
|
||||
use gpui::AppContext;
|
||||
use gpui::{actions, AppContext};
|
||||
use gpui::{
|
||||
action, elements::*, platform::CursorStyle, Entity, ModelHandle, MutableAppContext,
|
||||
RenderContext, View, ViewContext,
|
||||
elements::*, platform::CursorStyle, Entity, ModelHandle, MutableAppContext, RenderContext,
|
||||
View, ViewContext,
|
||||
};
|
||||
use language::{LanguageRegistry, LanguageServerBinaryStatus};
|
||||
use project::{LanguageServerProgress, Project};
|
||||
use settings::Settings;
|
||||
use smallvec::SmallVec;
|
||||
use std::cmp::Reverse;
|
||||
use std::fmt::Write;
|
||||
use std::sync::Arc;
|
||||
|
||||
action!(DismissErrorMessage);
|
||||
actions!(lsp_status, [DismissErrorMessage]);
|
||||
|
||||
pub struct LspStatus {
|
||||
checking_for_update: Vec<String>,
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
use gpui::{action, keymap::Binding, MutableAppContext};
|
||||
#[derive(Clone)]
|
||||
pub struct SelectIndex(pub usize);
|
||||
|
||||
action!(Confirm);
|
||||
action!(SelectPrev);
|
||||
action!(SelectNext);
|
||||
action!(SelectFirst);
|
||||
action!(SelectLast);
|
||||
gpui::actions!(
|
||||
menu,
|
||||
[
|
||||
Cancel,
|
||||
Confirm,
|
||||
SelectPrev,
|
||||
SelectNext,
|
||||
SelectFirst,
|
||||
SelectLast
|
||||
]
|
||||
);
|
||||
|
||||
pub fn init(cx: &mut MutableAppContext) {
|
||||
cx.add_bindings([
|
||||
Binding::new("up", SelectPrev, Some("menu")),
|
||||
Binding::new("ctrl-p", SelectPrev, Some("menu")),
|
||||
Binding::new("down", SelectNext, Some("menu")),
|
||||
Binding::new("ctrl-n", SelectNext, Some("menu")),
|
||||
Binding::new("cmd-up", SelectFirst, Some("menu")),
|
||||
Binding::new("cmd-down", SelectLast, Some("menu")),
|
||||
Binding::new("enter", Confirm, Some("menu")),
|
||||
]);
|
||||
}
|
||||
gpui::impl_internal_actions!(menu, [SelectIndex]);
|
||||
|
|
|
@ -1,29 +1,59 @@
|
|||
use super::{ItemHandle, SplitDirection};
|
||||
use crate::{toolbar::Toolbar, Item, Settings, WeakItemHandle, Workspace};
|
||||
use crate::{toolbar::Toolbar, Item, WeakItemHandle, Workspace};
|
||||
use anyhow::Result;
|
||||
use collections::{HashMap, VecDeque};
|
||||
use futures::StreamExt;
|
||||
use gpui::{
|
||||
action,
|
||||
actions,
|
||||
elements::*,
|
||||
geometry::{rect::RectF, vector::vec2f},
|
||||
keymap::Binding,
|
||||
impl_actions, impl_internal_actions,
|
||||
platform::{CursorStyle, NavigationDirection},
|
||||
AppContext, Entity, ModelHandle, MutableAppContext, PromptLevel, Quad, RenderContext, Task,
|
||||
View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
AppContext, Entity, MutableAppContext, PromptLevel, Quad, RenderContext, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use project::{Project, ProjectEntryId, ProjectPath};
|
||||
use project::{ProjectEntryId, ProjectPath};
|
||||
use serde::Deserialize;
|
||||
use settings::Settings;
|
||||
use std::{any::Any, cell::RefCell, cmp, mem, path::Path, rc::Rc};
|
||||
use util::ResultExt;
|
||||
|
||||
action!(Split, SplitDirection);
|
||||
action!(ActivateItem, usize);
|
||||
action!(ActivatePrevItem);
|
||||
action!(ActivateNextItem);
|
||||
action!(CloseActiveItem);
|
||||
action!(CloseInactiveItems);
|
||||
action!(CloseItem, usize);
|
||||
action!(GoBack, Option<WeakViewHandle<Pane>>);
|
||||
action!(GoForward, Option<WeakViewHandle<Pane>>);
|
||||
actions!(
|
||||
pane,
|
||||
[
|
||||
ActivatePrevItem,
|
||||
ActivateNextItem,
|
||||
CloseActiveItem,
|
||||
CloseInactiveItems,
|
||||
]
|
||||
);
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct Split(pub SplitDirection);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CloseItem {
|
||||
pub item_id: usize,
|
||||
pub pane: WeakViewHandle<Pane>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct ActivateItem(pub usize);
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct GoBack {
|
||||
#[serde(skip_deserializing)]
|
||||
pub pane: Option<WeakViewHandle<Pane>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct GoForward {
|
||||
#[serde(skip_deserializing)]
|
||||
pub pane: Option<WeakViewHandle<Pane>>,
|
||||
}
|
||||
|
||||
impl_actions!(pane, [Split, GoBack, GoForward]);
|
||||
impl_internal_actions!(pane, [CloseItem, ActivateItem]);
|
||||
|
||||
const MAX_NAVIGATION_HISTORY_LEN: usize = 1024;
|
||||
|
||||
|
@ -37,14 +67,11 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
cx.add_action(|pane: &mut Pane, _: &ActivateNextItem, cx| {
|
||||
pane.activate_next_item(cx);
|
||||
});
|
||||
cx.add_action(|pane: &mut Pane, _: &CloseActiveItem, cx| {
|
||||
pane.close_active_item(cx).detach();
|
||||
});
|
||||
cx.add_action(|pane: &mut Pane, _: &CloseInactiveItems, cx| {
|
||||
pane.close_inactive_items(cx).detach();
|
||||
});
|
||||
cx.add_action(|pane: &mut Pane, action: &CloseItem, cx| {
|
||||
pane.close_item(action.0, cx).detach();
|
||||
cx.add_async_action(Pane::close_active_item);
|
||||
cx.add_async_action(Pane::close_inactive_items);
|
||||
cx.add_async_action(|workspace: &mut Workspace, action: &CloseItem, cx| {
|
||||
let pane = action.pane.upgrade(cx)?;
|
||||
Some(Pane::close_item(workspace, pane, action.item_id, cx))
|
||||
});
|
||||
cx.add_action(|pane: &mut Pane, action: &Split, cx| {
|
||||
pane.split(action.0, cx);
|
||||
|
@ -53,7 +80,7 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
Pane::go_back(
|
||||
workspace,
|
||||
action
|
||||
.0
|
||||
.pane
|
||||
.as_ref()
|
||||
.and_then(|weak_handle| weak_handle.upgrade(cx)),
|
||||
cx,
|
||||
|
@ -64,26 +91,13 @@ pub fn init(cx: &mut MutableAppContext) {
|
|||
Pane::go_forward(
|
||||
workspace,
|
||||
action
|
||||
.0
|
||||
.pane
|
||||
.as_ref()
|
||||
.and_then(|weak_handle| weak_handle.upgrade(cx)),
|
||||
cx,
|
||||
)
|
||||
.detach();
|
||||
});
|
||||
|
||||
cx.add_bindings(vec![
|
||||
Binding::new("shift-cmd-{", ActivatePrevItem, Some("Pane")),
|
||||
Binding::new("shift-cmd-}", ActivateNextItem, Some("Pane")),
|
||||
Binding::new("cmd-w", CloseActiveItem, Some("Pane")),
|
||||
Binding::new("alt-cmd-w", CloseInactiveItems, Some("Pane")),
|
||||
Binding::new("cmd-k up", Split(SplitDirection::Up), Some("Pane")),
|
||||
Binding::new("cmd-k down", Split(SplitDirection::Down), Some("Pane")),
|
||||
Binding::new("cmd-k left", Split(SplitDirection::Left), Some("Pane")),
|
||||
Binding::new("cmd-k right", Split(SplitDirection::Right), Some("Pane")),
|
||||
Binding::new("ctrl--", GoBack(None), Some("Pane")),
|
||||
Binding::new("shift-ctrl-_", GoForward(None), Some("Pane")),
|
||||
]);
|
||||
}
|
||||
|
||||
pub enum Event {
|
||||
|
@ -96,9 +110,9 @@ pub enum Event {
|
|||
pub struct Pane {
|
||||
items: Vec<Box<dyn ItemHandle>>,
|
||||
active_item_index: usize,
|
||||
autoscroll: bool,
|
||||
nav_history: Rc<RefCell<NavHistory>>,
|
||||
toolbar: ViewHandle<Toolbar>,
|
||||
project: ModelHandle<Project>,
|
||||
}
|
||||
|
||||
pub struct ItemNavHistory {
|
||||
|
@ -134,13 +148,13 @@ pub struct NavigationEntry {
|
|||
}
|
||||
|
||||
impl Pane {
|
||||
pub fn new(project: ModelHandle<Project>, cx: &mut ViewContext<Self>) -> Self {
|
||||
pub fn new(cx: &mut ViewContext<Self>) -> Self {
|
||||
Self {
|
||||
items: Vec::new(),
|
||||
active_item_index: 0,
|
||||
autoscroll: false,
|
||||
nav_history: Default::default(),
|
||||
toolbar: cx.add_view(|_| Toolbar::new()),
|
||||
project,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,21 +211,14 @@ impl Pane {
|
|||
.upgrade(cx)
|
||||
.and_then(|v| pane.index_for_item(v.as_ref()))
|
||||
{
|
||||
if let Some(item) = pane.active_item() {
|
||||
pane.nav_history.borrow_mut().set_mode(mode);
|
||||
item.deactivated(cx);
|
||||
pane.nav_history
|
||||
.borrow_mut()
|
||||
.set_mode(NavigationMode::Normal);
|
||||
}
|
||||
let prev_active_item_index = pane.active_item_index;
|
||||
pane.nav_history.borrow_mut().set_mode(mode);
|
||||
pane.activate_item(index, true, cx);
|
||||
pane.nav_history
|
||||
.borrow_mut()
|
||||
.set_mode(NavigationMode::Normal);
|
||||
|
||||
let prev_active_index = mem::replace(&mut pane.active_item_index, index);
|
||||
pane.focus_active_item(cx);
|
||||
pane.update_toolbar(cx);
|
||||
cx.emit(Event::ActivateItem { local: true });
|
||||
cx.notify();
|
||||
|
||||
let mut navigated = prev_active_index != pane.active_item_index;
|
||||
let mut navigated = prev_active_item_index != pane.active_item_index;
|
||||
if let Some(data) = entry.data {
|
||||
navigated |= pane.active_item()?.navigate(data, cx);
|
||||
}
|
||||
|
@ -372,10 +379,12 @@ impl Pane {
|
|||
}
|
||||
|
||||
pub fn activate_item(&mut self, index: usize, local: bool, cx: &mut ViewContext<Self>) {
|
||||
use NavigationMode::{GoingBack, GoingForward};
|
||||
if index < self.items.len() {
|
||||
let prev_active_item_ix = mem::replace(&mut self.active_item_index, index);
|
||||
if prev_active_item_ix != self.active_item_index
|
||||
&& prev_active_item_ix < self.items.len()
|
||||
if matches!(self.nav_history.borrow().mode, GoingBack | GoingForward)
|
||||
|| (prev_active_item_ix != self.active_item_index
|
||||
&& prev_active_item_ix < self.items.len())
|
||||
{
|
||||
self.items[prev_active_item_ix].deactivated(cx);
|
||||
cx.emit(Event::ActivateItem { local });
|
||||
|
@ -385,6 +394,7 @@ impl Pane {
|
|||
self.focus_active_item(cx);
|
||||
self.activate(cx);
|
||||
}
|
||||
self.autoscroll = true;
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
|
@ -409,162 +419,183 @@ impl Pane {
|
|||
self.activate_item(index, true, cx);
|
||||
}
|
||||
|
||||
pub fn close_active_item(&mut self, cx: &mut ViewContext<Self>) -> Task<()> {
|
||||
if self.items.is_empty() {
|
||||
Task::ready(())
|
||||
fn close_active_item(
|
||||
workspace: &mut Workspace,
|
||||
_: &CloseActiveItem,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Option<Task<Result<()>>> {
|
||||
let pane_handle = workspace.active_pane().clone();
|
||||
let pane = pane_handle.read(cx);
|
||||
if pane.items.is_empty() {
|
||||
None
|
||||
} else {
|
||||
self.close_item(self.items[self.active_item_index].id(), cx)
|
||||
let item_id_to_close = pane.items[pane.active_item_index].id();
|
||||
Some(Self::close_items(
|
||||
workspace,
|
||||
pane_handle,
|
||||
cx,
|
||||
move |item_id| item_id == item_id_to_close,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close_inactive_items(&mut self, cx: &mut ViewContext<Self>) -> Task<()> {
|
||||
if self.items.is_empty() {
|
||||
Task::ready(())
|
||||
pub fn close_inactive_items(
|
||||
workspace: &mut Workspace,
|
||||
_: &CloseInactiveItems,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Option<Task<Result<()>>> {
|
||||
let pane_handle = workspace.active_pane().clone();
|
||||
let pane = pane_handle.read(cx);
|
||||
if pane.items.is_empty() {
|
||||
None
|
||||
} else {
|
||||
let active_item_id = self.items[self.active_item_index].id();
|
||||
self.close_items(cx, move |id| id != active_item_id)
|
||||
let active_item_id = pane.items[pane.active_item_index].id();
|
||||
Some(Self::close_items(workspace, pane_handle, cx, move |id| {
|
||||
id != active_item_id
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close_item(&mut self, view_id_to_close: usize, cx: &mut ViewContext<Self>) -> Task<()> {
|
||||
self.close_items(cx, move |view_id| view_id == view_id_to_close)
|
||||
pub fn close_item(
|
||||
workspace: &mut Workspace,
|
||||
pane: ViewHandle<Pane>,
|
||||
item_id_to_close: usize,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Task<Result<()>> {
|
||||
Self::close_items(workspace, pane, cx, move |view_id| {
|
||||
view_id == item_id_to_close
|
||||
})
|
||||
}
|
||||
|
||||
pub fn close_items(
|
||||
&mut self,
|
||||
cx: &mut ViewContext<Self>,
|
||||
workspace: &mut Workspace,
|
||||
pane: ViewHandle<Pane>,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
should_close: impl 'static + Fn(usize) -> bool,
|
||||
) -> Task<()> {
|
||||
) -> Task<Result<()>> {
|
||||
const CONFLICT_MESSAGE: &'static str = "This file has changed on disk since you started editing it. Do you want to overwrite it?";
|
||||
const DIRTY_MESSAGE: &'static str =
|
||||
"This file contains unsaved edits. Do you want to save it?";
|
||||
|
||||
let project = self.project.clone();
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
while let Some(item_to_close_ix) = this.read_with(&cx, |this, _| {
|
||||
this.items.iter().position(|item| should_close(item.id()))
|
||||
let project = workspace.project().clone();
|
||||
cx.spawn(|workspace, mut cx| async move {
|
||||
while let Some(item_to_close_ix) = pane.read_with(&cx, |pane, _| {
|
||||
pane.items.iter().position(|item| should_close(item.id()))
|
||||
}) {
|
||||
let item =
|
||||
this.read_with(&cx, |this, _| this.items[item_to_close_ix].boxed_clone());
|
||||
if cx.read(|cx| item.is_dirty(cx)) {
|
||||
if cx.read(|cx| item.can_save(cx)) {
|
||||
let mut answer = this.update(&mut cx, |this, cx| {
|
||||
this.activate_item(item_to_close_ix, true, cx);
|
||||
pane.read_with(&cx, |pane, _| pane.items[item_to_close_ix].boxed_clone());
|
||||
|
||||
let is_last_item_for_entry = workspace.read_with(&cx, |workspace, cx| {
|
||||
let project_entry_id = item.project_entry_id(cx);
|
||||
project_entry_id.is_none()
|
||||
|| workspace
|
||||
.items(cx)
|
||||
.filter(|item| item.project_entry_id(cx) == project_entry_id)
|
||||
.count()
|
||||
== 1
|
||||
});
|
||||
|
||||
if is_last_item_for_entry {
|
||||
if cx.read(|cx| item.has_conflict(cx) && item.can_save(cx)) {
|
||||
let mut answer = pane.update(&mut cx, |pane, cx| {
|
||||
pane.activate_item(item_to_close_ix, true, cx);
|
||||
cx.prompt(
|
||||
PromptLevel::Warning,
|
||||
DIRTY_MESSAGE,
|
||||
&["Save", "Don't Save", "Cancel"],
|
||||
CONFLICT_MESSAGE,
|
||||
&["Overwrite", "Discard", "Cancel"],
|
||||
)
|
||||
});
|
||||
|
||||
match answer.next().await {
|
||||
Some(0) => {
|
||||
if cx
|
||||
.update(|cx| item.save(project.clone(), cx))
|
||||
.await
|
||||
.log_err()
|
||||
.is_none()
|
||||
{
|
||||
break;
|
||||
}
|
||||
cx.update(|cx| item.save(project.clone(), cx)).await?;
|
||||
}
|
||||
Some(1) => {
|
||||
cx.update(|cx| item.reload(project.clone(), cx)).await?;
|
||||
}
|
||||
Some(1) => {}
|
||||
_ => break,
|
||||
}
|
||||
} else if cx.read(|cx| item.can_save_as(cx)) {
|
||||
let mut answer = this.update(&mut cx, |this, cx| {
|
||||
this.activate_item(item_to_close_ix, true, cx);
|
||||
cx.prompt(
|
||||
PromptLevel::Warning,
|
||||
DIRTY_MESSAGE,
|
||||
&["Save", "Don't Save", "Cancel"],
|
||||
)
|
||||
});
|
||||
} else if cx.read(|cx| item.is_dirty(cx)) {
|
||||
if cx.read(|cx| item.can_save(cx)) {
|
||||
let mut answer = pane.update(&mut cx, |pane, cx| {
|
||||
pane.activate_item(item_to_close_ix, true, cx);
|
||||
cx.prompt(
|
||||
PromptLevel::Warning,
|
||||
DIRTY_MESSAGE,
|
||||
&["Save", "Don't Save", "Cancel"],
|
||||
)
|
||||
});
|
||||
|
||||
match answer.next().await {
|
||||
Some(0) => {
|
||||
let start_abs_path = project
|
||||
.read_with(&cx, |project, cx| {
|
||||
let worktree = project.visible_worktrees(cx).next()?;
|
||||
Some(worktree.read(cx).as_local()?.abs_path().to_path_buf())
|
||||
})
|
||||
.unwrap_or(Path::new("").into());
|
||||
match answer.next().await {
|
||||
Some(0) => {
|
||||
cx.update(|cx| item.save(project.clone(), cx)).await?;
|
||||
}
|
||||
Some(1) => {}
|
||||
_ => break,
|
||||
}
|
||||
} else if cx.read(|cx| item.can_save_as(cx)) {
|
||||
let mut answer = pane.update(&mut cx, |pane, cx| {
|
||||
pane.activate_item(item_to_close_ix, true, cx);
|
||||
cx.prompt(
|
||||
PromptLevel::Warning,
|
||||
DIRTY_MESSAGE,
|
||||
&["Save", "Don't Save", "Cancel"],
|
||||
)
|
||||
});
|
||||
|
||||
let mut abs_path =
|
||||
cx.update(|cx| cx.prompt_for_new_path(&start_abs_path));
|
||||
if let Some(abs_path) = abs_path.next().await.flatten() {
|
||||
if cx
|
||||
.update(|cx| item.save_as(project.clone(), abs_path, cx))
|
||||
.await
|
||||
.log_err()
|
||||
.is_none()
|
||||
{
|
||||
match answer.next().await {
|
||||
Some(0) => {
|
||||
let start_abs_path = project
|
||||
.read_with(&cx, |project, cx| {
|
||||
let worktree = project.visible_worktrees(cx).next()?;
|
||||
Some(
|
||||
worktree
|
||||
.read(cx)
|
||||
.as_local()?
|
||||
.abs_path()
|
||||
.to_path_buf(),
|
||||
)
|
||||
})
|
||||
.unwrap_or(Path::new("").into());
|
||||
|
||||
let mut abs_path =
|
||||
cx.update(|cx| cx.prompt_for_new_path(&start_abs_path));
|
||||
if let Some(abs_path) = abs_path.next().await.flatten() {
|
||||
cx.update(|cx| item.save_as(project.clone(), abs_path, cx))
|
||||
.await?;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Some(1) => {}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
} else if cx.read(|cx| item.has_conflict(cx) && item.can_save(cx)) {
|
||||
let mut answer = this.update(&mut cx, |this, cx| {
|
||||
this.activate_item(item_to_close_ix, true, cx);
|
||||
cx.prompt(
|
||||
PromptLevel::Warning,
|
||||
CONFLICT_MESSAGE,
|
||||
&["Overwrite", "Discard", "Cancel"],
|
||||
)
|
||||
});
|
||||
|
||||
match answer.next().await {
|
||||
Some(0) => {
|
||||
if cx
|
||||
.update(|cx| item.save(project.clone(), cx))
|
||||
.await
|
||||
.log_err()
|
||||
.is_none()
|
||||
{
|
||||
break;
|
||||
Some(1) => {}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
Some(1) => {
|
||||
if cx
|
||||
.update(|cx| item.reload(project.clone(), cx))
|
||||
.await
|
||||
.log_err()
|
||||
.is_none()
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
|
||||
this.update(&mut cx, |this, cx| {
|
||||
if let Some(item_ix) = this.items.iter().position(|i| i.id() == item.id()) {
|
||||
if item_ix == this.active_item_index {
|
||||
if item_ix + 1 < this.items.len() {
|
||||
this.activate_next_item(cx);
|
||||
pane.update(&mut cx, |pane, cx| {
|
||||
if let Some(item_ix) = pane.items.iter().position(|i| i.id() == item.id()) {
|
||||
if item_ix == pane.active_item_index {
|
||||
if item_ix + 1 < pane.items.len() {
|
||||
pane.activate_next_item(cx);
|
||||
} else if item_ix > 0 {
|
||||
this.activate_prev_item(cx);
|
||||
pane.activate_prev_item(cx);
|
||||
}
|
||||
}
|
||||
|
||||
let item = this.items.remove(item_ix);
|
||||
if this.items.is_empty() {
|
||||
let item = pane.items.remove(item_ix);
|
||||
if pane.items.is_empty() {
|
||||
item.deactivated(cx);
|
||||
pane.update_toolbar(cx);
|
||||
cx.emit(Event::Remove);
|
||||
}
|
||||
|
||||
if item_ix < this.active_item_index {
|
||||
this.active_item_index -= 1;
|
||||
if item_ix < pane.active_item_index {
|
||||
pane.active_item_index -= 1;
|
||||
}
|
||||
|
||||
let mut nav_history = this.nav_history.borrow_mut();
|
||||
let mut nav_history = pane.nav_history.borrow_mut();
|
||||
if let Some(path) = item.project_path(cx) {
|
||||
nav_history.paths_by_item.insert(item.id(), path);
|
||||
} else {
|
||||
|
@ -574,7 +605,8 @@ impl Pane {
|
|||
});
|
||||
}
|
||||
|
||||
this.update(&mut cx, |_, cx| cx.notify());
|
||||
pane.update(&mut cx, |_, cx| cx.notify());
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -602,12 +634,18 @@ impl Pane {
|
|||
});
|
||||
}
|
||||
|
||||
fn render_tabs(&self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||
fn render_tabs(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
||||
enum Tabs {}
|
||||
let pane = cx.handle();
|
||||
let tabs = MouseEventHandler::new::<Tabs, _, _>(0, cx, |mouse_state, cx| {
|
||||
let mut row = Flex::row();
|
||||
let autoscroll = if mem::take(&mut self.autoscroll) {
|
||||
Some(self.active_item_index)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut row = Flex::row().scrollable::<Tabs, _>(1, autoscroll, cx);
|
||||
for (ix, item) in self.items.iter().enumerate() {
|
||||
let is_active = ix == self.active_item_index;
|
||||
|
||||
|
@ -697,8 +735,14 @@ impl Pane {
|
|||
)
|
||||
.with_padding(Padding::uniform(4.))
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
.on_click(move |cx| {
|
||||
cx.dispatch_action(CloseItem(item_id))
|
||||
.on_click({
|
||||
let pane = pane.clone();
|
||||
move |cx| {
|
||||
cx.dispatch_action(CloseItem {
|
||||
item_id,
|
||||
pane: pane.clone(),
|
||||
})
|
||||
}
|
||||
})
|
||||
.named("close-tab-icon")
|
||||
} else {
|
||||
|
@ -763,8 +807,8 @@ impl View for Pane {
|
|||
.on_navigate_mouse_down(move |direction, cx| {
|
||||
let this = this.clone();
|
||||
match direction {
|
||||
NavigationDirection::Back => cx.dispatch_action(GoBack(Some(this))),
|
||||
NavigationDirection::Forward => cx.dispatch_action(GoForward(Some(this))),
|
||||
NavigationDirection::Back => cx.dispatch_action(GoBack { pane: Some(this) }),
|
||||
NavigationDirection::Forward => cx.dispatch_action(GoForward { pane: Some(this) }),
|
||||
}
|
||||
|
||||
true
|
||||
|
@ -860,10 +904,11 @@ impl NavHistory {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::WorkspaceParams;
|
||||
|
||||
use super::*;
|
||||
use gpui::TestAppContext;
|
||||
use crate::WorkspaceParams;
|
||||
use gpui::{ModelHandle, TestAppContext, ViewContext};
|
||||
use project::Project;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_close_items(cx: &mut TestAppContext) {
|
||||
|
@ -873,7 +918,7 @@ mod tests {
|
|||
let (window_id, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx));
|
||||
let item1 = cx.add_view(window_id, |_| {
|
||||
let mut item = TestItem::new();
|
||||
item.has_conflict = true;
|
||||
item.is_dirty = true;
|
||||
item
|
||||
});
|
||||
let item2 = cx.add_view(window_id, |_| {
|
||||
|
@ -884,15 +929,11 @@ mod tests {
|
|||
});
|
||||
let item3 = cx.add_view(window_id, |_| {
|
||||
let mut item = TestItem::new();
|
||||
item.is_dirty = true;
|
||||
item.has_conflict = true;
|
||||
item
|
||||
});
|
||||
let item4 = cx.add_view(window_id, |_| {
|
||||
let mut item = TestItem::new();
|
||||
item.is_dirty = true;
|
||||
item
|
||||
});
|
||||
let item5 = cx.add_view(window_id, |_| {
|
||||
let mut item = TestItem::new();
|
||||
item.is_dirty = true;
|
||||
item.can_save = false;
|
||||
|
@ -903,26 +944,26 @@ mod tests {
|
|||
workspace.add_item(Box::new(item2.clone()), cx);
|
||||
workspace.add_item(Box::new(item3.clone()), cx);
|
||||
workspace.add_item(Box::new(item4.clone()), cx);
|
||||
workspace.add_item(Box::new(item5.clone()), cx);
|
||||
workspace.active_pane().clone()
|
||||
});
|
||||
|
||||
let close_items = pane.update(cx, |pane, cx| {
|
||||
pane.activate_item(1, true, cx);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item2.id());
|
||||
let close_items = workspace.update(cx, |workspace, cx| {
|
||||
pane.update(cx, |pane, cx| {
|
||||
pane.activate_item(1, true, cx);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item2.id());
|
||||
});
|
||||
|
||||
let item1_id = item1.id();
|
||||
let item3_id = item3.id();
|
||||
let item4_id = item4.id();
|
||||
let item5_id = item5.id();
|
||||
pane.close_items(cx, move |id| {
|
||||
[item1_id, item3_id, item4_id, item5_id].contains(&id)
|
||||
Pane::close_items(workspace, pane.clone(), cx, move |id| {
|
||||
[item1_id, item3_id, item4_id].contains(&id)
|
||||
})
|
||||
});
|
||||
|
||||
cx.foreground().run_until_parked();
|
||||
pane.read_with(cx, |pane, _| {
|
||||
assert_eq!(pane.items.len(), 5);
|
||||
assert_eq!(pane.items.len(), 4);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item1.id());
|
||||
});
|
||||
|
||||
|
@ -932,7 +973,7 @@ mod tests {
|
|||
assert_eq!(item1.read(cx).save_count, 1);
|
||||
assert_eq!(item1.read(cx).save_as_count, 0);
|
||||
assert_eq!(item1.read(cx).reload_count, 0);
|
||||
assert_eq!(pane.items.len(), 4);
|
||||
assert_eq!(pane.items.len(), 3);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item3.id());
|
||||
});
|
||||
|
||||
|
@ -942,33 +983,67 @@ mod tests {
|
|||
assert_eq!(item3.read(cx).save_count, 0);
|
||||
assert_eq!(item3.read(cx).save_as_count, 0);
|
||||
assert_eq!(item3.read(cx).reload_count, 1);
|
||||
assert_eq!(pane.items.len(), 3);
|
||||
assert_eq!(pane.items.len(), 2);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item4.id());
|
||||
});
|
||||
|
||||
cx.simulate_prompt_answer(window_id, 0);
|
||||
cx.foreground().run_until_parked();
|
||||
pane.read_with(cx, |pane, cx| {
|
||||
assert_eq!(item4.read(cx).save_count, 1);
|
||||
assert_eq!(item4.read(cx).save_as_count, 0);
|
||||
assert_eq!(item4.read(cx).reload_count, 0);
|
||||
assert_eq!(pane.items.len(), 2);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item5.id());
|
||||
});
|
||||
|
||||
cx.simulate_prompt_answer(window_id, 0);
|
||||
cx.foreground().run_until_parked();
|
||||
cx.simulate_new_path_selection(|_| Some(Default::default()));
|
||||
close_items.await;
|
||||
close_items.await.unwrap();
|
||||
pane.read_with(cx, |pane, cx| {
|
||||
assert_eq!(item5.read(cx).save_count, 0);
|
||||
assert_eq!(item5.read(cx).save_as_count, 1);
|
||||
assert_eq!(item5.read(cx).reload_count, 0);
|
||||
assert_eq!(item4.read(cx).save_count, 0);
|
||||
assert_eq!(item4.read(cx).save_as_count, 1);
|
||||
assert_eq!(item4.read(cx).reload_count, 0);
|
||||
assert_eq!(pane.items.len(), 1);
|
||||
assert_eq!(pane.active_item().unwrap().id(), item2.id());
|
||||
});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_prompting_only_on_last_item_for_entry(cx: &mut TestAppContext) {
|
||||
cx.foreground().forbid_parking();
|
||||
|
||||
let params = cx.update(WorkspaceParams::test);
|
||||
let (window_id, workspace) = cx.add_window(|cx| Workspace::new(¶ms, cx));
|
||||
let item = cx.add_view(window_id, |_| {
|
||||
let mut item = TestItem::new();
|
||||
item.is_dirty = true;
|
||||
item.project_entry_id = Some(ProjectEntryId::new(&AtomicUsize::new(1)));
|
||||
item
|
||||
});
|
||||
|
||||
let (left_pane, right_pane) = workspace.update(cx, |workspace, cx| {
|
||||
workspace.add_item(Box::new(item.clone()), cx);
|
||||
let left_pane = workspace.active_pane().clone();
|
||||
let right_pane = workspace.split_pane(left_pane.clone(), SplitDirection::Right, cx);
|
||||
(left_pane, right_pane)
|
||||
});
|
||||
|
||||
workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
let item = right_pane.read(cx).active_item().unwrap();
|
||||
Pane::close_item(workspace, right_pane.clone(), item.id(), cx)
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
workspace.read_with(cx, |workspace, _| {
|
||||
assert_eq!(workspace.panes(), [left_pane.clone()]);
|
||||
});
|
||||
|
||||
let close_item = workspace.update(cx, |workspace, cx| {
|
||||
let item = left_pane.read(cx).active_item().unwrap();
|
||||
Pane::close_item(workspace, left_pane.clone(), item.id(), cx)
|
||||
});
|
||||
cx.foreground().run_until_parked();
|
||||
cx.simulate_prompt_answer(window_id, 0);
|
||||
close_item.await.unwrap();
|
||||
left_pane.read_with(cx, |pane, _| {
|
||||
assert_eq!(pane.items.len(), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct TestItem {
|
||||
save_count: usize,
|
||||
save_as_count: usize,
|
||||
|
@ -976,6 +1051,7 @@ mod tests {
|
|||
is_dirty: bool,
|
||||
has_conflict: bool,
|
||||
can_save: bool,
|
||||
project_entry_id: Option<ProjectEntryId>,
|
||||
}
|
||||
|
||||
impl TestItem {
|
||||
|
@ -987,6 +1063,7 @@ mod tests {
|
|||
is_dirty: false,
|
||||
has_conflict: false,
|
||||
can_save: true,
|
||||
project_entry_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1015,11 +1092,18 @@ mod tests {
|
|||
}
|
||||
|
||||
fn project_entry_id(&self, _: &AppContext) -> Option<ProjectEntryId> {
|
||||
None
|
||||
self.project_entry_id
|
||||
}
|
||||
|
||||
fn set_nav_history(&mut self, _: ItemNavHistory, _: &mut ViewContext<Self>) {}
|
||||
|
||||
fn clone_on_split(&self, _: &mut ViewContext<Self>) -> Option<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
Some(self.clone())
|
||||
}
|
||||
|
||||
fn is_dirty(&self, _: &AppContext) -> bool {
|
||||
self.is_dirty
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ use client::PeerId;
|
|||
use collections::HashMap;
|
||||
use gpui::{elements::*, Axis, Border, ViewHandle};
|
||||
use project::Collaborator;
|
||||
use serde::Deserialize;
|
||||
use theme::Theme;
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
|
@ -254,7 +255,7 @@ impl PaneAxis {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Copy, Debug, Deserialize)]
|
||||
pub enum SplitDirection {
|
||||
Up,
|
||||
Down,
|
||||
|
|
|
@ -1,325 +0,0 @@
|
|||
use anyhow::Result;
|
||||
use futures::{stream, SinkExt, StreamExt as _};
|
||||
use gpui::{
|
||||
executor,
|
||||
font_cache::{FamilyId, FontCache},
|
||||
};
|
||||
use language::Language;
|
||||
use postage::{prelude::Stream, watch};
|
||||
use project::Fs;
|
||||
use schemars::{schema_for, JsonSchema};
|
||||
use serde::Deserialize;
|
||||
use std::{collections::HashMap, path::Path, sync::Arc, time::Duration};
|
||||
use theme::{Theme, ThemeRegistry};
|
||||
use util::ResultExt;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Settings {
|
||||
pub buffer_font_family: FamilyId,
|
||||
pub buffer_font_size: f32,
|
||||
pub vim_mode: bool,
|
||||
pub tab_size: usize,
|
||||
pub soft_wrap: SoftWrap,
|
||||
pub preferred_line_length: u32,
|
||||
pub language_overrides: HashMap<Arc<str>, LanguageOverride>,
|
||||
pub theme: Arc<Theme>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
pub struct LanguageOverride {
|
||||
pub tab_size: Option<usize>,
|
||||
pub soft_wrap: Option<SoftWrap>,
|
||||
pub preferred_line_length: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, JsonSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SoftWrap {
|
||||
None,
|
||||
EditorWidth,
|
||||
PreferredLineLength,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SettingsFile(watch::Receiver<SettingsFileContent>);
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, JsonSchema)]
|
||||
struct SettingsFileContent {
|
||||
#[serde(default)]
|
||||
buffer_font_family: Option<String>,
|
||||
#[serde(default)]
|
||||
buffer_font_size: Option<f32>,
|
||||
#[serde(default)]
|
||||
vim_mode: Option<bool>,
|
||||
#[serde(flatten)]
|
||||
editor: LanguageOverride,
|
||||
#[serde(default)]
|
||||
language_overrides: HashMap<Arc<str>, LanguageOverride>,
|
||||
#[serde(default)]
|
||||
theme: Option<String>,
|
||||
}
|
||||
|
||||
impl SettingsFile {
|
||||
pub async fn new(
|
||||
fs: Arc<dyn Fs>,
|
||||
executor: &executor::Background,
|
||||
path: impl Into<Arc<Path>>,
|
||||
) -> Self {
|
||||
let path = path.into();
|
||||
let settings = Self::load(fs.clone(), &path).await.unwrap_or_default();
|
||||
let mut events = fs.watch(&path, Duration::from_millis(500)).await;
|
||||
let (mut tx, rx) = watch::channel_with(settings);
|
||||
executor
|
||||
.spawn(async move {
|
||||
while events.next().await.is_some() {
|
||||
if let Some(settings) = Self::load(fs.clone(), &path).await {
|
||||
if tx.send(settings).await.is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
Self(rx)
|
||||
}
|
||||
|
||||
async fn load(fs: Arc<dyn Fs>, path: &Path) -> Option<SettingsFileContent> {
|
||||
if fs.is_file(&path).await {
|
||||
fs.load(&path)
|
||||
.await
|
||||
.log_err()
|
||||
.and_then(|data| serde_json::from_str(&data).log_err())
|
||||
} else {
|
||||
Some(SettingsFileContent::default())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
pub fn file_json_schema() -> serde_json::Value {
|
||||
serde_json::to_value(schema_for!(SettingsFileContent)).unwrap()
|
||||
}
|
||||
|
||||
pub fn from_files(
|
||||
defaults: Self,
|
||||
sources: Vec<SettingsFile>,
|
||||
theme_registry: Arc<ThemeRegistry>,
|
||||
font_cache: Arc<FontCache>,
|
||||
) -> impl futures::stream::Stream<Item = Self> {
|
||||
stream::select_all(sources.iter().enumerate().map(|(i, source)| {
|
||||
let mut rx = source.0.clone();
|
||||
// Consume the initial item from all of the constituent file watches but one.
|
||||
// This way, the stream will yield exactly one item for the files' initial
|
||||
// state, and won't return any more items until the files change.
|
||||
if i > 0 {
|
||||
rx.try_recv().ok();
|
||||
}
|
||||
rx
|
||||
}))
|
||||
.map(move |_| {
|
||||
let mut settings = defaults.clone();
|
||||
for source in &sources {
|
||||
settings.merge(&*source.0.borrow(), &theme_registry, &font_cache);
|
||||
}
|
||||
settings
|
||||
})
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
buffer_font_family: &str,
|
||||
font_cache: &FontCache,
|
||||
theme: Arc<Theme>,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
buffer_font_family: font_cache.load_family(&[buffer_font_family])?,
|
||||
buffer_font_size: 15.,
|
||||
vim_mode: false,
|
||||
tab_size: 4,
|
||||
soft_wrap: SoftWrap::None,
|
||||
preferred_line_length: 80,
|
||||
language_overrides: Default::default(),
|
||||
theme,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn with_overrides(
|
||||
mut self,
|
||||
language_name: impl Into<Arc<str>>,
|
||||
overrides: LanguageOverride,
|
||||
) -> Self {
|
||||
self.language_overrides
|
||||
.insert(language_name.into(), overrides);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn tab_size(&self, language: Option<&Arc<Language>>) -> usize {
|
||||
language
|
||||
.and_then(|language| self.language_overrides.get(language.name().as_ref()))
|
||||
.and_then(|settings| settings.tab_size)
|
||||
.unwrap_or(self.tab_size)
|
||||
}
|
||||
|
||||
pub fn soft_wrap(&self, language: Option<&Arc<Language>>) -> SoftWrap {
|
||||
language
|
||||
.and_then(|language| self.language_overrides.get(language.name().as_ref()))
|
||||
.and_then(|settings| settings.soft_wrap)
|
||||
.unwrap_or(self.soft_wrap)
|
||||
}
|
||||
|
||||
pub fn preferred_line_length(&self, language: Option<&Arc<Language>>) -> u32 {
|
||||
language
|
||||
.and_then(|language| self.language_overrides.get(language.name().as_ref()))
|
||||
.and_then(|settings| settings.preferred_line_length)
|
||||
.unwrap_or(self.preferred_line_length)
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn test(cx: &gpui::AppContext) -> Settings {
|
||||
Settings {
|
||||
buffer_font_family: cx.font_cache().load_family(&["Monaco"]).unwrap(),
|
||||
buffer_font_size: 14.,
|
||||
vim_mode: false,
|
||||
tab_size: 4,
|
||||
soft_wrap: SoftWrap::None,
|
||||
preferred_line_length: 80,
|
||||
language_overrides: Default::default(),
|
||||
theme: gpui::fonts::with_font_cache(cx.font_cache().clone(), || Default::default()),
|
||||
}
|
||||
}
|
||||
|
||||
fn merge(
|
||||
&mut self,
|
||||
data: &SettingsFileContent,
|
||||
theme_registry: &ThemeRegistry,
|
||||
font_cache: &FontCache,
|
||||
) {
|
||||
if let Some(value) = &data.buffer_font_family {
|
||||
if let Some(id) = font_cache.load_family(&[value]).log_err() {
|
||||
self.buffer_font_family = id;
|
||||
}
|
||||
}
|
||||
if let Some(value) = &data.theme {
|
||||
if let Some(theme) = theme_registry.get(value).log_err() {
|
||||
self.theme = theme;
|
||||
}
|
||||
}
|
||||
|
||||
merge(&mut self.buffer_font_size, data.buffer_font_size);
|
||||
merge(&mut self.vim_mode, data.vim_mode);
|
||||
merge(&mut self.soft_wrap, data.editor.soft_wrap);
|
||||
merge(&mut self.tab_size, data.editor.tab_size);
|
||||
merge(
|
||||
&mut self.preferred_line_length,
|
||||
data.editor.preferred_line_length,
|
||||
);
|
||||
|
||||
for (language_name, settings) in &data.language_overrides {
|
||||
let target = self
|
||||
.language_overrides
|
||||
.entry(language_name.clone())
|
||||
.or_default();
|
||||
|
||||
merge_option(&mut target.tab_size, settings.tab_size);
|
||||
merge_option(&mut target.soft_wrap, settings.soft_wrap);
|
||||
merge_option(
|
||||
&mut target.preferred_line_length,
|
||||
settings.preferred_line_length,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn merge<T: Copy>(target: &mut T, value: Option<T>) {
|
||||
if let Some(value) = value {
|
||||
*target = value;
|
||||
}
|
||||
}
|
||||
|
||||
fn merge_option<T: Copy>(target: &mut Option<T>, value: Option<T>) {
|
||||
if value.is_some() {
|
||||
*target = value;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use project::FakeFs;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_settings_from_files(cx: &mut gpui::TestAppContext) {
|
||||
let executor = cx.background();
|
||||
let fs = FakeFs::new(executor.clone());
|
||||
|
||||
fs.save(
|
||||
"/settings1.json".as_ref(),
|
||||
&r#"
|
||||
{
|
||||
"buffer_font_size": 24,
|
||||
"soft_wrap": "editor_width",
|
||||
"language_overrides": {
|
||||
"Markdown": {
|
||||
"preferred_line_length": 100,
|
||||
"soft_wrap": "preferred_line_length"
|
||||
}
|
||||
}
|
||||
}
|
||||
"#
|
||||
.into(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let source1 = SettingsFile::new(fs.clone(), &executor, "/settings1.json".as_ref()).await;
|
||||
let source2 = SettingsFile::new(fs.clone(), &executor, "/settings2.json".as_ref()).await;
|
||||
let source3 = SettingsFile::new(fs.clone(), &executor, "/settings3.json".as_ref()).await;
|
||||
|
||||
let mut settings_rx = Settings::from_files(
|
||||
cx.read(Settings::test),
|
||||
vec![source1, source2, source3],
|
||||
ThemeRegistry::new((), cx.font_cache()),
|
||||
cx.font_cache(),
|
||||
);
|
||||
|
||||
let settings = settings_rx.next().await.unwrap();
|
||||
let md_settings = settings.language_overrides.get("Markdown").unwrap();
|
||||
assert_eq!(settings.soft_wrap, SoftWrap::EditorWidth);
|
||||
assert_eq!(settings.buffer_font_size, 24.0);
|
||||
assert_eq!(settings.tab_size, 4);
|
||||
assert_eq!(md_settings.soft_wrap, Some(SoftWrap::PreferredLineLength));
|
||||
assert_eq!(md_settings.preferred_line_length, Some(100));
|
||||
|
||||
fs.save(
|
||||
"/settings2.json".as_ref(),
|
||||
&r#"
|
||||
{
|
||||
"tab_size": 2,
|
||||
"soft_wrap": "none",
|
||||
"language_overrides": {
|
||||
"Markdown": {
|
||||
"preferred_line_length": 120
|
||||
}
|
||||
}
|
||||
}
|
||||
"#
|
||||
.into(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let settings = settings_rx.next().await.unwrap();
|
||||
let md_settings = settings.language_overrides.get("Markdown").unwrap();
|
||||
assert_eq!(settings.soft_wrap, SoftWrap::None);
|
||||
assert_eq!(settings.buffer_font_size, 24.0);
|
||||
assert_eq!(settings.tab_size, 2);
|
||||
assert_eq!(md_settings.soft_wrap, Some(SoftWrap::PreferredLineLength));
|
||||
assert_eq!(md_settings.preferred_line_length, Some(120));
|
||||
|
||||
fs.remove_file("/settings2.json".as_ref(), Default::default())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let settings = settings_rx.next().await.unwrap();
|
||||
assert_eq!(settings.tab_size, 4);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
use super::Workspace;
|
||||
use gpui::{action, elements::*, platform::CursorStyle, AnyViewHandle, RenderContext};
|
||||
use gpui::{elements::*, impl_actions, platform::CursorStyle, AnyViewHandle, RenderContext};
|
||||
use serde::Deserialize;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use theme::Theme;
|
||||
|
||||
|
@ -10,7 +11,7 @@ pub struct Sidebar {
|
|||
width: Rc<RefCell<f32>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, Deserialize)]
|
||||
pub enum Side {
|
||||
Left,
|
||||
Right,
|
||||
|
@ -21,10 +22,15 @@ struct Item {
|
|||
view: AnyViewHandle,
|
||||
}
|
||||
|
||||
action!(ToggleSidebarItem, SidebarItemId);
|
||||
action!(ToggleSidebarItemFocus, SidebarItemId);
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct ToggleSidebarItem(pub SidebarItemId);
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct ToggleSidebarItemFocus(pub SidebarItemId);
|
||||
|
||||
impl_actions!(workspace, [ToggleSidebarItem, ToggleSidebarItemFocus]);
|
||||
|
||||
#[derive(Clone, Deserialize)]
|
||||
pub struct SidebarItemId {
|
||||
pub side: Side,
|
||||
pub item_index: usize,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{ItemHandle, Pane, Settings};
|
||||
use crate::{ItemHandle, Pane};
|
||||
use settings::Settings;
|
||||
use gpui::{
|
||||
elements::*, AnyViewHandle, ElementBox, Entity, MutableAppContext, RenderContext, Subscription,
|
||||
View, ViewContext, ViewHandle,
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::{ItemHandle, Settings};
|
||||
use crate::ItemHandle;
|
||||
use gpui::{
|
||||
elements::*, AnyViewHandle, AppContext, ElementBox, Entity, MutableAppContext, RenderContext,
|
||||
View, ViewContext, ViewHandle,
|
||||
};
|
||||
use settings::Settings;
|
||||
|
||||
pub trait ToolbarItemView: View {
|
||||
fn set_active_pane_item(
|
||||
|
|
|
@ -2,7 +2,6 @@ pub mod lsp_status;
|
|||
pub mod menu;
|
||||
pub mod pane;
|
||||
pub mod pane_group;
|
||||
pub mod settings;
|
||||
pub mod sidebar;
|
||||
mod status_bar;
|
||||
mod toolbar;
|
||||
|
@ -14,16 +13,16 @@ use client::{
|
|||
use clock::ReplicaId;
|
||||
use collections::{hash_map, HashMap, HashSet};
|
||||
use gpui::{
|
||||
action,
|
||||
actions,
|
||||
color::Color,
|
||||
elements::*,
|
||||
geometry::{vector::vec2f, PathBuilder},
|
||||
json::{self, to_string_pretty, ToJson},
|
||||
keymap::Binding,
|
||||
geometry::{rect::RectF, vector::vec2f, PathBuilder},
|
||||
impl_internal_actions,
|
||||
json::{self, ToJson},
|
||||
platform::{CursorStyle, WindowOptions},
|
||||
AnyModelHandle, AnyViewHandle, AppContext, AsyncAppContext, Border, ClipboardItem, Entity,
|
||||
ImageData, ModelHandle, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task,
|
||||
View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
AnyModelHandle, AnyViewHandle, AppContext, AsyncAppContext, Border, Entity, ImageData,
|
||||
ModelHandle, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use language::LanguageRegistry;
|
||||
use log::error;
|
||||
|
@ -31,8 +30,8 @@ pub use pane::*;
|
|||
pub use pane_group::*;
|
||||
use postage::prelude::Stream;
|
||||
use project::{fs, Fs, Project, ProjectEntryId, ProjectPath, Worktree};
|
||||
pub use settings::Settings;
|
||||
use sidebar::{Side, Sidebar, SidebarItemId, ToggleSidebarItem, ToggleSidebarItemFocus};
|
||||
use settings::Settings;
|
||||
use sidebar::{Side, Sidebar, ToggleSidebarItem, ToggleSidebarItemFocus};
|
||||
use status_bar::StatusBar;
|
||||
pub use status_bar::StatusItemView;
|
||||
use std::{
|
||||
|
@ -70,32 +69,56 @@ type FollowableItemBuilders = HashMap<
|
|||
),
|
||||
>;
|
||||
|
||||
action!(Open, Arc<AppState>);
|
||||
action!(OpenNew, Arc<AppState>);
|
||||
action!(OpenPaths, OpenParams);
|
||||
action!(ToggleShare);
|
||||
action!(ToggleFollow, PeerId);
|
||||
action!(FollowNextCollaborator);
|
||||
action!(Unfollow);
|
||||
action!(JoinProject, JoinProjectParams);
|
||||
action!(Save);
|
||||
action!(DebugElements);
|
||||
action!(ActivatePreviousPane);
|
||||
action!(ActivateNextPane);
|
||||
actions!(
|
||||
workspace,
|
||||
[
|
||||
ToggleShare,
|
||||
Unfollow,
|
||||
Save,
|
||||
ActivatePreviousPane,
|
||||
ActivateNextPane,
|
||||
FollowNextCollaborator,
|
||||
]
|
||||
);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Open(pub Arc<AppState>);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct OpenNew(pub Arc<AppState>);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct OpenPaths {
|
||||
pub paths: Vec<PathBuf>,
|
||||
pub app_state: Arc<AppState>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ToggleFollow(pub PeerId);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct JoinProject {
|
||||
pub project_id: u64,
|
||||
pub app_state: Arc<AppState>,
|
||||
}
|
||||
|
||||
impl_internal_actions!(
|
||||
workspace,
|
||||
[Open, OpenNew, OpenPaths, ToggleFollow, JoinProject]
|
||||
);
|
||||
|
||||
pub fn init(client: &Arc<Client>, cx: &mut MutableAppContext) {
|
||||
pane::init(cx);
|
||||
menu::init(cx);
|
||||
|
||||
cx.add_global_action(open);
|
||||
cx.add_global_action(move |action: &OpenPaths, cx: &mut MutableAppContext| {
|
||||
open_paths(&action.0.paths, &action.0.app_state, cx).detach();
|
||||
open_paths(&action.paths, &action.app_state, cx).detach();
|
||||
});
|
||||
cx.add_global_action(move |action: &OpenNew, cx: &mut MutableAppContext| {
|
||||
open_new(&action.0, cx)
|
||||
});
|
||||
cx.add_global_action(move |action: &JoinProject, cx: &mut MutableAppContext| {
|
||||
join_project(action.0.project_id, &action.0.app_state, cx).detach();
|
||||
join_project(action.project_id, &action.app_state, cx).detach();
|
||||
});
|
||||
|
||||
cx.add_action(Workspace::toggle_share);
|
||||
|
@ -112,7 +135,6 @@ pub fn init(client: &Arc<Client>, cx: &mut MutableAppContext) {
|
|||
workspace.save_active_item(cx).detach_and_log_err(cx);
|
||||
},
|
||||
);
|
||||
cx.add_action(Workspace::debug_elements);
|
||||
cx.add_action(Workspace::toggle_sidebar_item);
|
||||
cx.add_action(Workspace::toggle_sidebar_item_focus);
|
||||
cx.add_action(|workspace: &mut Workspace, _: &ActivatePreviousPane, cx| {
|
||||
|
@ -121,29 +143,6 @@ pub fn init(client: &Arc<Client>, cx: &mut MutableAppContext) {
|
|||
cx.add_action(|workspace: &mut Workspace, _: &ActivateNextPane, cx| {
|
||||
workspace.activate_next_pane(cx)
|
||||
});
|
||||
cx.add_bindings(vec![
|
||||
Binding::new("ctrl-alt-cmd-f", FollowNextCollaborator, None),
|
||||
Binding::new("cmd-s", Save, None),
|
||||
Binding::new("cmd-alt-i", DebugElements, None),
|
||||
Binding::new("cmd-k cmd-left", ActivatePreviousPane, None),
|
||||
Binding::new("cmd-k cmd-right", ActivateNextPane, None),
|
||||
Binding::new(
|
||||
"cmd-shift-!",
|
||||
ToggleSidebarItem(SidebarItemId {
|
||||
side: Side::Left,
|
||||
item_index: 0,
|
||||
}),
|
||||
None,
|
||||
),
|
||||
Binding::new(
|
||||
"cmd-1",
|
||||
ToggleSidebarItemFocus(SidebarItemId {
|
||||
side: Side::Left,
|
||||
item_index: 0,
|
||||
}),
|
||||
None,
|
||||
),
|
||||
]);
|
||||
|
||||
client.add_view_request_handler(Workspace::handle_follow);
|
||||
client.add_view_message_handler(Workspace::handle_unfollow);
|
||||
|
@ -188,18 +187,6 @@ pub struct AppState {
|
|||
fn(ModelHandle<Project>, &Arc<AppState>, &mut ViewContext<Workspace>) -> Workspace,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct OpenParams {
|
||||
pub paths: Vec<PathBuf>,
|
||||
pub app_state: Arc<AppState>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct JoinProjectParams {
|
||||
pub project_id: u64,
|
||||
pub app_state: Arc<AppState>,
|
||||
}
|
||||
|
||||
pub trait Item: View {
|
||||
fn deactivated(&mut self, _: &mut ViewContext<Self>) {}
|
||||
fn navigate(&mut self, _: Box<dyn Any>, _: &mut ViewContext<Self>) -> bool {
|
||||
|
@ -386,6 +373,11 @@ pub trait ItemHandle: 'static + fmt::Debug {
|
|||
-> Task<Result<()>>;
|
||||
fn act_as_type(&self, type_id: TypeId, cx: &AppContext) -> Option<AnyViewHandle>;
|
||||
fn to_followable_item_handle(&self, cx: &AppContext) -> Option<Box<dyn FollowableItemHandle>>;
|
||||
fn on_release(
|
||||
&self,
|
||||
cx: &mut MutableAppContext,
|
||||
callback: Box<dyn FnOnce(&mut MutableAppContext)>,
|
||||
) -> gpui::Subscription;
|
||||
}
|
||||
|
||||
pub trait WeakItemHandle {
|
||||
|
@ -421,6 +413,12 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
Box::new(self.clone())
|
||||
}
|
||||
|
||||
fn set_nav_history(&self, nav_history: Rc<RefCell<NavHistory>>, cx: &mut MutableAppContext) {
|
||||
self.update(cx, |item, cx| {
|
||||
item.set_nav_history(ItemNavHistory::new(nav_history, &cx.handle()), cx);
|
||||
})
|
||||
}
|
||||
|
||||
fn clone_on_split(&self, cx: &mut MutableAppContext) -> Option<Box<dyn ItemHandle>> {
|
||||
self.update(cx, |item, cx| {
|
||||
cx.add_option_view(|cx| item.clone_on_split(cx))
|
||||
|
@ -428,12 +426,6 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
.map(|handle| Box::new(handle) as Box<dyn ItemHandle>)
|
||||
}
|
||||
|
||||
fn set_nav_history(&self, nav_history: Rc<RefCell<NavHistory>>, cx: &mut MutableAppContext) {
|
||||
self.update(cx, |item, cx| {
|
||||
item.set_nav_history(ItemNavHistory::new(nav_history, &cx.handle()), cx);
|
||||
})
|
||||
}
|
||||
|
||||
fn added_to_pane(
|
||||
&self,
|
||||
workspace: &mut Workspace,
|
||||
|
@ -494,8 +486,7 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
}
|
||||
|
||||
if T::should_close_item_on_event(event) {
|
||||
pane.update(cx, |pane, cx| pane.close_item(item.id(), cx))
|
||||
.detach();
|
||||
Pane::close_item(workspace, pane, item.id(), cx).detach_and_log_err(cx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -523,6 +514,30 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
self.update(cx, |this, cx| this.navigate(data, cx))
|
||||
}
|
||||
|
||||
fn id(&self) -> usize {
|
||||
self.id()
|
||||
}
|
||||
|
||||
fn to_any(&self) -> AnyViewHandle {
|
||||
self.into()
|
||||
}
|
||||
|
||||
fn is_dirty(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).is_dirty(cx)
|
||||
}
|
||||
|
||||
fn has_conflict(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).has_conflict(cx)
|
||||
}
|
||||
|
||||
fn can_save(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).can_save(cx)
|
||||
}
|
||||
|
||||
fn can_save_as(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).can_save_as(cx)
|
||||
}
|
||||
|
||||
fn save(&self, project: ModelHandle<Project>, cx: &mut MutableAppContext) -> Task<Result<()>> {
|
||||
self.update(cx, |item, cx| item.save(project, cx))
|
||||
}
|
||||
|
@ -544,30 +559,6 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
self.update(cx, |item, cx| item.reload(project, cx))
|
||||
}
|
||||
|
||||
fn is_dirty(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).is_dirty(cx)
|
||||
}
|
||||
|
||||
fn has_conflict(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).has_conflict(cx)
|
||||
}
|
||||
|
||||
fn id(&self) -> usize {
|
||||
self.id()
|
||||
}
|
||||
|
||||
fn to_any(&self) -> AnyViewHandle {
|
||||
self.into()
|
||||
}
|
||||
|
||||
fn can_save(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).can_save(cx)
|
||||
}
|
||||
|
||||
fn can_save_as(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).can_save_as(cx)
|
||||
}
|
||||
|
||||
fn act_as_type(&self, type_id: TypeId, cx: &AppContext) -> Option<AnyViewHandle> {
|
||||
self.read(cx).act_as_type(type_id, self, cx)
|
||||
}
|
||||
|
@ -581,6 +572,14 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn on_release(
|
||||
&self,
|
||||
cx: &mut MutableAppContext,
|
||||
callback: Box<dyn FnOnce(&mut MutableAppContext)>,
|
||||
) -> gpui::Subscription {
|
||||
cx.observe_release(self, move |_, cx| callback(cx))
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<AnyViewHandle> for Box<dyn ItemHandle> {
|
||||
|
@ -611,6 +610,7 @@ pub struct WorkspaceParams {
|
|||
pub client: Arc<Client>,
|
||||
pub fs: Arc<dyn Fs>,
|
||||
pub languages: Arc<LanguageRegistry>,
|
||||
pub themes: Arc<ThemeRegistry>,
|
||||
pub user_store: ModelHandle<UserStore>,
|
||||
pub channel_list: ModelHandle<ChannelList>,
|
||||
}
|
||||
|
@ -640,6 +640,7 @@ impl WorkspaceParams {
|
|||
channel_list: cx
|
||||
.add_model(|cx| ChannelList::new(user_store.clone(), client.clone(), cx)),
|
||||
client,
|
||||
themes: ThemeRegistry::new((), cx.font_cache().clone()),
|
||||
fs,
|
||||
languages,
|
||||
user_store,
|
||||
|
@ -658,6 +659,7 @@ impl WorkspaceParams {
|
|||
),
|
||||
client: app_state.client.clone(),
|
||||
fs: app_state.fs.clone(),
|
||||
themes: app_state.themes.clone(),
|
||||
languages: app_state.languages.clone(),
|
||||
user_store: app_state.user_store.clone(),
|
||||
channel_list: app_state.channel_list.clone(),
|
||||
|
@ -675,6 +677,7 @@ pub struct Workspace {
|
|||
user_store: ModelHandle<client::UserStore>,
|
||||
remote_entity_subscription: Option<Subscription>,
|
||||
fs: Arc<dyn Fs>,
|
||||
themes: Arc<ThemeRegistry>,
|
||||
modal: Option<AnyViewHandle>,
|
||||
center: PaneGroup,
|
||||
left_sidebar: Sidebar,
|
||||
|
@ -735,7 +738,7 @@ impl Workspace {
|
|||
})
|
||||
.detach();
|
||||
|
||||
let pane = cx.add_view(|cx| Pane::new(params.project.clone(), cx));
|
||||
let pane = cx.add_view(|cx| Pane::new(cx));
|
||||
let pane_id = pane.id();
|
||||
cx.observe(&pane, move |me, _, cx| {
|
||||
let active_entry = me.active_project_path(cx);
|
||||
|
@ -783,6 +786,7 @@ impl Workspace {
|
|||
remote_entity_subscription: None,
|
||||
user_store: params.user_store.clone(),
|
||||
fs: params.fs.clone(),
|
||||
themes: params.themes.clone(),
|
||||
left_sidebar: Sidebar::new(Side::Left),
|
||||
right_sidebar: Sidebar::new(Side::Right),
|
||||
project: params.project.clone(),
|
||||
|
@ -815,6 +819,10 @@ impl Workspace {
|
|||
&self.project
|
||||
}
|
||||
|
||||
pub fn themes(&self) -> Arc<ThemeRegistry> {
|
||||
self.themes.clone()
|
||||
}
|
||||
|
||||
pub fn worktrees<'a>(
|
||||
&self,
|
||||
cx: &'a AppContext,
|
||||
|
@ -1050,24 +1058,8 @@ impl Workspace {
|
|||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn debug_elements(&mut self, _: &DebugElements, cx: &mut ViewContext<Self>) {
|
||||
match to_string_pretty(&cx.debug_elements()) {
|
||||
Ok(json) => {
|
||||
let kib = json.len() as f32 / 1024.;
|
||||
cx.as_mut().write_to_clipboard(ClipboardItem::new(json));
|
||||
log::info!(
|
||||
"copied {:.1} KiB of element debug JSON to the clipboard",
|
||||
kib
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("error debugging elements: {}", error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn add_pane(&mut self, cx: &mut ViewContext<Self>) -> ViewHandle<Pane> {
|
||||
let pane = cx.add_view(|cx| Pane::new(self.project.clone(), cx));
|
||||
let pane = cx.add_view(|cx| Pane::new(cx));
|
||||
let pane_id = pane.id();
|
||||
cx.observe(&pane, move |me, _, cx| {
|
||||
let active_entry = me.active_project_path(cx);
|
||||
|
@ -2067,7 +2059,8 @@ impl Element for AvatarRibbon {
|
|||
fn dispatch_event(
|
||||
&mut self,
|
||||
_: &gpui::Event,
|
||||
_: gpui::geometry::rect::RectF,
|
||||
_: RectF,
|
||||
_: RectF,
|
||||
_: &mut Self::LayoutState,
|
||||
_: &mut Self::PaintState,
|
||||
_: &mut gpui::EventContext,
|
||||
|
@ -2090,9 +2083,9 @@ impl Element for AvatarRibbon {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for OpenParams {
|
||||
impl std::fmt::Debug for OpenPaths {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("OpenParams")
|
||||
f.debug_struct("OpenPaths")
|
||||
.field("paths", &self.paths)
|
||||
.finish()
|
||||
}
|
||||
|
@ -2107,7 +2100,7 @@ fn open(action: &Open, cx: &mut MutableAppContext) {
|
|||
});
|
||||
cx.spawn(|mut cx| async move {
|
||||
if let Some(paths) = paths.recv().await.flatten() {
|
||||
cx.update(|cx| cx.dispatch_global_action(OpenPaths(OpenParams { paths, app_state })));
|
||||
cx.update(|cx| cx.dispatch_global_action(OpenPaths { paths, app_state }));
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
@ -2119,7 +2112,10 @@ pub fn open_paths(
|
|||
abs_paths: &[PathBuf],
|
||||
app_state: &Arc<AppState>,
|
||||
cx: &mut MutableAppContext,
|
||||
) -> Task<ViewHandle<Workspace>> {
|
||||
) -> Task<(
|
||||
ViewHandle<Workspace>,
|
||||
Vec<Option<Result<Box<dyn ItemHandle>, Arc<anyhow::Error>>>>,
|
||||
)> {
|
||||
log::info!("open paths {:?}", abs_paths);
|
||||
|
||||
// Open paths in existing workspace if possible
|
||||
|
@ -2156,8 +2152,8 @@ pub fn open_paths(
|
|||
|
||||
let task = workspace.update(cx, |workspace, cx| workspace.open_paths(abs_paths, cx));
|
||||
cx.spawn(|_| async move {
|
||||
task.await;
|
||||
workspace
|
||||
let items = task.await;
|
||||
(workspace, items)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue