mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Remove #[allow(unused)] annotations in zed2 crates (#3798)
Release Notes: - N/A
This commit is contained in:
parent
6c21683ed0
commit
904358263c
@ -1,11 +1,10 @@
|
||||
#![allow(unused)]
|
||||
use anyhow::Result;
|
||||
use copilot::{Copilot, SignOut, Status};
|
||||
use editor::{scroll::autoscroll::Autoscroll, Editor};
|
||||
use fs::Fs;
|
||||
use gpui::{
|
||||
div, Action, AnchorCorner, AppContext, AsyncAppContext, AsyncWindowContext, Div, Entity,
|
||||
ParentElement, Render, Subscription, View, ViewContext, WeakView, WindowContext,
|
||||
div, Action, AnchorCorner, AppContext, AsyncWindowContext, Div, Entity, ParentElement, Render,
|
||||
Subscription, View, ViewContext, WeakView, WindowContext,
|
||||
};
|
||||
use language::{
|
||||
language_settings::{self, all_language_settings, AllLanguageSettings},
|
||||
@ -17,10 +16,7 @@ use util::{paths, ResultExt};
|
||||
use workspace::{
|
||||
create_and_open_local_file,
|
||||
item::ItemHandle,
|
||||
ui::{
|
||||
popover_menu, ButtonCommon, Clickable, ContextMenu, Icon, IconButton, IconSize,
|
||||
PopoverMenu, Tooltip,
|
||||
},
|
||||
ui::{popover_menu, ButtonCommon, Clickable, ContextMenu, Icon, IconButton, IconSize, Tooltip},
|
||||
StatusItemView, Toast, Workspace,
|
||||
};
|
||||
use zed_actions::OpenBrowser;
|
||||
@ -71,27 +67,31 @@ impl Render for CopilotButton {
|
||||
return div().child(
|
||||
IconButton::new("copilot-error", icon)
|
||||
.icon_size(IconSize::Small)
|
||||
.on_click(cx.listener(move |this, _, cx| {
|
||||
.on_click(cx.listener(move |_, _, cx| {
|
||||
if let Some(workspace) = cx.window_handle().downcast::<Workspace>() {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace.show_toast(
|
||||
Toast::new(
|
||||
COPILOT_ERROR_TOAST_ID,
|
||||
format!("Copilot can't be started: {}", e),
|
||||
)
|
||||
.on_click(
|
||||
"Reinstall Copilot",
|
||||
|cx| {
|
||||
if let Some(copilot) = Copilot::global(cx) {
|
||||
copilot
|
||||
.update(cx, |copilot, cx| copilot.reinstall(cx))
|
||||
.detach();
|
||||
}
|
||||
},
|
||||
),
|
||||
cx,
|
||||
);
|
||||
});
|
||||
workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
workspace.show_toast(
|
||||
Toast::new(
|
||||
COPILOT_ERROR_TOAST_ID,
|
||||
format!("Copilot can't be started: {}", e),
|
||||
)
|
||||
.on_click(
|
||||
"Reinstall Copilot",
|
||||
|cx| {
|
||||
if let Some(copilot) = Copilot::global(cx) {
|
||||
copilot
|
||||
.update(cx, |copilot, cx| {
|
||||
copilot.reinstall(cx)
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
},
|
||||
),
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
}))
|
||||
.tooltip(|cx| Tooltip::text("GitHub Copilot", cx)),
|
||||
@ -134,7 +134,7 @@ impl CopilotButton {
|
||||
|
||||
pub fn build_copilot_start_menu(&mut self, cx: &mut ViewContext<Self>) -> View<ContextMenu> {
|
||||
let fs = self.fs.clone();
|
||||
ContextMenu::build(cx, |menu, cx| {
|
||||
ContextMenu::build(cx, |menu, _| {
|
||||
menu.entry("Sign In", None, initiate_sign_in).entry(
|
||||
"Disable Copilot",
|
||||
None,
|
||||
|
@ -67,7 +67,8 @@ impl BlinkManager {
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
Timer::after(interval).await;
|
||||
if let Some(this) = this.upgrade() {
|
||||
this.update(&mut cx, |this, cx| this.blink_cursors(epoch, cx));
|
||||
this.update(&mut cx, |this, cx| this.blink_cursors(epoch, cx))
|
||||
.ok();
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
@ -12,10 +12,7 @@ use crate::{
|
||||
pub use block_map::{BlockMap, BlockPoint};
|
||||
use collections::{BTreeMap, HashMap, HashSet};
|
||||
use fold_map::FoldMap;
|
||||
use gpui::{
|
||||
Font, FontId, HighlightStyle, Hsla, LineLayout, Model, ModelContext, Pixels, ShapedLine,
|
||||
TextRun, UnderlineStyle, WrappedLine,
|
||||
};
|
||||
use gpui::{Font, HighlightStyle, Hsla, LineLayout, Model, ModelContext, Pixels, UnderlineStyle};
|
||||
use inlay_map::InlayMap;
|
||||
use language::{
|
||||
language_settings::language_settings, OffsetUtf16, Point, Subscription as BufferSubscription,
|
||||
@ -24,7 +21,7 @@ use lsp::DiagnosticSeverity;
|
||||
use std::{any::TypeId, borrow::Cow, fmt::Debug, num::NonZeroU32, ops::Range, sync::Arc};
|
||||
use sum_tree::{Bias, TreeMap};
|
||||
use tab_map::TabMap;
|
||||
use theme::{StatusColors, SyntaxTheme, Theme};
|
||||
|
||||
use wrap_map::WrapMap;
|
||||
|
||||
pub use block_map::{
|
||||
@ -1018,7 +1015,7 @@ pub mod tests {
|
||||
.map(|i| i.parse().expect("invalid `OPERATIONS` variable"))
|
||||
.unwrap_or(10);
|
||||
|
||||
let test_platform = &cx.test_platform;
|
||||
let _test_platform = &cx.test_platform;
|
||||
let mut tab_size = rng.gen_range(1..=4);
|
||||
let buffer_start_excerpt_header_height = rng.gen_range(1..=5);
|
||||
let excerpt_header_height = rng.gen_range(1..=5);
|
||||
@ -1280,7 +1277,7 @@ pub mod tests {
|
||||
let editor = cx.editor.clone();
|
||||
let window = cx.window.clone();
|
||||
|
||||
cx.update_window(window, |_, cx| {
|
||||
_ = cx.update_window(window, |_, cx| {
|
||||
let text_layout_details =
|
||||
editor.update(cx, |editor, cx| editor.text_layout_details(cx));
|
||||
|
||||
|
@ -1185,7 +1185,7 @@ mod tests {
|
||||
fn test_blocks_on_wrapped_lines(cx: &mut gpui::TestAppContext) {
|
||||
cx.update(|cx| init_test(cx));
|
||||
|
||||
let font_id = cx.text_system().font_id(&font("Helvetica")).unwrap();
|
||||
let _font_id = cx.text_system().font_id(&font("Helvetica")).unwrap();
|
||||
|
||||
let text = "one two three\nfour five six\nseven eight";
|
||||
|
||||
|
@ -197,7 +197,8 @@ impl WrapMap {
|
||||
this.background_task = None;
|
||||
this.flush_edits(cx);
|
||||
cx.notify();
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -277,7 +278,8 @@ impl WrapMap {
|
||||
this.background_task = None;
|
||||
this.flush_edits(cx);
|
||||
cx.notify();
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -1057,7 +1059,7 @@ mod tests {
|
||||
};
|
||||
let tab_size = NonZeroU32::new(rng.gen_range(1..=4)).unwrap();
|
||||
let font = font("Helvetica");
|
||||
let font_id = text_system.font_id(&font).unwrap();
|
||||
let _font_id = text_system.font_id(&font).unwrap();
|
||||
let font_size = px(14.0);
|
||||
|
||||
log::info!("Tab size: {}", tab_size);
|
||||
|
@ -1,4 +1,3 @@
|
||||
#![allow(unused)]
|
||||
mod blink_manager;
|
||||
pub mod display_map;
|
||||
mod editor_settings;
|
||||
@ -42,11 +41,10 @@ use git::diff_hunk_to_display;
|
||||
use gpui::{
|
||||
actions, div, impl_actions, point, prelude::*, px, relative, rems, size, uniform_list, Action,
|
||||
AnyElement, AppContext, AsyncWindowContext, BackgroundExecutor, Bounds, ClipboardItem, Context,
|
||||
DispatchPhase, Div, ElementId, EventEmitter, FocusHandle, FocusableView, FontFeatures,
|
||||
FontStyle, FontWeight, HighlightStyle, Hsla, InputHandler, InteractiveText, KeyContext, Model,
|
||||
MouseButton, ParentElement, Pixels, Render, RenderOnce, SharedString, Styled, StyledText,
|
||||
Subscription, Task, TextRun, TextStyle, UniformListScrollHandle, View, ViewContext,
|
||||
VisualContext, WeakView, WhiteSpace, WindowContext,
|
||||
DispatchPhase, ElementId, EventEmitter, FocusHandle, FocusableView, FontStyle, FontWeight,
|
||||
HighlightStyle, Hsla, InputHandler, InteractiveText, KeyContext, Model, MouseButton,
|
||||
ParentElement, Pixels, Render, SharedString, Styled, StyledText, Subscription, Task, TextStyle,
|
||||
UniformListScrollHandle, View, ViewContext, VisualContext, WeakView, WhiteSpace, WindowContext,
|
||||
};
|
||||
use highlight_matching_bracket::refresh_matching_bracket_highlights;
|
||||
use hover_popover::{hide_hover, HoverState};
|
||||
@ -61,7 +59,7 @@ use language::{
|
||||
LanguageRegistry, LanguageServerName, OffsetRangeExt, Point, Selection, SelectionGoal,
|
||||
TransactionId,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use link_go_to_definition::{GoToDefinitionLink, InlayHighlight, LinkGoToDefinitionState};
|
||||
use lsp::{DiagnosticSeverity, LanguageServerId};
|
||||
use mouse_context_menu::MouseContextMenu;
|
||||
@ -72,7 +70,7 @@ pub use multi_buffer::{
|
||||
ToPoint,
|
||||
};
|
||||
use ordered_float::OrderedFloat;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use parking_lot::RwLock;
|
||||
use project::{FormatTrigger, Location, Project, ProjectPath, ProjectTransaction};
|
||||
use rand::prelude::*;
|
||||
use rpc::proto::{self, *};
|
||||
@ -99,19 +97,11 @@ use std::{
|
||||
pub use sum_tree::Bias;
|
||||
use sum_tree::TreeMap;
|
||||
use text::{OffsetUtf16, Rope};
|
||||
use theme::{
|
||||
ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, Theme, ThemeColors, ThemeSettings,
|
||||
};
|
||||
use ui::{
|
||||
h_stack, v_stack, ButtonSize, ButtonStyle, HighlightedLabel, Icon, IconButton, Popover, Tooltip,
|
||||
};
|
||||
use theme::{ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, ThemeColors, ThemeSettings};
|
||||
use ui::{h_stack, ButtonSize, ButtonStyle, Icon, IconButton, Popover, Tooltip};
|
||||
use ui::{prelude::*, IconSize};
|
||||
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
|
||||
use workspace::{
|
||||
item::{Item, ItemEvent, ItemHandle},
|
||||
searchable::SearchEvent,
|
||||
ItemNavHistory, Pane, SplitDirection, ViewId, Workspace,
|
||||
};
|
||||
use workspace::{searchable::SearchEvent, ItemNavHistory, Pane, SplitDirection, ViewId, Workspace};
|
||||
|
||||
const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500);
|
||||
const MAX_LINE_LEN: usize = 1024;
|
||||
@ -439,7 +429,7 @@ pub fn init(cx: &mut AppContext) {
|
||||
workspace::register_followable_item::<Editor>(cx);
|
||||
workspace::register_deserializable_item::<Editor>(cx);
|
||||
cx.observe_new_views(
|
||||
|workspace: &mut Workspace, cx: &mut ViewContext<Workspace>| {
|
||||
|workspace: &mut Workspace, _cx: &mut ViewContext<Workspace>| {
|
||||
workspace.register_action(Editor::new_file);
|
||||
workspace.register_action(Editor::new_file_in_direction);
|
||||
},
|
||||
@ -1216,7 +1206,7 @@ impl CompletionsMenu {
|
||||
cx.view().clone(),
|
||||
"completions",
|
||||
matches.len(),
|
||||
move |editor, range, cx| {
|
||||
move |_editor, range, cx| {
|
||||
let start_ix = range.start;
|
||||
let completions_guard = completions.read();
|
||||
|
||||
@ -1271,7 +1261,7 @@ impl CompletionsMenu {
|
||||
})
|
||||
.on_mouse_down(
|
||||
MouseButton::Left,
|
||||
cx.listener(move |editor, event, cx| {
|
||||
cx.listener(move |editor, _event, cx| {
|
||||
cx.stop_propagation();
|
||||
editor
|
||||
.confirm_completion(
|
||||
@ -1414,7 +1404,7 @@ impl CodeActionsMenu {
|
||||
fn render(
|
||||
&self,
|
||||
mut cursor_position: DisplayPoint,
|
||||
style: &EditorStyle,
|
||||
_style: &EditorStyle,
|
||||
max_height: Pixels,
|
||||
cx: &mut ViewContext<Editor>,
|
||||
) -> (DisplayPoint, AnyElement) {
|
||||
@ -1425,7 +1415,7 @@ impl CodeActionsMenu {
|
||||
cx.view().clone(),
|
||||
"code_actions_menu",
|
||||
self.actions.len(),
|
||||
move |this, range, cx| {
|
||||
move |_this, range, cx| {
|
||||
actions[range.clone()]
|
||||
.iter()
|
||||
.enumerate()
|
||||
@ -3418,9 +3408,11 @@ impl Editor {
|
||||
Some(cx.spawn(|editor, mut cx| async move {
|
||||
if let Some(transaction) = on_type_formatting.await? {
|
||||
if push_to_client_history {
|
||||
buffer.update(&mut cx, |buffer, _| {
|
||||
buffer.push_transaction(transaction, Instant::now());
|
||||
});
|
||||
buffer
|
||||
.update(&mut cx, |buffer, _| {
|
||||
buffer.push_transaction(transaction, Instant::now());
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
editor.update(&mut cx, |editor, cx| {
|
||||
editor.refresh_document_highlights(cx);
|
||||
@ -4226,7 +4218,7 @@ impl Editor {
|
||||
|
||||
pub fn render_code_actions_indicator(
|
||||
&self,
|
||||
style: &EditorStyle,
|
||||
_style: &EditorStyle,
|
||||
is_active: bool,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Option<IconButton> {
|
||||
@ -4236,7 +4228,7 @@ impl Editor {
|
||||
.icon_size(IconSize::Small)
|
||||
.icon_color(Color::Muted)
|
||||
.selected(is_active)
|
||||
.on_click(cx.listener(|editor, e, cx| {
|
||||
.on_click(cx.listener(|editor, _e, cx| {
|
||||
editor.toggle_code_actions(
|
||||
&ToggleCodeActions {
|
||||
deployed_from_indicator: true,
|
||||
@ -4253,10 +4245,10 @@ impl Editor {
|
||||
pub fn render_fold_indicators(
|
||||
&self,
|
||||
fold_data: Vec<Option<(FoldStatus, u32, bool)>>,
|
||||
style: &EditorStyle,
|
||||
_style: &EditorStyle,
|
||||
gutter_hovered: bool,
|
||||
line_height: Pixels,
|
||||
gutter_margin: Pixels,
|
||||
_line_height: Pixels,
|
||||
_gutter_margin: Pixels,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Vec<Option<IconButton>> {
|
||||
fold_data
|
||||
@ -4267,7 +4259,7 @@ impl Editor {
|
||||
.map(|(fold_status, buffer_row, active)| {
|
||||
(active || gutter_hovered || fold_status == FoldStatus::Folded).then(|| {
|
||||
IconButton::new(ix as usize, ui::Icon::ChevronDown)
|
||||
.on_click(cx.listener(move |editor, e, cx| match fold_status {
|
||||
.on_click(cx.listener(move |editor, _e, cx| match fold_status {
|
||||
FoldStatus::Folded => {
|
||||
editor.unfold_at(&UnfoldAt { buffer_row }, cx);
|
||||
}
|
||||
@ -7379,11 +7371,13 @@ impl Editor {
|
||||
.filter_map(|location| location.transpose())
|
||||
.collect::<Result<_>>()
|
||||
.context("location tasks")?;
|
||||
workspace.update(&mut cx, |workspace, cx| {
|
||||
Self::open_locations_in_multibuffer(
|
||||
workspace, locations, replica_id, title, split, cx,
|
||||
)
|
||||
});
|
||||
workspace
|
||||
.update(&mut cx, |workspace, cx| {
|
||||
Self::open_locations_in_multibuffer(
|
||||
workspace, locations, replica_id, title, split, cx,
|
||||
)
|
||||
})
|
||||
.ok();
|
||||
|
||||
anyhow::Ok(())
|
||||
})
|
||||
@ -7832,15 +7826,17 @@ impl Editor {
|
||||
transaction = format.log_err().fuse() => transaction,
|
||||
};
|
||||
|
||||
buffer.update(&mut cx, |buffer, cx| {
|
||||
if let Some(transaction) = transaction {
|
||||
if !buffer.is_singleton() {
|
||||
buffer.push_transaction(&transaction.0, cx);
|
||||
buffer
|
||||
.update(&mut cx, |buffer, cx| {
|
||||
if let Some(transaction) = transaction {
|
||||
if !buffer.is_singleton() {
|
||||
buffer.push_transaction(&transaction.0, cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cx.notify();
|
||||
});
|
||||
cx.notify();
|
||||
})
|
||||
.ok();
|
||||
|
||||
Ok(())
|
||||
})
|
||||
@ -9119,7 +9115,7 @@ impl Editor {
|
||||
let listener = Arc::new(listener);
|
||||
|
||||
self.editor_actions.push(Box::new(move |cx| {
|
||||
let view = cx.view().clone();
|
||||
let _view = cx.view().clone();
|
||||
let cx = cx.window_context();
|
||||
let listener = listener.clone();
|
||||
cx.on_action(TypeId::of::<A>(), move |action, phase, cx| {
|
||||
@ -9289,7 +9285,7 @@ pub enum EditorEvent {
|
||||
impl EventEmitter<EditorEvent> for Editor {}
|
||||
|
||||
impl FocusableView for Editor {
|
||||
fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
|
||||
fn focus_handle(&self, _cx: &AppContext) -> FocusHandle {
|
||||
self.focus_handle.clone()
|
||||
}
|
||||
}
|
||||
@ -9329,7 +9325,7 @@ impl Render for Editor {
|
||||
|
||||
let background = match self.mode {
|
||||
EditorMode::SingleLine => cx.theme().system().transparent,
|
||||
EditorMode::AutoHeight { max_lines } => cx.theme().system().transparent,
|
||||
EditorMode::AutoHeight { max_lines: _ } => cx.theme().system().transparent,
|
||||
EditorMode::Full => cx.theme().colors().editor_background,
|
||||
};
|
||||
|
||||
@ -9719,7 +9715,7 @@ impl InvalidationRegion for SnippetState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn diagnostic_block_renderer(diagnostic: Diagnostic, is_valid: bool) -> RenderBlock {
|
||||
pub fn diagnostic_block_renderer(diagnostic: Diagnostic, _is_valid: bool) -> RenderBlock {
|
||||
let (text_without_backticks, code_ranges) = highlight_diagnostic_message(&diagnostic);
|
||||
|
||||
Arc::new(move |cx: &mut BlockContext| {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,24 +16,23 @@ use crate::{
|
||||
mouse_context_menu,
|
||||
scroll::scroll_amount::ScrollAmount,
|
||||
CursorShape, DisplayPoint, Editor, EditorMode, EditorSettings, EditorSnapshot, EditorStyle,
|
||||
HalfPageDown, HalfPageUp, LineDown, LineUp, MoveDown, OpenExcerpts, PageDown, PageUp, Point,
|
||||
SelectPhase, Selection, SoftWrap, ToPoint, MAX_LINE_LEN,
|
||||
HalfPageDown, HalfPageUp, LineDown, LineUp, OpenExcerpts, PageDown, PageUp, Point, SelectPhase,
|
||||
Selection, SoftWrap, ToPoint, MAX_LINE_LEN,
|
||||
};
|
||||
use anyhow::Result;
|
||||
use collections::{BTreeMap, HashMap};
|
||||
use git::diff::DiffHunkStatus;
|
||||
use gpui::{
|
||||
div, fill, outline, overlay, point, px, quad, relative, size, transparent_black, Action,
|
||||
AnchorCorner, AnyElement, AsyncWindowContext, AvailableSpace, BorrowWindow, Bounds,
|
||||
ContentMask, Corners, CursorStyle, DispatchPhase, Edges, Element, ElementId,
|
||||
ElementInputHandler, Entity, EntityId, Hsla, InteractiveBounds, InteractiveElement,
|
||||
IntoElement, LineLayout, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent,
|
||||
MouseUpEvent, ParentElement, Pixels, RenderOnce, ScrollWheelEvent, ShapedLine, SharedString,
|
||||
Size, StackingOrder, StatefulInteractiveElement, Style, Styled, TextRun, TextStyle, View,
|
||||
ViewContext, WeakView, WindowContext, WrappedLine,
|
||||
AnchorCorner, AnyElement, AvailableSpace, BorrowWindow, Bounds, ContentMask, Corners,
|
||||
CursorStyle, DispatchPhase, Edges, Element, ElementInputHandler, Hsla, InteractiveBounds,
|
||||
InteractiveElement, IntoElement, ModifiersChangedEvent, MouseButton, MouseDownEvent,
|
||||
MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, ScrollWheelEvent, ShapedLine,
|
||||
SharedString, Size, StackingOrder, StatefulInteractiveElement, Style, Styled, TextRun,
|
||||
TextStyle, View, ViewContext, WindowContext,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{language_settings::ShowWhitespaceSetting, Language};
|
||||
use language::language_settings::ShowWhitespaceSetting;
|
||||
use multi_buffer::Anchor;
|
||||
use project::{
|
||||
project_settings::{GitGutterSetting, ProjectSettings},
|
||||
@ -52,15 +51,11 @@ use std::{
|
||||
};
|
||||
use sum_tree::Bias;
|
||||
use theme::{ActiveTheme, PlayerColor};
|
||||
use ui::{
|
||||
h_stack, ButtonLike, ButtonStyle, Disclosure, IconButton, IconElement, IconSize, Label, Tooltip,
|
||||
};
|
||||
use ui::{prelude::*, Icon};
|
||||
use ui::prelude::*;
|
||||
use ui::{h_stack, ButtonLike, ButtonStyle, IconButton, Label, Tooltip};
|
||||
use util::ResultExt;
|
||||
use workspace::item::Item;
|
||||
|
||||
enum FoldMarkers {}
|
||||
|
||||
struct SelectionLayout {
|
||||
head: DisplayPoint,
|
||||
cursor_shape: CursorShape,
|
||||
@ -732,7 +727,7 @@ impl EditorElement {
|
||||
ix as f32 * line_height - (scroll_top % line_height),
|
||||
);
|
||||
|
||||
line.paint(line_origin, line_height, cx);
|
||||
line.paint(line_origin, line_height, cx).log_err();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2687,11 +2682,13 @@ impl LineWithInvisibles {
|
||||
let line_height = layout.position_map.line_height;
|
||||
let line_y = line_height * row as f32 - layout.position_map.scroll_position.y;
|
||||
|
||||
self.line.paint(
|
||||
content_origin + gpui::point(-layout.position_map.scroll_position.x, line_y),
|
||||
line_height,
|
||||
cx,
|
||||
);
|
||||
self.line
|
||||
.paint(
|
||||
content_origin + gpui::point(-layout.position_map.scroll_position.x, line_y),
|
||||
line_height,
|
||||
cx,
|
||||
)
|
||||
.log_err();
|
||||
|
||||
self.draw_invisibles(
|
||||
&selection_ranges,
|
||||
@ -2746,7 +2743,7 @@ impl LineWithInvisibles {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
invisible_symbol.paint(origin, line_height, cx);
|
||||
invisible_symbol.paint(origin, line_height, cx).log_err();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3090,7 +3087,9 @@ impl Cursor {
|
||||
cx.paint_quad(cursor);
|
||||
|
||||
if let Some(block_text) = &self.block_text {
|
||||
block_text.paint(self.origin + origin, self.line_height, cx);
|
||||
block_text
|
||||
.paint(self.origin + origin, self.line_height, cx)
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3251,7 +3250,7 @@ mod tests {
|
||||
editor_tests::{init_test, update_test_language_settings},
|
||||
Editor, MultiBuffer,
|
||||
};
|
||||
use gpui::{EmptyView, TestAppContext};
|
||||
use gpui::TestAppContext;
|
||||
use language::language_settings;
|
||||
use log::info;
|
||||
use std::{num::NonZeroU32, sync::Arc};
|
||||
@ -3432,7 +3431,7 @@ mod tests {
|
||||
let editor = window.root(cx).unwrap();
|
||||
let style = cx.update(|cx| editor.read(cx).style().unwrap().clone());
|
||||
let mut element = EditorElement::new(&editor, style);
|
||||
let state = window.update(cx, |editor, cx| {
|
||||
let _state = window.update(cx, |editor, cx| {
|
||||
editor.cursor_shape = CursorShape::Block;
|
||||
editor.change_selections(None, cx, |s| {
|
||||
s.select_display_ranges([
|
||||
@ -3504,7 +3503,7 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let mut element = EditorElement::new(&editor, style);
|
||||
let mut state = cx
|
||||
let state = cx
|
||||
.update_window(window.into(), |_, cx| {
|
||||
element.compute_layout(
|
||||
Bounds {
|
||||
@ -3768,17 +3767,15 @@ fn compute_auto_height_layout(
|
||||
.width;
|
||||
|
||||
let mut snapshot = editor.snapshot(cx);
|
||||
let gutter_padding;
|
||||
let gutter_width;
|
||||
let gutter_margin;
|
||||
if snapshot.show_gutter {
|
||||
let descent = cx.text_system().descent(font_id, font_size);
|
||||
let gutter_padding_factor = 3.5;
|
||||
gutter_padding = (em_width * gutter_padding_factor).round();
|
||||
let gutter_padding = (em_width * gutter_padding_factor).round();
|
||||
gutter_width = max_line_number_width + gutter_padding * 2.0;
|
||||
gutter_margin = -descent;
|
||||
} else {
|
||||
gutter_padding = Pixels::ZERO;
|
||||
gutter_width = Pixels::ZERO;
|
||||
gutter_margin = Pixels::ZERO;
|
||||
};
|
||||
|
@ -6,12 +6,12 @@ use crate::{
|
||||
};
|
||||
use futures::FutureExt;
|
||||
use gpui::{
|
||||
actions, div, px, AnyElement, AppContext, CursorStyle, InteractiveElement, IntoElement, Model,
|
||||
MouseButton, ParentElement, Pixels, SharedString, Size, StatefulInteractiveElement, Styled,
|
||||
Task, ViewContext, WeakView,
|
||||
actions, div, px, AnyElement, CursorStyle, InteractiveElement, IntoElement, Model, MouseButton,
|
||||
ParentElement, Pixels, SharedString, Size, StatefulInteractiveElement, Styled, Task,
|
||||
ViewContext, WeakView,
|
||||
};
|
||||
use language::{markdown, Bias, DiagnosticEntry, Language, LanguageRegistry, ParsedMarkdown};
|
||||
use lsp::DiagnosticSeverity;
|
||||
|
||||
use project::{HoverBlock, HoverBlockKind, InlayHintLabelPart, Project};
|
||||
use settings::Settings;
|
||||
use std::{ops::Range, sync::Arc, time::Duration};
|
||||
@ -869,7 +869,7 @@ mod tests {
|
||||
|
||||
let editor = cx.add_window(|cx| Editor::single_line(cx));
|
||||
editor
|
||||
.update(cx, |editor, cx| {
|
||||
.update(cx, |editor, _cx| {
|
||||
let style = editor.style.clone().unwrap();
|
||||
|
||||
struct Row {
|
||||
|
@ -1203,7 +1203,7 @@ pub mod tests {
|
||||
ExcerptRange,
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use gpui::{Context, TestAppContext, View, WindowHandle};
|
||||
use gpui::{Context, TestAppContext, WindowHandle};
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
language_settings::AllLanguageSettingsContent, FakeLspAdapter, Language, LanguageConfig,
|
||||
@ -1214,7 +1214,6 @@ pub mod tests {
|
||||
use serde_json::json;
|
||||
use settings::SettingsStore;
|
||||
use text::{Point, ToPoint};
|
||||
use workspace::Workspace;
|
||||
|
||||
use crate::editor_tests::update_test_language_settings;
|
||||
|
||||
@ -1273,7 +1272,7 @@ pub mod tests {
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
let mut edits_made = 1;
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1292,13 +1291,13 @@ pub mod tests {
|
||||
);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| s.select_ranges([13..13]));
|
||||
editor.handle_input("some change", cx);
|
||||
edits_made += 1;
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string(), "1".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1323,7 +1322,7 @@ pub mod tests {
|
||||
.expect("inlay refresh request failed");
|
||||
edits_made += 1;
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string(), "1".to_string(), "2".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1383,7 +1382,7 @@ pub mod tests {
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
let mut edits_made = 1;
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1414,7 +1413,7 @@ pub mod tests {
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1438,7 +1437,7 @@ pub mod tests {
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
edits_made += 1;
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["1".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1543,7 +1542,7 @@ pub mod tests {
|
||||
.next()
|
||||
.await;
|
||||
cx.executor().run_until_parked();
|
||||
rs_editor.update(cx, |editor, cx| {
|
||||
_ = rs_editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1594,7 +1593,7 @@ pub mod tests {
|
||||
.next()
|
||||
.await;
|
||||
cx.executor().run_until_parked();
|
||||
md_editor.update(cx, |editor, cx| {
|
||||
_ = md_editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1605,12 +1604,12 @@ pub mod tests {
|
||||
assert_eq!(editor.inlay_hint_cache().version, 1);
|
||||
});
|
||||
|
||||
rs_editor.update(cx, |editor, cx| {
|
||||
_ = rs_editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| s.select_ranges([13..13]));
|
||||
editor.handle_input("some rs change", cx);
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
rs_editor.update(cx, |editor, cx| {
|
||||
_ = rs_editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["1".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1624,7 +1623,7 @@ pub mod tests {
|
||||
"Every time hint cache changes, cache version should be incremented"
|
||||
);
|
||||
});
|
||||
md_editor.update(cx, |editor, cx| {
|
||||
_ = md_editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1635,12 +1634,12 @@ pub mod tests {
|
||||
assert_eq!(editor.inlay_hint_cache().version, 1);
|
||||
});
|
||||
|
||||
md_editor.update(cx, |editor, cx| {
|
||||
_ = md_editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| s.select_ranges([13..13]));
|
||||
editor.handle_input("some md change", cx);
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
md_editor.update(cx, |editor, cx| {
|
||||
_ = md_editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["1".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1650,7 +1649,7 @@ pub mod tests {
|
||||
assert_eq!(expected_hints, visible_hint_labels(editor, cx));
|
||||
assert_eq!(editor.inlay_hint_cache().version, 2);
|
||||
});
|
||||
rs_editor.update(cx, |editor, cx| {
|
||||
_ = rs_editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["1".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -1725,7 +1724,7 @@ pub mod tests {
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
let mut edits_made = 1;
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
1,
|
||||
@ -1760,7 +1759,7 @@ pub mod tests {
|
||||
.await
|
||||
.expect("inlay refresh request failed");
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
2,
|
||||
@ -1832,7 +1831,7 @@ pub mod tests {
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
2,
|
||||
@ -1876,7 +1875,7 @@ pub mod tests {
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
2,
|
||||
@ -1906,7 +1905,7 @@ pub mod tests {
|
||||
.await
|
||||
.expect("inlay refresh request failed");
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
2,
|
||||
@ -1932,7 +1931,7 @@ pub mod tests {
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
3,
|
||||
@ -1968,7 +1967,7 @@ pub mod tests {
|
||||
.await
|
||||
.expect("inlay refresh request failed");
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
lsp_request_count.load(Ordering::Relaxed),
|
||||
4,
|
||||
@ -2035,7 +2034,7 @@ pub mod tests {
|
||||
"initial change #2",
|
||||
"initial change #3",
|
||||
] {
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| s.select_ranges([13..13]));
|
||||
editor.handle_input(change_after_opening, cx);
|
||||
});
|
||||
@ -2044,7 +2043,7 @@ pub mod tests {
|
||||
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let current_text = editor.text(cx);
|
||||
for change in &expected_changes {
|
||||
assert!(
|
||||
@ -2079,7 +2078,7 @@ pub mod tests {
|
||||
expected_changes.push(async_later_change);
|
||||
let task_editor = editor.clone();
|
||||
edits.push(cx.spawn(|mut cx| async move {
|
||||
task_editor.update(&mut cx, |editor, cx| {
|
||||
_ = task_editor.update(&mut cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| s.select_ranges([13..13]));
|
||||
editor.handle_input(async_later_change, cx);
|
||||
});
|
||||
@ -2088,7 +2087,7 @@ pub mod tests {
|
||||
let _ = future::join_all(edits).await;
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let current_text = editor.text(cx);
|
||||
for change in &expected_changes {
|
||||
assert!(
|
||||
@ -2246,7 +2245,7 @@ pub mod tests {
|
||||
lsp::Position::new(initial_visible_range.end.row * 2, 2);
|
||||
let mut expected_invisible_query_start = lsp_initial_visible_range.end;
|
||||
expected_invisible_query_start.character += 1;
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let ranges = lsp_request_ranges.lock().drain(..).collect::<Vec<_>>();
|
||||
assert_eq!(ranges.len(), 2,
|
||||
"When scroll is at the edge of a big document, its visible part and the same range further should be queried in order, but got: {ranges:?}");
|
||||
@ -2273,7 +2272,7 @@ pub mod tests {
|
||||
);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.scroll_screen(&ScrollAmount::Page(1.0), cx);
|
||||
editor.scroll_screen(&ScrollAmount::Page(1.0), cx);
|
||||
});
|
||||
@ -2343,7 +2342,7 @@ pub mod tests {
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(Some(Autoscroll::center()), cx, |s| {
|
||||
s.select_ranges([selection_in_cached_range..selection_in_cached_range])
|
||||
});
|
||||
@ -2352,7 +2351,7 @@ pub mod tests {
|
||||
INVISIBLE_RANGES_HINTS_REQUEST_DELAY_MILLIS + 100,
|
||||
));
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |_, _| {
|
||||
_ = editor.update(cx, |_, _| {
|
||||
let ranges = lsp_request_ranges
|
||||
.lock()
|
||||
.drain(..)
|
||||
@ -2362,14 +2361,14 @@ pub mod tests {
|
||||
assert_eq!(lsp_request_count.load(Ordering::Acquire), 4);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.handle_input("++++more text++++", cx);
|
||||
});
|
||||
cx.executor().advance_clock(Duration::from_millis(
|
||||
INVISIBLE_RANGES_HINTS_REQUEST_DELAY_MILLIS + 100,
|
||||
));
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let mut ranges = lsp_request_ranges.lock().drain(..).collect::<Vec<_>>();
|
||||
ranges.sort_by_key(|r| r.start);
|
||||
|
||||
@ -2597,7 +2596,7 @@ pub mod tests {
|
||||
.await;
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec![
|
||||
"main hint #0".to_string(),
|
||||
"main hint #1".to_string(),
|
||||
@ -2615,7 +2614,7 @@ pub mod tests {
|
||||
assert_eq!(editor.inlay_hint_cache().version, expected_hints.len(), "Every visible excerpt hints should bump the verison");
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(Some(Autoscroll::Next), cx, |s| {
|
||||
s.select_ranges([Point::new(4, 0)..Point::new(4, 0)])
|
||||
});
|
||||
@ -2627,7 +2626,7 @@ pub mod tests {
|
||||
});
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec![
|
||||
"main hint #0".to_string(),
|
||||
"main hint #1".to_string(),
|
||||
@ -2646,7 +2645,7 @@ pub mod tests {
|
||||
"Due to every excerpt having one hint, we update cache per new excerpt scrolled");
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(Some(Autoscroll::Next), cx, |s| {
|
||||
s.select_ranges([Point::new(100, 0)..Point::new(100, 0)])
|
||||
});
|
||||
@ -2677,13 +2676,13 @@ pub mod tests {
|
||||
expected_hints.len()
|
||||
}).unwrap();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(Some(Autoscroll::Next), cx, |s| {
|
||||
s.select_ranges([Point::new(4, 0)..Point::new(4, 0)])
|
||||
});
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec![
|
||||
"main hint #0".to_string(),
|
||||
"main hint #1".to_string(),
|
||||
@ -2705,7 +2704,7 @@ pub mod tests {
|
||||
});
|
||||
|
||||
editor_edited.store(true, Ordering::Release);
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| {
|
||||
// TODO if this gets set to hint boundary (e.g. 56) we sometimes get an extra cache version bump, why?
|
||||
s.select_ranges([Point::new(57, 0)..Point::new(57, 0)])
|
||||
@ -2713,7 +2712,7 @@ pub mod tests {
|
||||
editor.handle_input("++++more text++++", cx);
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec![
|
||||
"main hint(edited) #0".to_string(),
|
||||
"main hint(edited) #1".to_string(),
|
||||
@ -2895,7 +2894,7 @@ pub mod tests {
|
||||
.await;
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
vec!["main hint #0".to_string(), "other hint #0".to_string()],
|
||||
cached_hint_labels(editor),
|
||||
@ -2912,13 +2911,13 @@ pub mod tests {
|
||||
);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.buffer().update(cx, |multibuffer, cx| {
|
||||
multibuffer.remove_excerpts(buffer_2_excerpts, cx)
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert_eq!(
|
||||
vec!["main hint #0".to_string()],
|
||||
cached_hint_labels(editor),
|
||||
@ -2944,7 +2943,7 @@ pub mod tests {
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["main hint #0".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -3041,13 +3040,13 @@ pub mod tests {
|
||||
.await;
|
||||
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.change_selections(None, cx, |s| {
|
||||
s.select_ranges([Point::new(10, 0)..Point::new(10, 0)])
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["1".to_string()];
|
||||
assert_eq!(expected_hints, cached_hint_labels(editor));
|
||||
assert_eq!(expected_hints, visible_hint_labels(editor, cx));
|
||||
@ -3068,7 +3067,7 @@ pub mod tests {
|
||||
|
||||
let (file_with_hints, editor, fake_server) = prepare_test_objects(cx).await;
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.toggle_inlay_hints(&crate::ToggleInlayHints, cx)
|
||||
});
|
||||
cx.executor().start_waiting();
|
||||
@ -3099,7 +3098,7 @@ pub mod tests {
|
||||
.next()
|
||||
.await;
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["1".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -3114,11 +3113,11 @@ pub mod tests {
|
||||
);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.toggle_inlay_hints(&crate::ToggleInlayHints, cx)
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert!(
|
||||
cached_hint_labels(editor).is_empty(),
|
||||
"Should clear hints after 2nd toggle"
|
||||
@ -3136,7 +3135,7 @@ pub mod tests {
|
||||
})
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["2".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -3147,11 +3146,11 @@ pub mod tests {
|
||||
assert_eq!(editor.inlay_hint_cache().version, 3);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.toggle_inlay_hints(&crate::ToggleInlayHints, cx)
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert!(
|
||||
cached_hint_labels(editor).is_empty(),
|
||||
"Should clear hints after enabling in settings and a 3rd toggle"
|
||||
@ -3160,11 +3159,11 @@ pub mod tests {
|
||||
assert_eq!(editor.inlay_hint_cache().version, 4);
|
||||
});
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
editor.toggle_inlay_hints(&crate::ToggleInlayHints, cx)
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
let expected_hints = vec!["3".to_string()];
|
||||
assert_eq!(
|
||||
expected_hints,
|
||||
@ -3223,7 +3222,7 @@ pub mod tests {
|
||||
.await;
|
||||
|
||||
let project = Project::test(fs, ["/a".as_ref()], cx).await;
|
||||
project.update(cx, |project, _| project.languages().add(Arc::new(language)));
|
||||
_ = project.update(cx, |project, _| project.languages().add(Arc::new(language)));
|
||||
let buffer = project
|
||||
.update(cx, |project, cx| {
|
||||
project.open_local_buffer("/a/main.rs", cx)
|
||||
@ -3235,7 +3234,7 @@ pub mod tests {
|
||||
let fake_server = fake_servers.next().await.unwrap();
|
||||
let editor = cx.add_window(|cx| Editor::for_buffer(buffer, Some(project), cx));
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
_ = editor.update(cx, |editor, cx| {
|
||||
assert!(cached_hint_labels(editor).is_empty());
|
||||
assert!(visible_hint_labels(editor, cx).is_empty());
|
||||
assert_eq!(editor.inlay_hint_cache().version, 0);
|
||||
|
@ -1,17 +1,15 @@
|
||||
use crate::{
|
||||
editor_settings::SeedQuerySetting, link_go_to_definition::hide_link_definition,
|
||||
movement::surrounding_word, persistence::DB, scroll::ScrollAnchor, Anchor, Autoscroll, Editor,
|
||||
EditorEvent, EditorSettings, ExcerptId, ExcerptRange, MultiBuffer, MultiBufferSnapshot,
|
||||
NavigationData, ToPoint as _,
|
||||
persistence::DB, scroll::ScrollAnchor, Anchor, Autoscroll, Editor, EditorEvent, EditorSettings,
|
||||
ExcerptId, ExcerptRange, MultiBuffer, MultiBufferSnapshot, NavigationData, ToPoint as _,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use collections::HashSet;
|
||||
use futures::future::try_join_all;
|
||||
use gpui::{
|
||||
div, point, AnyElement, AppContext, AsyncAppContext, AsyncWindowContext, Context, Div, Entity,
|
||||
EntityId, EventEmitter, FocusHandle, IntoElement, Model, ParentElement, Pixels, Render,
|
||||
SharedString, Styled, Subscription, Task, View, ViewContext, VisualContext, WeakView,
|
||||
WindowContext,
|
||||
div, point, AnyElement, AppContext, AsyncWindowContext, Context, Div, Entity, EntityId,
|
||||
EventEmitter, IntoElement, Model, ParentElement, Pixels, Render, SharedString, Styled,
|
||||
Subscription, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
|
||||
};
|
||||
use language::{
|
||||
proto::serialize_anchor as serialize_text_anchor, Bias, Buffer, CharKind, OffsetRangeExt,
|
||||
@ -20,7 +18,7 @@ use language::{
|
||||
use project::{search::SearchQuery, FormatTrigger, Item as _, Project, ProjectPath};
|
||||
use rpc::proto::{self, update_view, PeerId};
|
||||
use settings::Settings;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::fmt::Write;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
@ -581,7 +579,7 @@ impl Item for Editor {
|
||||
}
|
||||
|
||||
fn tab_content(&self, detail: Option<usize>, selected: bool, cx: &WindowContext) -> AnyElement {
|
||||
let theme = cx.theme();
|
||||
let _theme = cx.theme();
|
||||
|
||||
let description = detail.and_then(|detail| {
|
||||
let path = path_for_buffer(&self.buffer, detail, false, cx)?;
|
||||
@ -697,12 +695,14 @@ impl Item for Editor {
|
||||
})?
|
||||
.await?;
|
||||
for buffer in clean_buffers {
|
||||
buffer.update(&mut cx, |buffer, cx| {
|
||||
let version = buffer.saved_version().clone();
|
||||
let fingerprint = buffer.saved_version_fingerprint();
|
||||
let mtime = buffer.saved_mtime();
|
||||
buffer.did_save(version, fingerprint, mtime, cx);
|
||||
});
|
||||
buffer
|
||||
.update(&mut cx, |buffer, cx| {
|
||||
let version = buffer.saved_version().clone();
|
||||
let fingerprint = buffer.saved_version_fingerprint();
|
||||
let mtime = buffer.saved_mtime();
|
||||
buffer.did_save(version, fingerprint, mtime, cx);
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,13 +742,15 @@ impl Item for Editor {
|
||||
this.update(&mut cx, |editor, cx| {
|
||||
editor.request_autoscroll(Autoscroll::fit(), cx)
|
||||
})?;
|
||||
buffer.update(&mut cx, |buffer, cx| {
|
||||
if let Some(transaction) = transaction {
|
||||
if !buffer.is_singleton() {
|
||||
buffer.push_transaction(&transaction.0, cx);
|
||||
buffer
|
||||
.update(&mut cx, |buffer, cx| {
|
||||
if let Some(transaction) = transaction {
|
||||
if !buffer.is_singleton() {
|
||||
buffer.push_transaction(&transaction.0, cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.ok();
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ mod tests {
|
||||
test::editor_lsp_test_context::EditorLspTestContext,
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use gpui::{Modifiers, ModifiersChangedEvent, View};
|
||||
use gpui::{Modifiers, ModifiersChangedEvent};
|
||||
use indoc::indoc;
|
||||
use language::language_settings::InlayHintSettings;
|
||||
use lsp::request::{GotoDefinition, GotoTypeDefinition};
|
||||
|
@ -36,7 +36,7 @@ pub fn deploy_context_menu(
|
||||
s.set_pending_display_range(point..point, SelectMode::Character);
|
||||
});
|
||||
|
||||
let context_menu = ui::ContextMenu::build(cx, |menu, cx| {
|
||||
let context_menu = ui::ContextMenu::build(cx, |menu, _cx| {
|
||||
menu.action("Rename Symbol", Box::new(Rename))
|
||||
.action("Go to Definition", Box::new(GoToDefinition))
|
||||
.action("Go to Type Definition", Box::new(GoToTypeDefinition))
|
||||
@ -53,7 +53,7 @@ pub fn deploy_context_menu(
|
||||
let context_menu_focus = context_menu.focus_handle(cx);
|
||||
cx.focus(&context_menu_focus);
|
||||
|
||||
let _subscription = cx.subscribe(&context_menu, move |this, _, event: &DismissEvent, cx| {
|
||||
let _subscription = cx.subscribe(&context_menu, move |this, _, _event: &DismissEvent, cx| {
|
||||
this.mouse_context_menu.take();
|
||||
if context_menu_focus.contains_focused(cx) {
|
||||
this.focus(cx);
|
||||
@ -97,7 +97,7 @@ mod tests {
|
||||
do_wˇork();
|
||||
}
|
||||
"});
|
||||
cx.editor(|editor, app| assert!(editor.mouse_context_menu.is_none()));
|
||||
cx.editor(|editor, _app| assert!(editor.mouse_context_menu.is_none()));
|
||||
cx.update_editor(|editor, cx| deploy_context_menu(editor, Default::default(), point, cx));
|
||||
|
||||
cx.assert_editor_state(indoc! {"
|
||||
@ -105,6 +105,6 @@ mod tests {
|
||||
do_wˇork();
|
||||
}
|
||||
"});
|
||||
cx.editor(|editor, app| assert!(editor.mouse_context_menu.is_some()));
|
||||
cx.editor(|editor, _app| assert!(editor.mouse_context_menu.is_some()));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint};
|
||||
use crate::{char_kind, CharKind, EditorStyle, ToOffset, ToPoint};
|
||||
use gpui::{px, Pixels, TextSystem};
|
||||
use language::Point;
|
||||
use serde::de::IntoDeserializer;
|
||||
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -757,7 +757,7 @@ mod tests {
|
||||
let mut cx = EditorTestContext::new(cx).await;
|
||||
let editor = cx.editor.clone();
|
||||
let window = cx.window.clone();
|
||||
cx.update_window(window, |_, cx| {
|
||||
_ = cx.update_window(window, |_, cx| {
|
||||
let text_layout_details =
|
||||
editor.update(cx, |editor, cx| editor.text_layout_details(cx));
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Context as _;
|
||||
use gpui::{Context, Model, View, ViewContext, VisualContext, WindowContext};
|
||||
use gpui::{Context, View, ViewContext, VisualContext, WindowContext};
|
||||
use language::Language;
|
||||
use multi_buffer::MultiBuffer;
|
||||
use project::lsp_ext_command::ExpandMacro;
|
||||
@ -91,7 +91,7 @@ pub fn expand_macro_recursively(
|
||||
cx,
|
||||
)
|
||||
});
|
||||
cx.spawn(|editor, mut cx| async move {
|
||||
cx.spawn(|_editor, mut cx| async move {
|
||||
let macro_expansion = expand_macro_task.await.context("expand macro")?;
|
||||
if macro_expansion.is_empty() {
|
||||
log::info!("Empty macro expansion for position {position:?}");
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
Anchor, DisplayPoint, Editor, EditorEvent, EditorMode, InlayHintRefreshReason,
|
||||
MultiBufferSnapshot, ToPoint,
|
||||
};
|
||||
use gpui::{point, px, AppContext, Entity, Pixels, Styled, Task, ViewContext};
|
||||
use gpui::{point, px, AppContext, Entity, Pixels, Task, ViewContext};
|
||||
use language::{Bias, Point};
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
|
@ -3,7 +3,7 @@ use crate::{
|
||||
Autoscroll, Bias, Editor, EditorMode, NextScreen, ScrollAnchor, ScrollCursorBottom,
|
||||
ScrollCursorCenter, ScrollCursorTop,
|
||||
};
|
||||
use gpui::{actions, AppContext, Point, ViewContext};
|
||||
use gpui::{Point, ViewContext};
|
||||
|
||||
impl Editor {
|
||||
pub fn next_screen(&mut self, _: &NextScreen, cx: &mut ViewContext<Editor>) {
|
||||
|
@ -61,7 +61,7 @@ impl Editor {
|
||||
display_map.max_point().row() as f32
|
||||
};
|
||||
if scroll_position.y > max_scroll_top {
|
||||
scroll_position.y = (max_scroll_top);
|
||||
scroll_position.y = max_scroll_top;
|
||||
self.set_scroll_position(scroll_position, cx);
|
||||
}
|
||||
|
||||
@ -143,24 +143,24 @@ impl Editor {
|
||||
let needs_scroll_down = target_bottom >= end_row;
|
||||
|
||||
if needs_scroll_up && !needs_scroll_down {
|
||||
scroll_position.y = (target_top);
|
||||
scroll_position.y = target_top;
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
if !needs_scroll_up && needs_scroll_down {
|
||||
scroll_position.y = (target_bottom - visible_lines);
|
||||
scroll_position.y = target_bottom - visible_lines;
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
}
|
||||
AutoscrollStrategy::Center => {
|
||||
scroll_position.y = ((target_top - margin).max(0.0));
|
||||
scroll_position.y = (target_top - margin).max(0.0);
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
AutoscrollStrategy::Top => {
|
||||
scroll_position.y = ((target_top).max(0.0));
|
||||
scroll_position.y = (target_top).max(0.0);
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
AutoscrollStrategy::Bottom => {
|
||||
scroll_position.y = ((target_bottom - visible_lines).max(0.0));
|
||||
scroll_position.y = (target_bottom - visible_lines).max(0.0);
|
||||
self.set_scroll_position_internal(scroll_position, local, true, cx);
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ use crate::{
|
||||
use collections::BTreeMap;
|
||||
use futures::Future;
|
||||
use gpui::{
|
||||
AnyWindowHandle, AppContext, ForegroundExecutor, Keystroke, ModelContext, View, ViewContext,
|
||||
VisualTestContext, WindowHandle,
|
||||
AnyWindowHandle, AppContext, Keystroke, ModelContext, View, ViewContext, VisualTestContext,
|
||||
};
|
||||
use indoc::indoc;
|
||||
use itertools::Itertools;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(dead_code)]
|
||||
//#![allow(dead_code)]
|
||||
|
||||
pub mod model;
|
||||
|
||||
|
@ -251,12 +251,11 @@ pub async fn handle_cli_connection(
|
||||
let wait = async move {
|
||||
if paths.is_empty() {
|
||||
let (done_tx, done_rx) = oneshot::channel();
|
||||
let _subscription =
|
||||
workspace.update(&mut cx, |workspace, cx| {
|
||||
cx.on_release(move |_, _, _| {
|
||||
let _ = done_tx.send(());
|
||||
})
|
||||
});
|
||||
let _subscription = workspace.update(&mut cx, |_, cx| {
|
||||
cx.on_release(move |_, _, _| {
|
||||
let _ = done_tx.send(());
|
||||
})
|
||||
});
|
||||
let _ = done_rx.await;
|
||||
} else {
|
||||
let _ = futures::future::try_join_all(item_release_futures)
|
||||
|
@ -1,6 +1,3 @@
|
||||
#![allow(unused_variables, unused_mut)]
|
||||
//todo!()
|
||||
|
||||
mod app_menus;
|
||||
mod assets;
|
||||
pub mod languages;
|
||||
@ -37,9 +34,8 @@ use util::{
|
||||
use uuid::Uuid;
|
||||
use workspace::Pane;
|
||||
use workspace::{
|
||||
create_and_open_local_file, dock::PanelHandle,
|
||||
notifications::simple_message_notification::MessageNotification, open_new, AppState, NewFile,
|
||||
NewWindow, Workspace, WorkspaceSettings,
|
||||
create_and_open_local_file, notifications::simple_message_notification::MessageNotification,
|
||||
open_new, AppState, NewFile, NewWindow, Workspace, WorkspaceSettings,
|
||||
};
|
||||
use zed_actions::{OpenBrowser, OpenSettings, OpenZedURL, Quit};
|
||||
|
||||
@ -184,7 +180,6 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||
)?;
|
||||
|
||||
workspace_handle.update(&mut cx, |workspace, cx| {
|
||||
let project_panel_position = project_panel.position(cx);
|
||||
workspace.add_panel(project_panel, cx);
|
||||
workspace.add_panel(terminal_panel, cx);
|
||||
workspace.add_panel(assistant_panel, cx);
|
||||
@ -473,7 +468,7 @@ fn quit(_: &mut Workspace, _: &Quit, cx: &mut gpui::ViewContext<Workspace>) {
|
||||
})
|
||||
.log_err();
|
||||
|
||||
if let (true, Some(window)) = (should_confirm, workspace_windows.first().copied()) {
|
||||
if let (true, Some(_)) = (should_confirm, workspace_windows.first().copied()) {
|
||||
let answer = cx
|
||||
.update(|_, cx| {
|
||||
cx.prompt(
|
||||
@ -484,7 +479,7 @@ fn quit(_: &mut Workspace, _: &Quit, cx: &mut gpui::ViewContext<Workspace>) {
|
||||
})
|
||||
.log_err();
|
||||
|
||||
if let Some(mut answer) = answer {
|
||||
if let Some(answer) = answer {
|
||||
let answer = answer.await.ok();
|
||||
if answer != Some(0) {
|
||||
return Ok(());
|
||||
|
Loading…
Reference in New Issue
Block a user