Fix most of the warnings
This commit is contained in:
parent
5666e8301e
commit
7394bf1cdc
13 changed files with 44 additions and 61 deletions
|
@ -332,7 +332,6 @@ impl ContextMenu {
|
||||||
&self,
|
&self,
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> impl Drawable<ContextMenu> {
|
) -> impl Drawable<ContextMenu> {
|
||||||
let window_id = cx.window_id();
|
|
||||||
let style = cx.global::<Settings>().theme.context_menu.clone();
|
let style = cx.global::<Settings>().theme.context_menu.clone();
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(
|
.with_child(
|
||||||
|
@ -390,7 +389,6 @@ impl ContextMenu {
|
||||||
};
|
};
|
||||||
|
|
||||||
KeystrokeLabel::new(
|
KeystrokeLabel::new(
|
||||||
window_id,
|
|
||||||
view_id,
|
view_id,
|
||||||
action.boxed_clone(),
|
action.boxed_clone(),
|
||||||
style.keystroke.container,
|
style.keystroke.container,
|
||||||
|
@ -424,7 +422,6 @@ impl ContextMenu {
|
||||||
|
|
||||||
let style = cx.global::<Settings>().theme.context_menu.clone();
|
let style = cx.global::<Settings>().theme.context_menu.clone();
|
||||||
|
|
||||||
let window_id = cx.window_id();
|
|
||||||
MouseEventHandler::<Menu, ContextMenu>::new(0, cx, |_, cx| {
|
MouseEventHandler::<Menu, ContextMenu>::new(0, cx, |_, cx| {
|
||||||
Flex::column()
|
Flex::column()
|
||||||
.with_children(self.items.iter().enumerate().map(|(ix, item)| {
|
.with_children(self.items.iter().enumerate().map(|(ix, item)| {
|
||||||
|
@ -456,7 +453,6 @@ impl ContextMenu {
|
||||||
})
|
})
|
||||||
.with_child({
|
.with_child({
|
||||||
KeystrokeLabel::new(
|
KeystrokeLabel::new(
|
||||||
window_id,
|
|
||||||
view_id,
|
view_id,
|
||||||
action.boxed_clone(),
|
action.boxed_clone(),
|
||||||
style.keystroke.container,
|
style.keystroke.container,
|
||||||
|
|
|
@ -1901,8 +1901,8 @@ impl Drawable<Editor> for EditorElement {
|
||||||
|
|
||||||
let mut context_menu = None;
|
let mut context_menu = None;
|
||||||
let mut code_actions_indicator = None;
|
let mut code_actions_indicator = None;
|
||||||
let mut hover = None;
|
let mut hover;
|
||||||
let mut mode = EditorMode::Full;
|
let mode;
|
||||||
let mut fold_indicators = {
|
let mut fold_indicators = {
|
||||||
let newest_selection_head = editor
|
let newest_selection_head = editor
|
||||||
.selections
|
.selections
|
||||||
|
@ -2560,7 +2560,7 @@ mod tests {
|
||||||
fn test_layout_line_numbers(cx: &mut gpui::AppContext) {
|
fn test_layout_line_numbers(cx: &mut gpui::AppContext) {
|
||||||
cx.set_global(Settings::test(cx));
|
cx.set_global(Settings::test(cx));
|
||||||
let buffer = MultiBuffer::build_simple(&sample_text(6, 6, 'a'), cx);
|
let buffer = MultiBuffer::build_simple(&sample_text(6, 6, 'a'), cx);
|
||||||
let (window_id, editor) = cx.add_window(Default::default(), |cx| {
|
let (_, editor) = cx.add_window(Default::default(), |cx| {
|
||||||
Editor::new(EditorMode::Full, buffer, None, None, cx)
|
Editor::new(EditorMode::Full, buffer, None, None, cx)
|
||||||
});
|
});
|
||||||
let element = EditorElement::new(editor.downgrade(), editor.read(cx).style(cx));
|
let element = EditorElement::new(editor.downgrade(), editor.read(cx).style(cx));
|
||||||
|
@ -2578,7 +2578,7 @@ mod tests {
|
||||||
fn test_layout_with_placeholder_text_and_blocks(cx: &mut gpui::AppContext) {
|
fn test_layout_with_placeholder_text_and_blocks(cx: &mut gpui::AppContext) {
|
||||||
cx.set_global(Settings::test(cx));
|
cx.set_global(Settings::test(cx));
|
||||||
let buffer = MultiBuffer::build_simple("", cx);
|
let buffer = MultiBuffer::build_simple("", cx);
|
||||||
let (window_id, editor) = cx.add_window(Default::default(), |cx| {
|
let (_, editor) = cx.add_window(Default::default(), |cx| {
|
||||||
Editor::new(EditorMode::Full, buffer, None, None, cx)
|
Editor::new(EditorMode::Full, buffer, None, None, cx)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -586,9 +586,9 @@ impl<V: View, R: View> Drawable<V> for RootElement<R> {
|
||||||
fn layout(
|
fn layout(
|
||||||
&mut self,
|
&mut self,
|
||||||
constraint: SizeConstraint,
|
constraint: SizeConstraint,
|
||||||
view: &mut V,
|
_view: &mut V,
|
||||||
cx: &mut ViewContext<V>,
|
cx: &mut ViewContext<V>,
|
||||||
) -> (Vector2F, Self::LayoutState) {
|
) -> (Vector2F, ()) {
|
||||||
let size = AnyRootElement::layout(self, constraint, cx)
|
let size = AnyRootElement::layout(self, constraint, cx)
|
||||||
.log_err()
|
.log_err()
|
||||||
.unwrap_or_else(|| Vector2F::zero());
|
.unwrap_or_else(|| Vector2F::zero());
|
||||||
|
@ -600,35 +600,39 @@ impl<V: View, R: View> Drawable<V> for RootElement<R> {
|
||||||
scene: &mut SceneBuilder,
|
scene: &mut SceneBuilder,
|
||||||
bounds: RectF,
|
bounds: RectF,
|
||||||
visible_bounds: RectF,
|
visible_bounds: RectF,
|
||||||
layout: &mut Self::LayoutState,
|
_layout: &mut Self::LayoutState,
|
||||||
view: &mut V,
|
_view: &mut V,
|
||||||
cx: &mut ViewContext<V>,
|
cx: &mut ViewContext<V>,
|
||||||
) -> Self::PaintState {
|
) {
|
||||||
todo!()
|
AnyRootElement::paint(self, scene, bounds.origin(), visible_bounds, cx).log_err();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rect_for_text_range(
|
fn rect_for_text_range(
|
||||||
&self,
|
&self,
|
||||||
range_utf16: Range<usize>,
|
range_utf16: Range<usize>,
|
||||||
bounds: RectF,
|
_bounds: RectF,
|
||||||
visible_bounds: RectF,
|
_visible_bounds: RectF,
|
||||||
layout: &Self::LayoutState,
|
_layout: &Self::LayoutState,
|
||||||
paint: &Self::PaintState,
|
_paint: &Self::PaintState,
|
||||||
view: &V,
|
_view: &V,
|
||||||
cx: &ViewContext<V>,
|
cx: &ViewContext<V>,
|
||||||
) -> Option<RectF> {
|
) -> Option<RectF> {
|
||||||
todo!()
|
AnyRootElement::rect_for_text_range(self, range_utf16, cx)
|
||||||
|
.log_err()
|
||||||
|
.flatten()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug(
|
fn debug(
|
||||||
&self,
|
&self,
|
||||||
bounds: RectF,
|
_bounds: RectF,
|
||||||
layout: &Self::LayoutState,
|
_layout: &Self::LayoutState,
|
||||||
paint: &Self::PaintState,
|
_paint: &Self::PaintState,
|
||||||
view: &V,
|
_view: &V,
|
||||||
cx: &ViewContext<V>,
|
cx: &ViewContext<V>,
|
||||||
) -> serde_json::Value {
|
) -> serde_json::Value {
|
||||||
todo!()
|
AnyRootElement::debug(self, cx)
|
||||||
|
.log_err()
|
||||||
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,20 +12,17 @@ pub struct KeystrokeLabel {
|
||||||
action: Box<dyn Action>,
|
action: Box<dyn Action>,
|
||||||
container_style: ContainerStyle,
|
container_style: ContainerStyle,
|
||||||
text_style: TextStyle,
|
text_style: TextStyle,
|
||||||
window_id: usize,
|
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeystrokeLabel {
|
impl KeystrokeLabel {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window_id: usize,
|
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
action: Box<dyn Action>,
|
action: Box<dyn Action>,
|
||||||
container_style: ContainerStyle,
|
container_style: ContainerStyle,
|
||||||
text_style: TextStyle,
|
text_style: TextStyle,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
window_id,
|
|
||||||
view_id,
|
view_id,
|
||||||
action,
|
action,
|
||||||
container_style,
|
container_style,
|
||||||
|
|
|
@ -280,7 +280,7 @@ mod tests {
|
||||||
|
|
||||||
#[crate::test(self)]
|
#[crate::test(self)]
|
||||||
fn test_soft_wrapping_with_carriage_returns(cx: &mut AppContext) {
|
fn test_soft_wrapping_with_carriage_returns(cx: &mut AppContext) {
|
||||||
let (window_id, root_view) = cx.add_window(Default::default(), |_| TestView);
|
let (_, root_view) = cx.add_window(Default::default(), |_| TestView);
|
||||||
fonts::with_font_cache(cx.font_cache().clone(), || {
|
fonts::with_font_cache(cx.font_cache().clone(), || {
|
||||||
root_view.update(cx, |view, cx| {
|
root_view.update(cx, |view, cx| {
|
||||||
let mut text = Text::new("Hello\r\n", Default::default()).with_soft_wrap(true);
|
let mut text = Text::new("Hello\r\n", Default::default()).with_soft_wrap(true);
|
||||||
|
|
|
@ -65,7 +65,6 @@ impl<V: View> Tooltip<V> {
|
||||||
let state = state_handle.read(cx).clone();
|
let state = state_handle.read(cx).clone();
|
||||||
let tooltip = if state.visible.get() {
|
let tooltip = if state.visible.get() {
|
||||||
let mut collapsed_tooltip = Self::render_tooltip(
|
let mut collapsed_tooltip = Self::render_tooltip(
|
||||||
cx.window_id,
|
|
||||||
focused_view_id,
|
focused_view_id,
|
||||||
text.clone(),
|
text.clone(),
|
||||||
style.clone(),
|
style.clone(),
|
||||||
|
@ -75,7 +74,7 @@ impl<V: View> Tooltip<V> {
|
||||||
.boxed();
|
.boxed();
|
||||||
Some(
|
Some(
|
||||||
Overlay::new(
|
Overlay::new(
|
||||||
Self::render_tooltip(cx.window_id, focused_view_id, text, style, action, false)
|
Self::render_tooltip(focused_view_id, text, style, action, false)
|
||||||
.constrained()
|
.constrained()
|
||||||
.dynamically(move |constraint, view, cx| {
|
.dynamically(move |constraint, view, cx| {
|
||||||
SizeConstraint::strict_along(
|
SizeConstraint::strict_along(
|
||||||
|
@ -128,7 +127,6 @@ impl<V: View> Tooltip<V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render_tooltip(
|
pub fn render_tooltip(
|
||||||
window_id: usize,
|
|
||||||
focused_view_id: Option<usize>,
|
focused_view_id: Option<usize>,
|
||||||
text: String,
|
text: String,
|
||||||
style: TooltipStyle,
|
style: TooltipStyle,
|
||||||
|
@ -148,7 +146,6 @@ impl<V: View> Tooltip<V> {
|
||||||
})
|
})
|
||||||
.with_children(action.and_then(|action| {
|
.with_children(action.and_then(|action| {
|
||||||
let keystroke_label = KeystrokeLabel::new(
|
let keystroke_label = KeystrokeLabel::new(
|
||||||
window_id,
|
|
||||||
focused_view_id?,
|
focused_view_id?,
|
||||||
action,
|
action,
|
||||||
style.keystroke.container,
|
style.keystroke.container,
|
||||||
|
|
|
@ -48,7 +48,7 @@ pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||||
async move {
|
async move {
|
||||||
let (journal_dir, entry_path) = create_entry.await?;
|
let (journal_dir, entry_path) = create_entry.await?;
|
||||||
let (workspace, _) = cx
|
let (workspace, _) = cx
|
||||||
.update(|cx| workspace::open_paths(&[journal_dir], &app_state, None, cx))
|
.update(|cx| workspace::open_paths(&[journal_dir], &app_state, cx))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let opened = workspace
|
let opened = workspace
|
||||||
|
|
|
@ -88,7 +88,7 @@ impl LayoutCell {
|
||||||
origin: Vector2F,
|
origin: Vector2F,
|
||||||
layout: &LayoutState,
|
layout: &LayoutState,
|
||||||
visible_bounds: RectF,
|
visible_bounds: RectF,
|
||||||
view: &mut TerminalView,
|
_view: &mut TerminalView,
|
||||||
cx: &mut ViewContext<TerminalView>,
|
cx: &mut ViewContext<TerminalView>,
|
||||||
) {
|
) {
|
||||||
let pos = {
|
let pos = {
|
||||||
|
@ -133,8 +133,8 @@ impl LayoutRect {
|
||||||
scene: &mut SceneBuilder,
|
scene: &mut SceneBuilder,
|
||||||
origin: Vector2F,
|
origin: Vector2F,
|
||||||
layout: &LayoutState,
|
layout: &LayoutState,
|
||||||
view: &mut TerminalView,
|
_view: &mut TerminalView,
|
||||||
cx: &mut ViewContext<TerminalView>,
|
_cx: &mut ViewContext<TerminalView>,
|
||||||
) {
|
) {
|
||||||
let position = {
|
let position = {
|
||||||
let point = self.point;
|
let point = self.point;
|
||||||
|
@ -390,7 +390,7 @@ impl TerminalElement {
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
visible_bounds: RectF,
|
visible_bounds: RectF,
|
||||||
mode: TermMode,
|
mode: TermMode,
|
||||||
cx: &mut ViewContext<TerminalView>,
|
_cx: &mut ViewContext<TerminalView>,
|
||||||
) {
|
) {
|
||||||
let connection = self.terminal;
|
let connection = self.terminal;
|
||||||
|
|
||||||
|
@ -597,7 +597,6 @@ impl Drawable<TerminalView> for TerminalElement {
|
||||||
terminal.last_content.last_hovered_hyperlink.clone()
|
terminal.last_content.last_hovered_hyperlink.clone()
|
||||||
});
|
});
|
||||||
|
|
||||||
let view_handle = self.view.clone();
|
|
||||||
let hyperlink_tooltip = last_hovered_hyperlink.map(|(uri, _, id)| {
|
let hyperlink_tooltip = last_hovered_hyperlink.map(|(uri, _, id)| {
|
||||||
let mut tooltip = Overlay::new(
|
let mut tooltip = Overlay::new(
|
||||||
Empty::new()
|
Empty::new()
|
||||||
|
|
|
@ -12,7 +12,7 @@ use context_menu::{ContextMenu, ContextMenuItem};
|
||||||
use dirs::home_dir;
|
use dirs::home_dir;
|
||||||
use gpui::{
|
use gpui::{
|
||||||
actions,
|
actions,
|
||||||
elements::{AnchorCorner, ChildView, Flex, Label, ParentElement, Stack, Text},
|
elements::{AnchorCorner, ChildView, Flex, Label, ParentElement, Stack},
|
||||||
geometry::vector::Vector2F,
|
geometry::vector::Vector2F,
|
||||||
impl_actions, impl_internal_actions,
|
impl_actions, impl_internal_actions,
|
||||||
keymap_matcher::{KeymapContext, Keystroke},
|
keymap_matcher::{KeymapContext, Keystroke},
|
||||||
|
|
|
@ -135,7 +135,6 @@ pub fn keystroke_label<V: View>(
|
||||||
// FIXME: Put the theme in it's own global so we can
|
// FIXME: Put the theme in it's own global so we can
|
||||||
// query the keystroke style on our own
|
// query the keystroke style on our own
|
||||||
keystroke_label_for(
|
keystroke_label_for(
|
||||||
cx.window_id(),
|
|
||||||
cx.handle().id(),
|
cx.handle().id(),
|
||||||
label_text,
|
label_text,
|
||||||
label_style,
|
label_style,
|
||||||
|
@ -145,7 +144,6 @@ pub fn keystroke_label<V: View>(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn keystroke_label_for<V: View>(
|
pub fn keystroke_label_for<V: View>(
|
||||||
window_id: usize,
|
|
||||||
view_id: usize,
|
view_id: usize,
|
||||||
label_text: &'static str,
|
label_text: &'static str,
|
||||||
label_style: &ContainedText,
|
label_style: &ContainedText,
|
||||||
|
@ -160,7 +158,6 @@ pub fn keystroke_label_for<V: View>(
|
||||||
)
|
)
|
||||||
.with_child({
|
.with_child({
|
||||||
KeystrokeLabel::new(
|
KeystrokeLabel::new(
|
||||||
window_id,
|
|
||||||
view_id,
|
view_id,
|
||||||
action,
|
action,
|
||||||
keystroke_style.container,
|
keystroke_style.container,
|
||||||
|
|
|
@ -286,7 +286,7 @@ pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||||
let app_state = Arc::downgrade(&app_state);
|
let app_state = Arc::downgrade(&app_state);
|
||||||
move |action: &OpenPaths, cx: &mut AppContext| {
|
move |action: &OpenPaths, cx: &mut AppContext| {
|
||||||
if let Some(app_state) = app_state.upgrade() {
|
if let Some(app_state) = app_state.upgrade() {
|
||||||
open_paths(&action.paths, &app_state, None, cx).detach();
|
open_paths(&action.paths, &app_state, cx).detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -299,14 +299,13 @@ pub fn init(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let app_state = app_state.upgrade()?;
|
let app_state = app_state.upgrade()?;
|
||||||
let window_id = cx.window_id();
|
|
||||||
let action = action.clone();
|
let action = action.clone();
|
||||||
let close = workspace.prepare_to_close(false, cx);
|
let close = workspace.prepare_to_close(false, cx);
|
||||||
|
|
||||||
Some(cx.spawn_weak(|_, mut cx| async move {
|
Some(cx.spawn_weak(|_, mut cx| async move {
|
||||||
let can_close = close.await?;
|
let can_close = close.await?;
|
||||||
if can_close {
|
if can_close {
|
||||||
cx.update(|cx| open_paths(&action.paths, &app_state, Some(window_id), cx))
|
cx.update(|cx| open_paths(&action.paths, &app_state, cx))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -857,7 +856,6 @@ impl Workspace {
|
||||||
fn new_local(
|
fn new_local(
|
||||||
abs_paths: Vec<PathBuf>,
|
abs_paths: Vec<PathBuf>,
|
||||||
app_state: Arc<AppState>,
|
app_state: Arc<AppState>,
|
||||||
requesting_window_id: Option<usize>,
|
|
||||||
cx: &mut AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Task<(
|
) -> Task<(
|
||||||
ViewHandle<Workspace>,
|
ViewHandle<Workspace>,
|
||||||
|
@ -1059,7 +1057,7 @@ impl Workspace {
|
||||||
if self.project.read(cx).is_local() {
|
if self.project.read(cx).is_local() {
|
||||||
Task::Ready(Some(callback(self, cx)))
|
Task::Ready(Some(callback(self, cx)))
|
||||||
} else {
|
} else {
|
||||||
let task = Self::new_local(Vec::new(), app_state.clone(), None, cx);
|
let task = Self::new_local(Vec::new(), app_state.clone(), cx);
|
||||||
cx.spawn(|_vh, mut cx| async move {
|
cx.spawn(|_vh, mut cx| async move {
|
||||||
let (workspace, _) = task.await;
|
let (workspace, _) = task.await;
|
||||||
workspace.update(&mut cx, callback)
|
workspace.update(&mut cx, callback)
|
||||||
|
@ -3027,7 +3025,6 @@ pub async fn last_opened_workspace_paths() -> Option<WorkspaceLocation> {
|
||||||
pub fn open_paths(
|
pub fn open_paths(
|
||||||
abs_paths: &[PathBuf],
|
abs_paths: &[PathBuf],
|
||||||
app_state: &Arc<AppState>,
|
app_state: &Arc<AppState>,
|
||||||
requesting_window_id: Option<usize>,
|
|
||||||
cx: &mut AppContext,
|
cx: &mut AppContext,
|
||||||
) -> Task<(
|
) -> Task<(
|
||||||
ViewHandle<Workspace>,
|
ViewHandle<Workspace>,
|
||||||
|
@ -3058,8 +3055,7 @@ pub fn open_paths(
|
||||||
.contains(&false);
|
.contains(&false);
|
||||||
|
|
||||||
cx.update(|cx| {
|
cx.update(|cx| {
|
||||||
let task =
|
let task = Workspace::new_local(abs_paths, app_state.clone(), cx);
|
||||||
Workspace::new_local(abs_paths, app_state.clone(), requesting_window_id, cx);
|
|
||||||
|
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
let (workspace, items) = task.await;
|
let (workspace, items) = task.await;
|
||||||
|
@ -3083,7 +3079,7 @@ pub fn open_new(
|
||||||
cx: &mut AppContext,
|
cx: &mut AppContext,
|
||||||
init: impl FnOnce(&mut Workspace, &mut ViewContext<Workspace>) + 'static,
|
init: impl FnOnce(&mut Workspace, &mut ViewContext<Workspace>) + 'static,
|
||||||
) -> Task<()> {
|
) -> Task<()> {
|
||||||
let task = Workspace::new_local(Vec::new(), app_state.clone(), None, cx);
|
let task = Workspace::new_local(Vec::new(), app_state.clone(), cx);
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
let (workspace, opened_paths) = task.await;
|
let (workspace, opened_paths) = task.await;
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ fn main() {
|
||||||
cx.spawn(|cx| handle_cli_connection(connection, app_state.clone(), cx))
|
cx.spawn(|cx| handle_cli_connection(connection, app_state.clone(), cx))
|
||||||
.detach();
|
.detach();
|
||||||
} else if let Ok(Some(paths)) = open_paths_rx.try_next() {
|
} else if let Ok(Some(paths)) = open_paths_rx.try_next() {
|
||||||
cx.update(|cx| workspace::open_paths(&paths, &app_state, None, cx))
|
cx.update(|cx| workspace::open_paths(&paths, &app_state, cx))
|
||||||
.detach();
|
.detach();
|
||||||
} else {
|
} else {
|
||||||
cx.spawn({
|
cx.spawn({
|
||||||
|
@ -243,7 +243,7 @@ fn main() {
|
||||||
let app_state = app_state.clone();
|
let app_state = app_state.clone();
|
||||||
async move {
|
async move {
|
||||||
while let Some(paths) = open_paths_rx.next().await {
|
while let Some(paths) = open_paths_rx.next().await {
|
||||||
cx.update(|cx| workspace::open_paths(&paths, &app_state, None, cx))
|
cx.update(|cx| workspace::open_paths(&paths, &app_state, cx))
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ async fn handle_cli_connection(
|
||||||
paths
|
paths
|
||||||
};
|
};
|
||||||
let (workspace, items) = cx
|
let (workspace, items) = cx
|
||||||
.update(|cx| workspace::open_paths(&paths, &app_state, None, cx))
|
.update(|cx| workspace::open_paths(&paths, &app_state, cx))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let mut errored = false;
|
let mut errored = false;
|
||||||
|
|
|
@ -703,14 +703,13 @@ mod tests {
|
||||||
open_paths(
|
open_paths(
|
||||||
&[PathBuf::from("/root/a"), PathBuf::from("/root/b")],
|
&[PathBuf::from("/root/a"), PathBuf::from("/root/b")],
|
||||||
&app_state,
|
&app_state,
|
||||||
None,
|
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
assert_eq!(cx.window_ids().len(), 1);
|
assert_eq!(cx.window_ids().len(), 1);
|
||||||
|
|
||||||
cx.update(|cx| open_paths(&[PathBuf::from("/root/a")], &app_state, None, cx))
|
cx.update(|cx| open_paths(&[PathBuf::from("/root/a")], &app_state, cx))
|
||||||
.await;
|
.await;
|
||||||
assert_eq!(cx.window_ids().len(), 1);
|
assert_eq!(cx.window_ids().len(), 1);
|
||||||
let workspace_1 = cx
|
let workspace_1 = cx
|
||||||
|
@ -728,7 +727,6 @@ mod tests {
|
||||||
open_paths(
|
open_paths(
|
||||||
&[PathBuf::from("/root/b"), PathBuf::from("/root/c")],
|
&[PathBuf::from("/root/b"), PathBuf::from("/root/c")],
|
||||||
&app_state,
|
&app_state,
|
||||||
None,
|
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -741,7 +739,6 @@ mod tests {
|
||||||
open_paths(
|
open_paths(
|
||||||
&[PathBuf::from("/root/c"), PathBuf::from("/root/d")],
|
&[PathBuf::from("/root/c"), PathBuf::from("/root/d")],
|
||||||
&app_state,
|
&app_state,
|
||||||
Some(window_id),
|
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -771,7 +768,7 @@ mod tests {
|
||||||
.insert_tree("/root", json!({"a": "hey"}))
|
.insert_tree("/root", json!({"a": "hey"}))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
cx.update(|cx| open_paths(&[PathBuf::from("/root/a")], &app_state, None, cx))
|
cx.update(|cx| open_paths(&[PathBuf::from("/root/a")], &app_state, cx))
|
||||||
.await;
|
.await;
|
||||||
assert_eq!(cx.window_ids().len(), 1);
|
assert_eq!(cx.window_ids().len(), 1);
|
||||||
|
|
||||||
|
@ -813,7 +810,7 @@ mod tests {
|
||||||
assert!(!cx.is_window_edited(workspace.window_id()));
|
assert!(!cx.is_window_edited(workspace.window_id()));
|
||||||
|
|
||||||
// Opening the buffer again doesn't impact the window's edited state.
|
// Opening the buffer again doesn't impact the window's edited state.
|
||||||
cx.update(|cx| open_paths(&[PathBuf::from("/root/a")], &app_state, None, cx))
|
cx.update(|cx| open_paths(&[PathBuf::from("/root/a")], &app_state, cx))
|
||||||
.await;
|
.await;
|
||||||
let editor = workspace.read_with(cx, |workspace, cx| {
|
let editor = workspace.read_with(cx, |workspace, cx| {
|
||||||
workspace
|
workspace
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue