Prevent languages showing in wrong order first

This commit is contained in:
Conrad Irwin 2023-12-01 21:07:02 -07:00
parent 6a5b5f022d
commit 6426997abb
3 changed files with 5 additions and 38 deletions

View File

@ -5,8 +5,8 @@ use anyhow::anyhow;
use editor::Editor;
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
use gpui::{
actions, Action, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView,
Model, ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView,
actions, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Model,
ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView,
};
use language::{Buffer, LanguageRegistry};
use picker::{Picker, PickerDelegate};
@ -27,8 +27,7 @@ pub struct LanguageSelector {
}
impl LanguageSelector {
fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
dbg!("regsiter");
fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
workspace.register_action(move |workspace, _: &Toggle, cx| {
Self::toggle(workspace, cx);
});
@ -105,16 +104,6 @@ impl LanguageSelectorDelegate {
.enumerate()
.map(|(candidate_id, name)| StringMatchCandidate::new(candidate_id, name))
.collect::<Vec<_>>();
let mut matches = candidates
.iter()
.map(|candidate| StringMatch {
candidate_id: candidate.id,
score: 0.,
positions: Default::default(),
string: candidate.string.clone(),
})
.collect::<Vec<_>>();
matches.sort_unstable_by(|mat1, mat2| mat1.string.cmp(&mat2.string));
Self {
language_selector,
@ -122,7 +111,7 @@ impl LanguageSelectorDelegate {
project,
language_registry,
candidates,
matches,
matches: vec![],
selected_index: 0,
}
}

View File

@ -51,15 +51,6 @@ impl Render for StatusBar {
.child(
h_stack()
.gap_4()
.child(
h_stack().gap_1().child(
// TODO: Language picker
div()
.border()
.border_color(gpui::red())
.child(Button::new("status_buffer_language", "Rust")),
),
)
.child(
h_stack()
.gap_1()
@ -78,16 +69,6 @@ impl Render for StatusBar {
.child(IconButton::new("status-feedback", Icon::Envelope)),
),
)
.child(
// Bottom Dock
h_stack().gap_1().child(
// Terminal
div()
.border()
.border_color(gpui::red())
.child(IconButton::new("status-terminal", Icon::Terminal)),
),
)
.child(
// Right Dock
h_stack()

View File

@ -2164,10 +2164,7 @@ impl Workspace {
cx: &mut ViewContext<Self>,
) {
match event {
pane::Event::AddItem { item } => {
self.handle_pane_focused(pane.clone(), cx);
item.added_to_pane(self, pane, cx);
}
pane::Event::AddItem { item } => item.added_to_pane(self, pane, cx),
pane::Event::Split(direction) => {
self.split_and_clone(pane, *direction, cx);
}