following tests (#3902)
Starting work on the following tests. * The first failure was caused by not properly dropping the references, which is now fixed. * The next failure is caused by a `cx.after_window_update` being changed to `cx.on_next_frame`. This doesn't seem to work (at least in tests), but might also explain the flaky following behavior Max and I observed if there's a timing bug in production too. * * When you are following someone and they move their cursor you should receive two proto messages: UpdateBuffer to move the cursor, and UpdateFollowers to update where you're following. It seems like this could be made a bit less chatty/fragile, but probably out of scope for this. * With that worked around, there's one more failure, but I haven't looked into it yet. (possibly caused by an incorrect fix for the cx one).
This commit is contained in:
@@ -888,6 +888,14 @@ impl Database {
|
||||
.exec(&*tx)
|
||||
.await?;
|
||||
|
||||
follower::Entity::delete_many()
|
||||
.filter(
|
||||
Condition::all()
|
||||
.add(follower::Column::FollowerConnectionId.eq(connection.id as i32)),
|
||||
)
|
||||
.exec(&*tx)
|
||||
.await?;
|
||||
|
||||
// Unshare projects.
|
||||
project::Entity::delete_many()
|
||||
.filter(
|
||||
|
||||
+1777
-1890
File diff suppressed because it is too large
Load Diff
@@ -8131,8 +8131,8 @@ fn assert_selection_ranges(marked_text: &str, view: &mut Editor, cx: &mut ViewCo
|
||||
/// Handle completion request passing a marked string specifying where the completion
|
||||
/// should be triggered from using '|' character, what range should be replaced, and what completions
|
||||
/// should be returned using '<' and '>' to delimit the range
|
||||
pub fn handle_completion_request<'a>(
|
||||
cx: &mut EditorLspTestContext<'a>,
|
||||
pub fn handle_completion_request(
|
||||
cx: &mut EditorLspTestContext,
|
||||
marked_string: &str,
|
||||
completions: Vec<&'static str>,
|
||||
) -> impl Future<Output = ()> {
|
||||
@@ -8177,8 +8177,8 @@ pub fn handle_completion_request<'a>(
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_resolve_completion_request<'a>(
|
||||
cx: &mut EditorLspTestContext<'a>,
|
||||
fn handle_resolve_completion_request(
|
||||
cx: &mut EditorLspTestContext,
|
||||
edits: Option<Vec<(&'static str, &'static str)>>,
|
||||
) -> impl Future<Output = ()> {
|
||||
let edits = edits.map(|edits| {
|
||||
|
||||
@@ -21,19 +21,19 @@ use workspace::{AppState, Workspace, WorkspaceHandle};
|
||||
|
||||
use super::editor_test_context::{AssertionContextManager, EditorTestContext};
|
||||
|
||||
pub struct EditorLspTestContext<'a> {
|
||||
pub cx: EditorTestContext<'a>,
|
||||
pub struct EditorLspTestContext {
|
||||
pub cx: EditorTestContext,
|
||||
pub lsp: lsp::FakeLanguageServer,
|
||||
pub workspace: View<Workspace>,
|
||||
pub buffer_lsp_url: lsp::Url,
|
||||
}
|
||||
|
||||
impl<'a> EditorLspTestContext<'a> {
|
||||
impl EditorLspTestContext {
|
||||
pub async fn new(
|
||||
mut language: Language,
|
||||
capabilities: lsp::ServerCapabilities,
|
||||
cx: &'a mut gpui::TestAppContext,
|
||||
) -> EditorLspTestContext<'a> {
|
||||
cx: &mut gpui::TestAppContext,
|
||||
) -> EditorLspTestContext {
|
||||
let app_state = cx.update(AppState::test);
|
||||
|
||||
cx.update(|cx| {
|
||||
@@ -110,8 +110,8 @@ impl<'a> EditorLspTestContext<'a> {
|
||||
|
||||
pub async fn new_rust(
|
||||
capabilities: lsp::ServerCapabilities,
|
||||
cx: &'a mut gpui::TestAppContext,
|
||||
) -> EditorLspTestContext<'a> {
|
||||
cx: &mut gpui::TestAppContext,
|
||||
) -> EditorLspTestContext {
|
||||
let language = Language::new(
|
||||
LanguageConfig {
|
||||
name: "Rust".into(),
|
||||
@@ -152,8 +152,8 @@ impl<'a> EditorLspTestContext<'a> {
|
||||
|
||||
pub async fn new_typescript(
|
||||
capabilities: lsp::ServerCapabilities,
|
||||
cx: &'a mut gpui::TestAppContext,
|
||||
) -> EditorLspTestContext<'a> {
|
||||
cx: &mut gpui::TestAppContext,
|
||||
) -> EditorLspTestContext {
|
||||
let mut word_characters: HashSet<char> = Default::default();
|
||||
word_characters.insert('$');
|
||||
word_characters.insert('#');
|
||||
@@ -283,15 +283,15 @@ impl<'a> EditorLspTestContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for EditorLspTestContext<'a> {
|
||||
type Target = EditorTestContext<'a>;
|
||||
impl Deref for EditorLspTestContext {
|
||||
type Target = EditorTestContext;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.cx
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for EditorLspTestContext<'a> {
|
||||
impl DerefMut for EditorLspTestContext {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cx
|
||||
}
|
||||
|
||||
@@ -26,15 +26,15 @@ use util::{
|
||||
|
||||
use super::build_editor_with_project;
|
||||
|
||||
pub struct EditorTestContext<'a> {
|
||||
pub cx: gpui::VisualTestContext<'a>,
|
||||
pub struct EditorTestContext {
|
||||
pub cx: gpui::VisualTestContext,
|
||||
pub window: AnyWindowHandle,
|
||||
pub editor: View<Editor>,
|
||||
pub assertion_cx: AssertionContextManager,
|
||||
}
|
||||
|
||||
impl<'a> EditorTestContext<'a> {
|
||||
pub async fn new(cx: &'a mut gpui::TestAppContext) -> EditorTestContext<'a> {
|
||||
impl EditorTestContext {
|
||||
pub async fn new(cx: &mut gpui::TestAppContext) -> EditorTestContext {
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
// fs.insert_file("/file", "".to_owned()).await;
|
||||
fs.insert_tree(
|
||||
@@ -342,7 +342,7 @@ impl<'a> EditorTestContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for EditorTestContext<'a> {
|
||||
impl Deref for EditorTestContext {
|
||||
type Target = gpui::TestAppContext;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -350,7 +350,7 @@ impl<'a> Deref for EditorTestContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for EditorTestContext<'a> {
|
||||
impl DerefMut for EditorTestContext {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cx
|
||||
}
|
||||
|
||||
@@ -1843,7 +1843,7 @@ mod tests {
|
||||
expected_matches: usize,
|
||||
expected_editor_title: &str,
|
||||
workspace: &View<Workspace>,
|
||||
cx: &mut gpui::VisualTestContext<'_>,
|
||||
cx: &mut gpui::VisualTestContext,
|
||||
) -> Vec<FoundPath> {
|
||||
let picker = open_file_picker(&workspace, cx);
|
||||
cx.simulate_input(input);
|
||||
|
||||
@@ -187,6 +187,10 @@ impl TestAppContext {
|
||||
self.test_window(window_handle).simulate_resize(size);
|
||||
}
|
||||
|
||||
pub fn windows(&self) -> Vec<AnyWindowHandle> {
|
||||
self.app.borrow().windows().clone()
|
||||
}
|
||||
|
||||
pub fn spawn<Fut, R>(&self, f: impl FnOnce(AsyncAppContext) -> Fut) -> Task<R>
|
||||
where
|
||||
Fut: Future<Output = R> + 'static,
|
||||
@@ -479,21 +483,24 @@ impl<V> View<V> {
|
||||
}
|
||||
|
||||
use derive_more::{Deref, DerefMut};
|
||||
#[derive(Deref, DerefMut)]
|
||||
pub struct VisualTestContext<'a> {
|
||||
#[derive(Deref, DerefMut, Clone)]
|
||||
pub struct VisualTestContext {
|
||||
#[deref]
|
||||
#[deref_mut]
|
||||
cx: &'a mut TestAppContext,
|
||||
cx: TestAppContext,
|
||||
window: AnyWindowHandle,
|
||||
}
|
||||
|
||||
impl<'a> VisualTestContext<'a> {
|
||||
impl<'a> VisualTestContext {
|
||||
pub fn update<R>(&mut self, f: impl FnOnce(&mut WindowContext) -> R) -> R {
|
||||
self.cx.update_window(self.window, |_, cx| f(cx)).unwrap()
|
||||
}
|
||||
|
||||
pub fn from_window(window: AnyWindowHandle, cx: &'a mut TestAppContext) -> Self {
|
||||
Self { cx, window }
|
||||
pub fn from_window(window: AnyWindowHandle, cx: &TestAppContext) -> Self {
|
||||
Self {
|
||||
cx: cx.clone(),
|
||||
window,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_until_parked(&self) {
|
||||
@@ -527,7 +534,7 @@ impl<'a> VisualTestContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Context for VisualTestContext<'a> {
|
||||
impl Context for VisualTestContext {
|
||||
type Result<T> = <TestAppContext as Context>::Result<T>;
|
||||
|
||||
fn new_model<T: 'static>(
|
||||
@@ -578,7 +585,7 @@ impl<'a> Context for VisualTestContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> VisualContext for VisualTestContext<'a> {
|
||||
impl VisualContext for VisualTestContext {
|
||||
fn new_view<V>(
|
||||
&mut self,
|
||||
build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V,
|
||||
@@ -587,7 +594,7 @@ impl<'a> VisualContext for VisualTestContext<'a> {
|
||||
V: 'static + Render,
|
||||
{
|
||||
self.window
|
||||
.update(self.cx, |_, cx| cx.new_view(build_view))
|
||||
.update(&mut self.cx, |_, cx| cx.new_view(build_view))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
@@ -597,7 +604,7 @@ impl<'a> VisualContext for VisualTestContext<'a> {
|
||||
update: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R,
|
||||
) -> Self::Result<R> {
|
||||
self.window
|
||||
.update(self.cx, |_, cx| cx.update_view(view, update))
|
||||
.update(&mut self.cx, |_, cx| cx.update_view(view, update))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
@@ -609,13 +616,13 @@ impl<'a> VisualContext for VisualTestContext<'a> {
|
||||
V: 'static + Render,
|
||||
{
|
||||
self.window
|
||||
.update(self.cx, |_, cx| cx.replace_root_view(build_view))
|
||||
.update(&mut self.cx, |_, cx| cx.replace_root_view(build_view))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn focus_view<V: crate::FocusableView>(&mut self, view: &View<V>) -> Self::Result<()> {
|
||||
self.window
|
||||
.update(self.cx, |_, cx| {
|
||||
.update(&mut self.cx, |_, cx| {
|
||||
view.read(cx).focus_handle(cx).clone().focus(cx)
|
||||
})
|
||||
.unwrap()
|
||||
@@ -626,7 +633,7 @@ impl<'a> VisualContext for VisualTestContext<'a> {
|
||||
V: crate::ManagedView,
|
||||
{
|
||||
self.window
|
||||
.update(self.cx, |_, cx| {
|
||||
.update(&mut self.cx, |_, cx| {
|
||||
view.update(cx, |_, cx| cx.emit(crate::DismissEvent))
|
||||
})
|
||||
.unwrap()
|
||||
|
||||
@@ -1091,13 +1091,10 @@ mod tests {
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
});
|
||||
}
|
||||
|
||||
fn init_test(
|
||||
cx: &mut TestAppContext,
|
||||
) -> (
|
||||
View<Editor>,
|
||||
View<BufferSearchBar>,
|
||||
&mut VisualTestContext<'_>,
|
||||
) {
|
||||
) -> (View<Editor>, View<BufferSearchBar>, &mut VisualTestContext) {
|
||||
init_globals(cx);
|
||||
let buffer = cx.new_model(|cx| {
|
||||
Buffer::new(
|
||||
|
||||
@@ -217,7 +217,6 @@ impl TerminalPanel {
|
||||
pane::Event::Remove => cx.emit(PanelEvent::Close),
|
||||
pane::Event::ZoomIn => cx.emit(PanelEvent::ZoomIn),
|
||||
pane::Event::ZoomOut => cx.emit(PanelEvent::ZoomOut),
|
||||
pane::Event::Focus => cx.emit(PanelEvent::Focus),
|
||||
|
||||
pane::Event::AddItem { item } => {
|
||||
if let Some(workspace) = self.workspace.upgrade() {
|
||||
|
||||
@@ -4,30 +4,27 @@ use crate::state::Mode;
|
||||
|
||||
use super::{ExemptionFeatures, NeovimBackedTestContext, SUPPORTED_FEATURES};
|
||||
|
||||
pub struct NeovimBackedBindingTestContext<'a, const COUNT: usize> {
|
||||
cx: NeovimBackedTestContext<'a>,
|
||||
pub struct NeovimBackedBindingTestContext<const COUNT: usize> {
|
||||
cx: NeovimBackedTestContext,
|
||||
keystrokes_under_test: [&'static str; COUNT],
|
||||
}
|
||||
|
||||
impl<'a, const COUNT: usize> NeovimBackedBindingTestContext<'a, COUNT> {
|
||||
pub fn new(
|
||||
keystrokes_under_test: [&'static str; COUNT],
|
||||
cx: NeovimBackedTestContext<'a>,
|
||||
) -> Self {
|
||||
impl<const COUNT: usize> NeovimBackedBindingTestContext<COUNT> {
|
||||
pub fn new(keystrokes_under_test: [&'static str; COUNT], cx: NeovimBackedTestContext) -> Self {
|
||||
Self {
|
||||
cx,
|
||||
keystrokes_under_test,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn consume(self) -> NeovimBackedTestContext<'a> {
|
||||
pub fn consume(self) -> NeovimBackedTestContext {
|
||||
self.cx
|
||||
}
|
||||
|
||||
pub fn binding<const NEW_COUNT: usize>(
|
||||
self,
|
||||
keystrokes: [&'static str; NEW_COUNT],
|
||||
) -> NeovimBackedBindingTestContext<'a, NEW_COUNT> {
|
||||
) -> NeovimBackedBindingTestContext<NEW_COUNT> {
|
||||
self.consume().binding(keystrokes)
|
||||
}
|
||||
|
||||
@@ -80,15 +77,15 @@ impl<'a, const COUNT: usize> NeovimBackedBindingTestContext<'a, COUNT> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, const COUNT: usize> Deref for NeovimBackedBindingTestContext<'a, COUNT> {
|
||||
type Target = NeovimBackedTestContext<'a>;
|
||||
impl<const COUNT: usize> Deref for NeovimBackedBindingTestContext<COUNT> {
|
||||
type Target = NeovimBackedTestContext;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.cx
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, const COUNT: usize> DerefMut for NeovimBackedBindingTestContext<'a, COUNT> {
|
||||
impl<const COUNT: usize> DerefMut for NeovimBackedBindingTestContext<COUNT> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cx
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ impl ExemptionFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NeovimBackedTestContext<'a> {
|
||||
cx: VimTestContext<'a>,
|
||||
pub struct NeovimBackedTestContext {
|
||||
cx: VimTestContext,
|
||||
// Lookup for exempted assertions. Keyed by the insertion text, and with a value indicating which
|
||||
// bindings are exempted. If None, all bindings are ignored for that insertion text.
|
||||
exemptions: HashMap<String, Option<HashSet<String>>>,
|
||||
@@ -60,8 +60,8 @@ pub struct NeovimBackedTestContext<'a> {
|
||||
is_dirty: bool,
|
||||
}
|
||||
|
||||
impl<'a> NeovimBackedTestContext<'a> {
|
||||
pub async fn new(cx: &'a mut gpui::TestAppContext) -> NeovimBackedTestContext<'a> {
|
||||
impl NeovimBackedTestContext {
|
||||
pub async fn new(cx: &mut gpui::TestAppContext) -> NeovimBackedTestContext {
|
||||
// rust stores the name of the test on the current thread.
|
||||
// We use this to automatically name a file that will store
|
||||
// the neovim connection's requests/responses so that we can
|
||||
@@ -393,20 +393,20 @@ impl<'a> NeovimBackedTestContext<'a> {
|
||||
pub fn binding<const COUNT: usize>(
|
||||
self,
|
||||
keystrokes: [&'static str; COUNT],
|
||||
) -> NeovimBackedBindingTestContext<'a, COUNT> {
|
||||
) -> NeovimBackedBindingTestContext<COUNT> {
|
||||
NeovimBackedBindingTestContext::new(keystrokes, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for NeovimBackedTestContext<'a> {
|
||||
type Target = VimTestContext<'a>;
|
||||
impl Deref for NeovimBackedTestContext {
|
||||
type Target = VimTestContext;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.cx
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for NeovimBackedTestContext<'a> {
|
||||
impl DerefMut for NeovimBackedTestContext {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cx
|
||||
}
|
||||
@@ -415,7 +415,7 @@ impl<'a> DerefMut for NeovimBackedTestContext<'a> {
|
||||
// a common mistake in tests is to call set_shared_state when
|
||||
// you mean asswert_shared_state. This notices that and lets
|
||||
// you know.
|
||||
impl<'a> Drop for NeovimBackedTestContext<'a> {
|
||||
impl Drop for NeovimBackedTestContext {
|
||||
fn drop(&mut self) {
|
||||
if self.is_dirty {
|
||||
panic!("Test context was dropped after set_shared_state before assert_shared_state")
|
||||
@@ -425,9 +425,8 @@ impl<'a> Drop for NeovimBackedTestContext<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use gpui::TestAppContext;
|
||||
|
||||
use crate::test::NeovimBackedTestContext;
|
||||
use gpui::TestAppContext;
|
||||
|
||||
#[gpui::test]
|
||||
async fn neovim_backed_test_context_works(cx: &mut TestAppContext) {
|
||||
|
||||
@@ -10,11 +10,11 @@ use search::BufferSearchBar;
|
||||
|
||||
use crate::{state::Operator, *};
|
||||
|
||||
pub struct VimTestContext<'a> {
|
||||
cx: EditorLspTestContext<'a>,
|
||||
pub struct VimTestContext {
|
||||
cx: EditorLspTestContext,
|
||||
}
|
||||
|
||||
impl<'a> VimTestContext<'a> {
|
||||
impl VimTestContext {
|
||||
pub fn init(cx: &mut gpui::TestAppContext) {
|
||||
if cx.has_global::<Vim>() {
|
||||
dbg!("OOPS");
|
||||
@@ -29,13 +29,13 @@ impl<'a> VimTestContext<'a> {
|
||||
});
|
||||
}
|
||||
|
||||
pub async fn new(cx: &'a mut gpui::TestAppContext, enabled: bool) -> VimTestContext<'a> {
|
||||
pub async fn new(cx: &mut gpui::TestAppContext, enabled: bool) -> VimTestContext {
|
||||
Self::init(cx);
|
||||
let lsp = EditorLspTestContext::new_rust(Default::default(), cx).await;
|
||||
Self::new_with_lsp(lsp, enabled)
|
||||
}
|
||||
|
||||
pub async fn new_typescript(cx: &'a mut gpui::TestAppContext) -> VimTestContext<'a> {
|
||||
pub async fn new_typescript(cx: &mut gpui::TestAppContext) -> VimTestContext {
|
||||
Self::init(cx);
|
||||
Self::new_with_lsp(
|
||||
EditorLspTestContext::new_typescript(Default::default(), cx).await,
|
||||
@@ -43,7 +43,7 @@ impl<'a> VimTestContext<'a> {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_with_lsp(mut cx: EditorLspTestContext<'a>, enabled: bool) -> VimTestContext<'a> {
|
||||
pub fn new_with_lsp(mut cx: EditorLspTestContext, enabled: bool) -> VimTestContext {
|
||||
cx.update(|cx| {
|
||||
cx.update_global(|store: &mut SettingsStore, cx| {
|
||||
store.update_user_settings::<VimModeSetting>(cx, |s| *s = Some(enabled));
|
||||
@@ -162,15 +162,15 @@ impl<'a> VimTestContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for VimTestContext<'a> {
|
||||
type Target = EditorTestContext<'a>;
|
||||
impl Deref for VimTestContext {
|
||||
type Target = EditorTestContext;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.cx
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> DerefMut for VimTestContext<'a> {
|
||||
impl DerefMut for VimTestContext {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.cx
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ pub enum PanelEvent {
|
||||
ZoomOut,
|
||||
Activate,
|
||||
Close,
|
||||
Focus,
|
||||
}
|
||||
|
||||
pub trait Panel: FocusableView + EventEmitter<PanelEvent> {
|
||||
@@ -216,6 +215,28 @@ impl Dock {
|
||||
}
|
||||
});
|
||||
|
||||
cx.on_focus_in(&focus_handle, {
|
||||
let dock = dock.downgrade();
|
||||
move |workspace, cx| {
|
||||
let Some(dock) = dock.upgrade() else {
|
||||
return;
|
||||
};
|
||||
let Some(panel) = dock.read(cx).active_panel() else {
|
||||
return;
|
||||
};
|
||||
if panel.is_zoomed(cx) {
|
||||
workspace.zoomed = Some(panel.to_any().downgrade().into());
|
||||
workspace.zoomed_position = Some(position);
|
||||
} else {
|
||||
workspace.zoomed = None;
|
||||
workspace.zoomed_position = None;
|
||||
}
|
||||
workspace.dismiss_zoomed_items_to_reveal(Some(position), cx);
|
||||
workspace.update_active_view_for_followers(cx)
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
cx.observe(&dock, move |workspace, dock, cx| {
|
||||
if dock.read(cx).is_open() {
|
||||
if let Some(panel) = dock.read(cx).active_panel() {
|
||||
@@ -394,7 +415,6 @@ impl Dock {
|
||||
this.set_open(false, cx);
|
||||
}
|
||||
}
|
||||
PanelEvent::Focus => {}
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -561,6 +581,7 @@ impl Render for Dock {
|
||||
}
|
||||
|
||||
div()
|
||||
.track_focus(&self.focus_handle)
|
||||
.flex()
|
||||
.bg(cx.theme().colors().panel_background)
|
||||
.border_color(cx.theme().colors().border)
|
||||
@@ -584,7 +605,7 @@ impl Render for Dock {
|
||||
)
|
||||
.child(handle)
|
||||
} else {
|
||||
div()
|
||||
div().track_focus(&self.focus_handle)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,7 +745,7 @@ pub mod test {
|
||||
|
||||
impl Render for TestPanel {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
div()
|
||||
div().id("test").track_focus(&self.focus_handle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -442,7 +442,7 @@ impl<T: Item> ItemHandle for View<T> {
|
||||
) && !pending_update_scheduled.load(Ordering::SeqCst)
|
||||
{
|
||||
pending_update_scheduled.store(true, Ordering::SeqCst);
|
||||
cx.on_next_frame({
|
||||
cx.defer({
|
||||
let pending_update = pending_update.clone();
|
||||
let pending_update_scheduled = pending_update_scheduled.clone();
|
||||
move |this, cx| {
|
||||
|
||||
@@ -2457,11 +2457,11 @@ impl Workspace {
|
||||
Some(leader_id)
|
||||
}
|
||||
|
||||
// pub fn is_being_followed(&self, peer_id: PeerId) -> bool {
|
||||
// self.follower_states
|
||||
// .values()
|
||||
// .any(|state| state.leader_id == peer_id)
|
||||
// }
|
||||
pub fn is_being_followed(&self, peer_id: PeerId) -> bool {
|
||||
self.follower_states
|
||||
.values()
|
||||
.any(|state| state.leader_id == peer_id)
|
||||
}
|
||||
|
||||
fn active_item_path_changed(&mut self, cx: &mut ViewContext<Self>) {
|
||||
let active_entry = self.active_project_path(cx);
|
||||
|
||||
Reference in New Issue
Block a user