Compare commits

..

2 Commits

Author SHA1 Message Date
Antonio Scandurra
511e229ee7 WIP 2025-02-19 14:54:08 +01:00
Antonio Scandurra
9c2acc16c8 WIP 2025-02-19 14:43:05 +01:00
53 changed files with 314 additions and 323 deletions

2
Cargo.lock generated
View File

@@ -16664,7 +16664,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.175.3"
version = "0.175.0"
dependencies = [
"activity_indicator",
"anyhow",

View File

@@ -701,6 +701,7 @@ codegen-units = 16
[workspace.lints.clippy]
dbg_macro = "deny"
todo = "deny"
too_many_arguments = "allow"
# Motivation: We use `vec![a..b]` a lot when dealing with ranges in text, so
# warning on this rule produces a lot of noise.

View File

@@ -387,7 +387,6 @@ impl InlineAssistant {
}
}
#[allow(clippy::too_many_arguments)]
pub fn suggest_assist(
&mut self,
editor: &Entity<Editor>,
@@ -1675,7 +1674,6 @@ impl Focusable for PromptEditor {
impl PromptEditor {
const MAX_LINES: u8 = 8;
#[allow(clippy::too_many_arguments)]
fn new(
id: InlineAssistId,
gutter_dimensions: Arc<Mutex<GutterDimensions>>,
@@ -2334,7 +2332,6 @@ struct InlineAssist {
}
impl InlineAssist {
#[allow(clippy::too_many_arguments)]
fn new(
assist_id: InlineAssistId,
group_id: InlineAssistGroupId,

View File

@@ -702,7 +702,6 @@ impl Focusable for PromptEditor {
impl PromptEditor {
const MAX_LINES: u8 = 8;
#[allow(clippy::too_many_arguments)]
fn new(
id: TerminalInlineAssistId,
prompt_history: VecDeque<String>,

View File

@@ -36,7 +36,6 @@ pub struct ContextStrip {
}
impl ContextStrip {
#[allow(clippy::too_many_arguments)]
pub fn new(
context_store: Entity<ContextStore>,
workspace: WeakEntity<Workspace>,

View File

@@ -480,7 +480,6 @@ impl InlineAssistant {
}
}
#[allow(clippy::too_many_arguments)]
pub fn suggest_assist(
&mut self,
editor: &Entity<Editor>,
@@ -1451,7 +1450,6 @@ struct InlineAssistScrollLock {
}
impl EditorInlineAssists {
#[allow(clippy::too_many_arguments)]
fn new(editor: &Entity<Editor>, window: &mut Window, cx: &mut App) -> Self {
let (highlight_updates_tx, mut highlight_updates_rx) = async_watch::channel(());
Self {
@@ -1563,7 +1561,6 @@ pub struct InlineAssist {
}
impl InlineAssist {
#[allow(clippy::too_many_arguments)]
fn new(
assist_id: InlineAssistId,
group_id: InlineAssistGroupId,

View File

@@ -823,7 +823,6 @@ impl InlineAssistId {
}
impl PromptEditor<BufferCodegen> {
#[allow(clippy::too_many_arguments)]
pub fn new_buffer(
id: InlineAssistId,
gutter_dimensions: Arc<Mutex<GutterDimensions>>,
@@ -984,7 +983,6 @@ impl TerminalInlineAssistId {
}
impl PromptEditor<TerminalCodegen> {
#[allow(clippy::too_many_arguments)]
pub fn new_terminal(
id: TerminalInlineAssistId,
prompt_history: VecDeque<String>,

View File

@@ -650,7 +650,6 @@ impl AssistantContext {
)
}
#[allow(clippy::too_many_arguments)]
pub fn new(
id: ContextId,
replica_id: ReplicaId,
@@ -771,7 +770,6 @@ impl AssistantContext {
}
}
#[allow(clippy::too_many_arguments)]
pub fn deserialize(
saved_context: SavedContext,
path: PathBuf,

View File

@@ -517,7 +517,6 @@ impl ContextEditor {
}
}
#[allow(clippy::too_many_arguments)]
pub fn run_command(
&mut self,
command_range: Range<language::Anchor>,
@@ -2058,7 +2057,6 @@ impl ContextEditor {
.unwrap_or_else(|| Cow::Borrowed(DEFAULT_TAB_TITLE))
}
#[allow(clippy::too_many_arguments)]
fn render_patch_block(
&mut self,
range: Range<text::Anchor>,

View File

@@ -136,7 +136,6 @@ impl SlashCommandCompletionProvider {
})
}
#[allow(clippy::too_many_arguments)]
fn complete_command_argument(
&self,
command_name: &str,

View File

@@ -88,7 +88,7 @@ pub trait SlashCommand: 'static + Send + Sync {
fn accepts_arguments(&self) -> bool {
self.requires_argument()
}
#[allow(clippy::too_many_arguments)]
fn run(
self: Arc<Self>,
arguments: &[String],

View File

@@ -719,7 +719,6 @@ impl BufferDiff {
Some(start..end)
}
#[allow(clippy::too_many_arguments)]
pub async fn update_diff(
this: Entity<BufferDiff>,
buffer: text::BufferSnapshot,

View File

@@ -229,7 +229,6 @@ impl Database {
}
/// Creates a new channel message.
#[allow(clippy::too_many_arguments)]
pub async fn create_channel_message(
&self,
channel_id: ChannelId,

View File

@@ -122,7 +122,6 @@ impl Database {
.await
}
#[allow(clippy::too_many_arguments)]
pub async fn get_or_create_user_by_github_account_tx(
&self,
github_login: &str,

View File

@@ -289,7 +289,6 @@ impl LlmDatabase {
.await
}
#[allow(clippy::too_many_arguments)]
pub async fn record_usage(
&self,
user_id: UserId,
@@ -554,7 +553,6 @@ impl LlmDatabase {
.await
}
#[allow(clippy::too_many_arguments)]
async fn update_usage_for_measure(
&self,
user_id: UserId,

View File

@@ -33,7 +33,6 @@ pub struct LlmTokenClaims {
const LLM_TOKEN_LIFETIME: Duration = Duration::from_secs(60 * 60);
impl LlmTokenClaims {
#[allow(clippy::too_many_arguments)]
pub fn create(
user: &user::Model,
is_staff: bool,

View File

@@ -691,7 +691,6 @@ impl Server {
})
}
#[allow(clippy::too_many_arguments)]
pub fn handle_connection(
self: &Arc<Self>,
connection: Connection,
@@ -1075,7 +1074,6 @@ pub fn routes(server: Arc<Server>) -> Router<(), Body> {
.layer(Extension(server))
}
#[allow(clippy::too_many_arguments)]
pub async fn handle_websocket_request(
TypedHeader(ProtocolVersion(protocol_version)): TypedHeader<ProtocolVersion>,
app_version_header: Option<TypedHeader<AppVersionHeader>>,

View File

@@ -463,7 +463,6 @@ impl<T: RandomizedTest> TestPlan<T> {
})
}
#[allow(clippy::too_many_arguments)]
async fn apply_server_operation(
plan: Arc<Mutex<Self>>,
deterministic: BackgroundExecutor,

View File

@@ -869,7 +869,6 @@ impl CollabPanel {
})
}
#[allow(clippy::too_many_arguments)]
fn render_participant_project(
&self,
project_id: u64,

View File

@@ -113,7 +113,6 @@ pub struct DisplayMap {
}
impl DisplayMap {
#[allow(clippy::too_many_arguments)]
pub fn new(
buffer: Entity<MultiBuffer>,
font: Font,

View File

@@ -723,7 +723,6 @@ impl BlockMap {
self.show_excerpt_controls
}
#[allow(clippy::too_many_arguments)]
fn header_and_footer_blocks<'a, R, T>(
show_excerpt_controls: bool,
excerpt_footer_height: u32,

View File

@@ -4782,15 +4782,6 @@ impl Editor {
self.clear_background_highlights::<SelectedTextHighlight>(cx);
return;
}
if self.selections.count() != 1 || self.selections.line_mode {
self.clear_background_highlights::<SelectedTextHighlight>(cx);
return;
}
let selection = self.selections.newest::<Point>(cx);
if selection.is_empty() || selection.start.row != selection.end.row {
self.clear_background_highlights::<SelectedTextHighlight>(cx);
return;
}
let debounce = EditorSettings::get_global(cx).selection_highlight_debounce;
self.selection_highlight_task = Some(cx.spawn_in(window, |editor, mut cx| async move {
cx.background_executor()
@@ -4811,7 +4802,6 @@ impl Editor {
Some(cx.background_spawn(async move {
let mut ranges = Vec::new();
let query = buffer.text_for_range(selection.range()).collect::<String>();
let selection_anchors = selection.range().to_anchors(&buffer);
for range in [buffer.anchor_before(0)..buffer.anchor_after(buffer.len())] {
for (search_buffer, search_range, excerpt_id) in
buffer.range_to_buffer_ranges(range)
@@ -4830,22 +4820,17 @@ impl Editor {
.search(search_buffer, Some(search_range.clone()))
.await
.into_iter()
.filter_map(
|match_range| {
let start = search_buffer.anchor_after(
search_range.start + match_range.start,
);
let end = search_buffer.anchor_before(
search_range.start + match_range.end,
);
let range = Anchor::range_in_buffer(
excerpt_id,
search_buffer.remote_id(),
start..end,
);
(range != selection_anchors).then_some(range)
},
),
.map(|match_range| {
let start = search_buffer
.anchor_after(search_range.start + match_range.start);
let end = search_buffer
.anchor_before(search_range.start + match_range.end);
Anchor::range_in_buffer(
excerpt_id,
search_buffer.remote_id(),
start..end,
)
}),
);
}
}
@@ -5934,7 +5919,6 @@ impl Editor {
editor_bg_color.blend(accent_color.opacity(0.1))
}
#[allow(clippy::too_many_arguments)]
fn render_edit_prediction_cursor_popover(
&self,
min_width: Pixels,
@@ -7113,10 +7097,10 @@ impl Editor {
cx: &mut Context<Self>,
) {
let selections = self.selections.all(cx).into_iter().map(|s| s.range());
self.revert_hunks_in_ranges(selections, window, cx);
self.discard_hunks_in_ranges(selections, window, cx);
}
fn revert_hunks_in_ranges(
fn discard_hunks_in_ranges(
&mut self,
ranges: impl Iterator<Item = Range<Point>>,
window: &mut Window,

View File

@@ -18,10 +18,10 @@ use crate::{
BlockId, ChunkReplacement, CursorShape, CustomBlockId, DisplayPoint, DisplayRow,
DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, Editor, EditorMode,
EditorSettings, EditorSnapshot, EditorStyle, ExpandExcerpts, FocusedBlock, GoToHunk,
GoToPrevHunk, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor,
InlineCompletion, JumpData, LineDown, LineUp, OpenExcerpts, PageDown, PageUp, Point,
RevertSelectedHunks, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection,
SoftWrap, StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS,
GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor, InlineCompletion,
JumpData, LineDown, LineUp, OpenExcerpts, PageDown, PageUp, Point, RevertSelectedHunks, RowExt,
RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, SoftWrap, StickyHeaderExcerpt,
ToPoint, ToggleFold, ToggleStagedSelectedDiffHunks, COLUMNAR_SELECTION_MODIFIERS,
CURSORS_VISIBLE_FOR, FILE_HEADER_HEIGHT, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, MAX_LINE_LEN,
MULTI_BUFFER_EXCERPT_HEADER_HEIGHT,
};
@@ -34,8 +34,8 @@ use gpui::{
anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline, pattern_slash,
point, px, quad, relative, size, svg, transparent_black, Action, AnyElement, App,
AvailableSpace, Axis, Bounds, ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners,
CursorStyle, DispatchPhase, Edges, Element, ElementInputHandler, Entity, Focusable as _,
FontId, GlobalElementId, Hitbox, Hsla, InteractiveElement, IntoElement, Keystroke, Length,
CursorStyle, DispatchPhase, Edges, Element, ElementInputHandler, Entity, Focusable, FontId,
GlobalElementId, Hitbox, Hsla, InteractiveElement, IntoElement, Keystroke, Length,
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad,
ParentElement, Pixels, ScrollDelta, ScrollWheelEvent, ShapedLine, SharedString, Size,
StatefulInteractiveElement, Style, Styled, Subscription, TextRun, TextStyleRefinement,
@@ -931,7 +931,6 @@ impl EditorElement {
cx.notify()
}
#[allow(clippy::too_many_arguments)]
fn layout_selections(
&self,
start_anchor: Anchor,
@@ -1103,7 +1102,6 @@ impl EditorElement {
cursors
}
#[allow(clippy::too_many_arguments)]
fn layout_visible_cursors(
&self,
snapshot: &EditorSnapshot,
@@ -1453,7 +1451,6 @@ impl EditorElement {
axis_pair(horizontal_scrollbar, vertical_scrollbar)
}
#[allow(clippy::too_many_arguments)]
fn prepaint_crease_toggles(
&self,
crease_toggles: &mut [Option<AnyElement>],
@@ -1488,7 +1485,6 @@ impl EditorElement {
}
}
#[allow(clippy::too_many_arguments)]
fn prepaint_crease_trailers(
&self,
trailers: Vec<Option<AnyElement>>,
@@ -1604,7 +1600,6 @@ impl EditorElement {
display_hunks
}
#[allow(clippy::too_many_arguments)]
fn layout_inline_blame(
&self,
display_row: DisplayRow,
@@ -1691,7 +1686,6 @@ impl EditorElement {
Some(element)
}
#[allow(clippy::too_many_arguments)]
fn layout_blame_entries(
&self,
buffer_rows: &[RowInfo],
@@ -1760,7 +1754,6 @@ impl EditorElement {
Some(shaped_lines)
}
#[allow(clippy::too_many_arguments)]
fn layout_indent_guides(
&self,
content_origin: gpui::Point<Pixels>,
@@ -1878,7 +1871,6 @@ impl EditorElement {
(offset_y, length)
}
#[allow(clippy::too_many_arguments)]
fn layout_run_indicators(
&self,
line_height: Pixels,
@@ -1971,7 +1963,6 @@ impl EditorElement {
})
}
#[allow(clippy::too_many_arguments)]
fn layout_code_actions_indicator(
&self,
line_height: Pixels,
@@ -2070,7 +2061,6 @@ impl EditorElement {
relative_rows
}
#[allow(clippy::too_many_arguments)]
fn layout_line_numbers(
&self,
gutter_hitbox: Option<&Hitbox>,
@@ -2283,7 +2273,6 @@ impl EditorElement {
}
}
#[allow(clippy::too_many_arguments)]
fn prepaint_lines(
&self,
start_row: DisplayRow,
@@ -2310,7 +2299,6 @@ impl EditorElement {
line_elements
}
#[allow(clippy::too_many_arguments)]
fn render_block(
&self,
block: &Block,
@@ -2772,7 +2760,6 @@ impl EditorElement {
}))
}
#[allow(clippy::too_many_arguments)]
fn render_blocks(
&self,
rows: Range<DisplayRow>,
@@ -2957,7 +2944,6 @@ impl EditorElement {
/// Returns true if any of the blocks changed size since the previous frame. This will trigger
/// a restart of rendering for the editor based on the new sizes.
#[allow(clippy::too_many_arguments)]
fn layout_blocks(
&self,
blocks: &mut Vec<BlockLayout>,
@@ -3001,7 +2987,6 @@ impl EditorElement {
}
}
#[allow(clippy::too_many_arguments)]
fn layout_sticky_buffer_header(
&self,
StickyHeaderExcerpt {
@@ -3076,7 +3061,6 @@ impl EditorElement {
header
}
#[allow(clippy::too_many_arguments)]
fn layout_cursor_popovers(
&self,
line_height: Pixels,
@@ -3265,7 +3249,6 @@ impl EditorElement {
);
}
#[allow(clippy::too_many_arguments)]
fn layout_gutter_menu(
&self,
line_height: Pixels,
@@ -3318,7 +3301,6 @@ impl EditorElement {
);
}
#[allow(clippy::too_many_arguments)]
fn layout_popovers_above_or_below_line(
&self,
target_position: gpui::Point<Pixels>,
@@ -3423,7 +3405,6 @@ impl EditorElement {
Some((laid_out_popovers, y_flipped))
}
#[allow(clippy::too_many_arguments)]
fn layout_context_menu_aside(
&self,
y_flipped: bool,
@@ -3545,7 +3526,6 @@ impl EditorElement {
}
}
#[allow(clippy::too_many_arguments)]
fn layout_edit_prediction_popover(
&self,
text_bounds: &Bounds<Pixels>,
@@ -4002,7 +3982,6 @@ impl EditorElement {
Some(element)
}
#[allow(clippy::too_many_arguments)]
fn layout_hover_popovers(
&self,
snapshot: &EditorSnapshot,
@@ -4119,7 +4098,6 @@ impl EditorElement {
}
}
#[allow(clippy::too_many_arguments)]
fn layout_diff_hunk_controls(
&self,
row_range: Range<DisplayRow>,
@@ -4174,13 +4152,16 @@ impl EditorElement {
let y = display_row_range.start.as_f32() * line_height
+ text_hitbox.bounds.top()
- scroll_pixel_position.y;
let x = text_hitbox.bounds.right() - px(100.);
let x = text_hitbox.bounds.right()
- rems(6.).to_pixels(window.rem_size())
- px(33.);
let mut element = diff_hunk_controls(
display_row_range.start.0,
multi_buffer_range.clone(),
line_height,
&editor,
window,
cx,
);
element.prepaint_as_root(
@@ -4197,7 +4178,6 @@ impl EditorElement {
controls
}
#[allow(clippy::too_many_arguments)]
fn layout_signature_help(
&self,
hitbox: &Hitbox,
@@ -5436,7 +5416,6 @@ impl EditorElement {
});
}
#[allow(clippy::too_many_arguments)]
fn paint_highlighted_range(
&self,
range: Range<DisplayPoint>,
@@ -5851,7 +5830,6 @@ impl AcceptEditPredictionBinding {
}
}
#[allow(clippy::too_many_arguments)]
fn prepaint_gutter_button(
button: IconButton,
row: DisplayRow,
@@ -6091,7 +6069,6 @@ impl fmt::Debug for LineFragment {
}
impl LineWithInvisibles {
#[allow(clippy::too_many_arguments)]
fn from_chunks<'a>(
chunks: impl Iterator<Item = HighlightedChunk<'a>>,
editor_style: &EditorStyle,
@@ -6296,7 +6273,6 @@ impl LineWithInvisibles {
layouts
}
#[allow(clippy::too_many_arguments)]
fn prepaint(
&mut self,
line_height: Pixels,
@@ -6331,7 +6307,6 @@ impl LineWithInvisibles {
}
}
#[allow(clippy::too_many_arguments)]
fn draw(
&self,
layout: &EditorLayout,
@@ -6375,7 +6350,6 @@ impl LineWithInvisibles {
);
}
#[allow(clippy::too_many_arguments)]
fn draw_invisibles(
&self,
selection_ranges: &[Range<DisplayPoint>],
@@ -7705,7 +7679,6 @@ struct ScrollbarRangeData {
}
impl ScrollbarRangeData {
#[allow(clippy::too_many_arguments)]
pub fn new(
scrollbar_bounds: Bounds<Pixels>,
letter_size: Size<Pixels>,
@@ -8934,8 +8907,13 @@ fn diff_hunk_controls(
hunk_range: Range<Anchor>,
line_height: Pixels,
editor: &Entity<Editor>,
_window: &mut Window,
cx: &mut App,
) -> AnyElement {
let stage = editor.update(cx, |editor, cx| {
let snapshot = editor.buffer.read(cx).snapshot(cx);
editor.has_stageable_diff_hunks_in_ranges(&[hunk_range.start..hunk_range.start], &snapshot)
});
h_flex()
.h(line_height)
.mr_1()
@@ -8948,59 +8926,7 @@ fn diff_hunk_controls(
.bg(cx.theme().colors().editor_background)
.gap_1()
.child(
IconButton::new(("next-hunk", row as u64), IconName::ArrowDown)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
// .disabled(!has_multiple_hunks)
.tooltip({
let focus_handle = editor.focus_handle(cx);
move |window, cx| {
Tooltip::for_action_in("Next Hunk", &GoToHunk, &focus_handle, window, cx)
}
})
.on_click({
let editor = editor.clone();
move |_event, window, cx| {
editor.update(cx, |editor, cx| {
let snapshot = editor.snapshot(window, cx);
let position = hunk_range.end.to_point(&snapshot.buffer_snapshot);
editor.go_to_hunk_after_position(&snapshot, position, window, cx);
editor.expand_selected_diff_hunks(cx);
});
}
}),
)
.child(
IconButton::new(("prev-hunk", row as u64), IconName::ArrowUp)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
// .disabled(!has_multiple_hunks)
.tooltip({
let focus_handle = editor.focus_handle(cx);
move |window, cx| {
Tooltip::for_action_in(
"Previous Hunk",
&GoToPrevHunk,
&focus_handle,
window,
cx,
)
}
})
.on_click({
let editor = editor.clone();
move |_event, window, cx| {
editor.update(cx, |editor, cx| {
let snapshot = editor.snapshot(window, cx);
let point = hunk_range.start.to_point(&snapshot.buffer_snapshot);
editor.go_to_hunk_before_position(&snapshot, point, window, cx);
editor.expand_selected_diff_hunks(cx);
});
}
}),
)
.child(
IconButton::new("discard", IconName::Undo)
IconButton::new(("discard-hunk", row as u64), IconName::Undo)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
.tooltip({
@@ -9021,10 +8947,59 @@ fn diff_hunk_controls(
editor.update(cx, |editor, cx| {
let snapshot = editor.snapshot(window, cx);
let point = hunk_range.start.to_point(&snapshot.buffer_snapshot);
editor.revert_hunks_in_ranges([point..point].into_iter(), window, cx);
editor.discard_hunks_in_ranges([point..point].into_iter(), window, cx);
});
}
}),
)
.child(
Button::new(("skip-hunk", row as u64), "Skip")
.label_size(LabelSize::Small)
.tooltip({
let focus_handle = editor.focus_handle(cx);
move |window, cx| {
Tooltip::for_action_in("Skip Hunk", &GoToHunk, &focus_handle, window, cx)
}
})
.on_click({
let editor = editor.clone();
move |_event, window, cx| {
editor.update(cx, |editor, cx| {
let snapshot = editor.snapshot(window, cx);
let position = hunk_range.end.to_point(&snapshot.buffer_snapshot);
editor.go_to_hunk_after_position(&snapshot, position, window, cx);
editor.expand_selected_diff_hunks(cx);
});
}
}),
)
.child(
Button::new(
("stage-unstage-hunk", row as u64),
if stage { "Stage" } else { "Unstage" },
)
.label_size(LabelSize::Small)
.tooltip({
let focus_handle = editor.focus_handle(cx);
move |window, cx| {
Tooltip::for_action_in(
if stage { "Stage Hunk" } else { "Unstage Hunk" },
&ToggleStagedSelectedDiffHunks,
&focus_handle,
window,
cx,
)
}
})
.on_click({
let editor = editor.clone();
move |_event, _window, cx| {
editor.update(cx, |editor, cx| {
editor
.stage_or_unstage_diff_hunks(&[hunk_range.start..hunk_range.start], cx);
});
}
}),
)
.into_any_element()
}

View File

@@ -224,7 +224,6 @@ impl ScrollManager {
self.anchor.scroll_position(snapshot)
}
#[allow(clippy::too_many_arguments)]
fn set_scroll_position(
&mut self,
scroll_position: gpui::Point<f32>,
@@ -299,7 +298,6 @@ impl ScrollManager {
);
}
#[allow(clippy::too_many_arguments)]
fn set_anchor(
&mut self,
anchor: ScrollAnchor,

View File

@@ -399,7 +399,6 @@ async fn run_evaluation(
}
}
#[allow(clippy::too_many_arguments)]
async fn run_eval_project(
evaluation_project: EvaluationProject,
user_store: &Entity<UserStore>,

View File

@@ -191,7 +191,7 @@ static mut EXTENSION: Option<Box<dyn Extension>> = None;
pub static ZED_API_VERSION: [u8; 6] = *include_bytes!(concat!(env!("OUT_DIR"), "/version_bytes"));
mod wit {
#![allow(clippy::too_many_arguments, clippy::missing_safety_doc)]
#![allow(clippy::missing_safety_doc)]
wit_bindgen::generate!({
skip: ["init-extension"],

View File

@@ -218,7 +218,6 @@ impl ExtensionStore {
cx.global::<GlobalExtensionStore>().0.clone()
}
#[allow(clippy::too_many_arguments)]
pub fn new(
extensions_dir: PathBuf,
build_dir: Option<PathBuf>,

View File

@@ -25,6 +25,7 @@ use project::{PathMatchCandidateSet, Project, ProjectPath, WorktreeId};
use settings::Settings;
use std::{
cmp,
ops::Range,
path::{Path, PathBuf},
sync::{
atomic::{self, AtomicBool},
@@ -381,6 +382,7 @@ impl PartialOrd for ProjectPanelOrdMatch {
struct Matches {
separate_history: bool,
matches: Vec<Match>,
elided_byte_range: Option<Range<usize>>,
}
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
@@ -392,6 +394,35 @@ enum Match {
Search(ProjectPanelOrdMatch),
}
struct MatchLabels {
path: String,
path_positions: Vec<usize>,
file_name: String,
file_name_positions: Vec<usize>,
}
#[derive(Clone, Copy, Debug)]
struct EmWidths {
normal: Pixels,
small: Pixels,
}
fn em_widths(window: &mut Window, cx: &mut App) -> EmWidths {
let style = window.text_style();
let font_id = window.text_system().resolve_font(&style.font());
let font_size = TextSize::Default.rems(cx).to_pixels(window.rem_size());
let normal = cx
.text_system()
.em_width(font_id, font_size)
.unwrap_or(px(16.));
let font_size = TextSize::Small.rems(cx).to_pixels(window.rem_size());
let small = cx
.text_system()
.em_width(font_id, font_size)
.unwrap_or(px(10.));
EmWidths { normal, small }
}
impl Match {
fn path(&self) -> &Arc<Path> {
match self {
@@ -406,6 +437,43 @@ impl Match {
Match::Search(panel_match) => Some(&panel_match),
}
}
fn common_prefix<'a>(&self, other: &'a Path) -> &'a Path {
let mut prefix = other;
let path_positions = match self {
Match::History {
panel_match: Some(mat),
..
}
| Match::Search(mat) => mat.0.positions.as_slice(),
Match::History {
panel_match: None, ..
} => &[],
};
let first_path_position = *path_positions.iter().min().unwrap_or(&0);
while self.path().strip_prefix(prefix).is_err()
|| prefix.to_string_lossy().len() > first_path_position
{
let Some(parent) = prefix.parent() else {
break;
};
prefix = parent;
}
prefix
}
fn approx_width(&self, em_widths: EmWidths) -> Pixels {
let file_name = self.path().file_name().map_or_else(
|| self.path().to_string_lossy(),
|file_name| file_name.to_string_lossy(),
);
let parent = self
.path()
.parent()
.map_or_else(|| "".into(), |parent| parent.to_string_lossy());
px(file_name.chars().count() as f32) * em_widths.normal
+ px(parent.chars().count() as f32) * em_widths.small
}
}
impl Matches {
@@ -451,7 +519,11 @@ impl Matches {
query: Option<&FileSearchQuery>,
new_search_matches: impl Iterator<Item = ProjectPanelOrdMatch>,
extend_old_matches: bool,
em_widths: EmWidths,
max_width: Pixels,
) {
self.elided_byte_range = None;
let Some(query) = query else {
// assuming that if there's no query, then there's no search matches.
self.matches.clear();
@@ -507,6 +579,31 @@ impl Matches {
}
}
}
let Some((first, rest)) = self.matches.split_first() else {
return;
};
let mut prefix = first.path().as_ref();
let mut widest_match = first.approx_width(em_widths);
for mat in rest {
widest_match = widest_match.max(mat.approx_width(em_widths));
prefix = mat.common_prefix(prefix);
}
if widest_match > max_width {
let components = prefix.components().collect::<Vec<_>>();
let prefix = prefix.to_string_lossy();
if components.len() > 3 {
let after_first = components[1..].iter().collect::<PathBuf>();
let after_first = after_first.to_string_lossy();
let start = prefix.len() - after_first.len();
let after_first_before_last = components[1..components.len() - 2]
.iter()
.collect::<PathBuf>();
let after_first_before_last = after_first_before_last.to_string_lossy();
self.elided_byte_range = Some(start..start + after_first_before_last.len());
}
}
}
/// If a < b, then a is a worse match, aligning with the `ProjectPanelOrdMatch` ordering.
@@ -535,6 +632,25 @@ impl Matches {
}
}
impl MatchLabels {
fn check(&self) {
let file_name = &self.file_name;
for i in &self.file_name_positions {
assert!(
self.file_name.is_char_boundary(*i),
"{i} is not a valid char boundary in file name {file_name:?}"
);
}
let path = &self.path;
for i in &self.path_positions {
assert!(
self.path.is_char_boundary(*i),
"{i} is not a valid char boundary in path {path:?}"
);
}
}
}
fn matching_history_items<'a>(
history_items: impl IntoIterator<Item = &'a FoundPath>,
currently_opened: Option<&'a FoundPath>,
@@ -644,7 +760,6 @@ impl FileSearchQuery {
}
impl FileFinderDelegate {
#[allow(clippy::too_many_arguments)]
fn new(
file_finder: WeakEntity<FileFinder>,
workspace: WeakEntity<Workspace>,
@@ -745,10 +860,10 @@ impl FileFinderDelegate {
.map(ProjectPanelOrdMatch);
let did_cancel = cancel_flag.load(atomic::Ordering::Relaxed);
picker
.update(&mut cx, |picker, cx| {
.update_in(&mut cx, |picker, window, cx| {
picker
.delegate
.set_search_matches(search_id, did_cancel, query, matches, cx)
.set_search_matches(search_id, did_cancel, query, matches, window, cx)
})
.log_err();
})
@@ -760,9 +875,13 @@ impl FileFinderDelegate {
did_cancel: bool,
query: FileSearchQuery,
matches: impl IntoIterator<Item = ProjectPanelOrdMatch>,
window: &mut Window,
cx: &mut Context<Picker<Self>>,
) {
let em_widths = em_widths(window, cx);
let file_finder_settings = FileFinderSettings::get_global(cx);
let max_width = FileFinder::modal_max_width(file_finder_settings.modal_max_width, window);
if search_id >= self.latest_search_id {
self.latest_search_id = search_id;
let query_changed = Some(query.path_query())
@@ -784,6 +903,8 @@ impl FileFinderDelegate {
Some(&query),
matches.into_iter(),
extend_old_matches,
em_widths,
max_width,
);
self.selected_index = selected_match.map_or_else(
@@ -802,13 +923,8 @@ impl FileFinderDelegate {
}
}
fn labels_for_match(
&self,
path_match: &Match,
cx: &App,
ix: usize,
) -> (String, Vec<usize>, String, Vec<usize>) {
let (file_name, file_name_positions, full_path, full_path_positions) = match &path_match {
fn labels_for_match(&self, path_match: &Match, cx: &App, ix: usize) -> MatchLabels {
let mut labels = match &path_match {
Match::History {
path: entry_path,
panel_match,
@@ -823,18 +939,18 @@ impl FileFinderDelegate {
if !has_worktree {
if let Some(absolute_path) = &entry_path.absolute {
return (
absolute_path
return MatchLabels {
file_name: absolute_path
.file_name()
.map_or_else(
|| project_relative_path.to_string_lossy(),
|file_name| file_name.to_string_lossy(),
)
.to_string(),
Vec::new(),
absolute_path.to_string_lossy().to_string(),
Vec::new(),
);
file_name_positions: Vec::new(),
path: absolute_path.to_string_lossy().to_string(),
path_positions: Vec::new(),
};
}
}
@@ -865,44 +981,39 @@ impl FileFinderDelegate {
Match::Search(path_match) => self.labels_for_path_match(&path_match.0),
};
if file_name_positions.is_empty() {
if labels.file_name_positions.is_empty() {
if let Some(user_home_path) = std::env::var("HOME").ok() {
let user_home_path = user_home_path.trim();
if !user_home_path.is_empty() {
if (&full_path).starts_with(user_home_path) {
return (
file_name,
file_name_positions,
full_path.replace(user_home_path, "~"),
full_path_positions,
);
if labels.path.starts_with(user_home_path) {
labels.path.replace_range(0..user_home_path.len(), "~");
labels.path_positions.retain_mut(|position| {
if *position >= user_home_path.len() {
*position -= user_home_path.len();
*position += 1;
true
} else {
false
}
})
}
}
}
}
(
file_name,
file_name_positions,
full_path,
full_path_positions,
)
labels.check();
labels
}
fn labels_for_path_match(
&self,
path_match: &PathMatch,
) -> (String, Vec<usize>, String, Vec<usize>) {
let path = &path_match.path;
let path_string = path.to_string_lossy();
let full_path = [path_match.path_prefix.as_ref(), path_string.as_ref()].join("");
fn labels_for_path_match(&self, path_match: &PathMatch) -> MatchLabels {
let mut path_positions = path_match.positions.clone();
let file_name = path.file_name().map_or_else(
let file_name = path_match.path.file_name().map_or_else(
|| path_match.path_prefix.to_string(),
|file_name| file_name.to_string_lossy().to_string(),
);
let file_name_start = path_match.path_prefix.len() + path_string.len() - file_name.len();
let mut path = path_match.path.to_string_lossy().to_string();
let file_name_start = path_match.path_prefix.len() + path.len() - file_name.len();
let file_name_positions = path_positions
.iter()
.filter_map(|pos| {
@@ -914,10 +1025,31 @@ impl FileFinderDelegate {
})
.collect();
let full_path = full_path.trim_end_matches(&file_name).to_string();
path_positions.retain(|idx| *idx < full_path.len());
path.drain(file_name_start.saturating_sub(path_match.path_prefix.len())..);
path_positions.retain_mut(|idx| {
if *idx < path.len() {
if let Some(elided_range) = &self.matches.elided_byte_range {
if *idx >= elided_range.end {
*idx += '…'.len_utf8();
*idx -= elided_range.len();
}
}
true
} else {
false
}
});
(file_name, file_name_positions, full_path, path_positions)
if let Some(elided_range) = &self.matches.elided_byte_range {
path.replace_range(elided_range.clone(), "");
}
MatchLabels {
file_name,
file_name_positions,
path,
path_positions,
}
}
fn lookup_absolute_path(
@@ -969,10 +1101,17 @@ impl FileFinderDelegate {
}
picker
.update_in(&mut cx, |picker, _, cx| {
.update_in(&mut cx, |picker, window, cx| {
let picker_delegate = &mut picker.delegate;
let search_id = util::post_inc(&mut picker_delegate.search_count);
picker_delegate.set_search_matches(search_id, false, query, path_matches, cx);
picker_delegate.set_search_matches(
search_id,
false,
query,
path_matches,
window,
cx,
);
anyhow::Ok(())
})
@@ -1049,6 +1188,10 @@ impl PickerDelegate for FileFinderDelegate {
window: &mut Window,
cx: &mut Context<Picker<Self>>,
) -> Task<()> {
let em_widths = em_widths(window, cx);
let file_finder_settings = FileFinderSettings::get_global(cx);
let max_width = FileFinder::modal_max_width(file_finder_settings.modal_max_width, window);
let raw_query = raw_query.replace(' ', "");
let raw_query = raw_query.trim();
if raw_query.is_empty() {
@@ -1076,6 +1219,8 @@ impl PickerDelegate for FileFinderDelegate {
None,
None.into_iter(),
false,
em_widths,
max_width,
);
self.first_update = false;
@@ -1269,11 +1414,10 @@ impl PickerDelegate for FileFinderDelegate {
.size(IconSize::Small.rems())
.into_any_element(),
};
let (file_name, file_name_positions, full_path, full_path_positions) =
self.labels_for_match(path_match, cx, ix);
let labels = self.labels_for_match(path_match, cx, ix);
let file_icon = if settings.file_icons {
FileIcons::get_icon(Path::new(&file_name), cx)
FileIcons::get_icon(Path::new(&labels.file_name), cx)
.map(Icon::from_path)
.map(|icon| icon.color(Color::Muted))
} else {
@@ -1291,9 +1435,12 @@ impl PickerDelegate for FileFinderDelegate {
h_flex()
.gap_2()
.py_px()
.child(HighlightedLabel::new(file_name, file_name_positions))
.child(HighlightedLabel::new(
labels.file_name,
labels.file_name_positions,
))
.child(
HighlightedLabel::new(full_path, full_path_positions)
HighlightedLabel::new(labels.path, labels.path_positions)
.size(LabelSize::Small)
.color(Color::Muted),
),

View File

@@ -384,6 +384,7 @@ async fn test_matching_cancellation(cx: &mut TestAppContext) {
ProjectPanelOrdMatch(matches[1].clone()),
ProjectPanelOrdMatch(matches[3].clone()),
],
window,
cx,
);
@@ -398,6 +399,7 @@ async fn test_matching_cancellation(cx: &mut TestAppContext) {
ProjectPanelOrdMatch(matches[2].clone()),
ProjectPanelOrdMatch(matches[3].clone()),
],
window,
cx,
);
@@ -492,12 +494,11 @@ async fn test_single_file_worktrees(cx: &mut TestAppContext) {
let matches = collect_search_matches(picker).search_matches_only();
assert_eq!(matches.len(), 1);
let (file_name, file_name_positions, full_path, full_path_positions) =
delegate.labels_for_path_match(&matches[0]);
assert_eq!(file_name, "the-file");
assert_eq!(file_name_positions, &[0, 1, 4]);
assert_eq!(full_path, "");
assert_eq!(full_path_positions, &[0; 0]);
let labels = delegate.labels_for_path_match(&matches[0]);
assert_eq!(labels.file_name, "the-file");
assert_eq!(labels.file_name_positions, &[0, 1, 4]);
assert_eq!(labels.path, "");
assert_eq!(labels.path_positions, &[0; 0]);
});
// Since the worktree root is a file, searching for its name followed by a slash does

View File

@@ -164,7 +164,6 @@ impl<'a> Matcher<'a> {
score
}
#[allow(clippy::too_many_arguments)]
fn recursive_score_match(
&mut self,
path: &[char],

View File

@@ -115,7 +115,6 @@ pub struct WaylandWindowStatePtr {
}
impl WaylandWindowState {
#[allow(clippy::too_many_arguments)]
pub(crate) fn new(
handle: AnyWindowHandle,
surface: wl_surface::WlSurface,

View File

@@ -353,7 +353,6 @@ where
}
impl X11WindowState {
#[allow(clippy::too_many_arguments)]
pub fn new(
handle: AnyWindowHandle,
client: X11ClientStatePtr,
@@ -712,7 +711,6 @@ enum WmHintPropertyState {
}
impl X11Window {
#[allow(clippy::too_many_arguments)]
pub fn new(
handle: AnyWindowHandle,
client: X11ClientStatePtr,

View File

@@ -455,14 +455,7 @@ vertex PathRasterizationVertexOutput path_rasterization_vertex(
fragment float4 path_rasterization_fragment(PathRasterizationFragmentInput input
[[stage_in]]) {
float2 dx = dfdx(input.st_position);
float2 dy = dfdy(input.st_position);
float2 gradient = float2((2. * input.st_position.x) * dx.x - dx.y,
(2. * input.st_position.x) * dy.x - dy.y);
float f = (input.st_position.x * input.st_position.x) - input.st_position.y;
float distance = f / length(gradient);
float alpha = saturate(0.5 - distance);
return float4(alpha, 0., 0., 1.);
return float4(1., 0., 0., 1.);
}
struct PathSpriteVertexOutput {
@@ -517,7 +510,7 @@ fragment float4 path_sprite_fragment(
min_filter::linear);
float4 sample =
atlas_texture.sample(atlas_texture_sampler, input.tile_position);
float mask = 1. - abs(1. - fmod(sample.r, 2.));
float mask = sample.r;
PathSprite sprite = sprites[input.sprite_id];
Background background = sprite.color;
float4 color = fill_color(background, input.position.xy, sprite.bounds,

View File

@@ -132,7 +132,6 @@ impl WrappedLine {
}
}
#[allow(clippy::too_many_arguments)]
fn paint_line(
origin: Point<Pixels>,
layout: &LineLayout,

View File

@@ -1250,7 +1250,6 @@ fn parse_text(
})
}
#[allow(clippy::too_many_arguments)]
fn get_injections(
config: &InjectionConfig,
text: &BufferSnapshot,

View File

@@ -100,7 +100,6 @@ pub struct LanguageServer {
output_done_rx: Mutex<Option<barrier::Receiver>>,
server: Arc<Mutex<Option<Child>>>,
workspace_folders: Arc<Mutex<BTreeSet<Url>>>,
root_uri: Url,
}
/// Identifies a running language server.
@@ -370,8 +369,6 @@ impl LanguageServer {
let stdin = server.stdin.take().unwrap();
let stdout = server.stdout.take().unwrap();
let stderr = server.stderr.take().unwrap();
let root_uri = Url::from_file_path(&working_dir)
.map_err(|_| anyhow!("{} is not a valid URI", working_dir.display()))?;
let server = Self::new_internal(
server_id,
server_name,
@@ -382,7 +379,6 @@ impl LanguageServer {
Some(server),
code_action_kinds,
binary,
root_uri,
cx,
move |notification| {
log::info!(
@@ -397,7 +393,6 @@ impl LanguageServer {
Ok(server)
}
#[allow(clippy::too_many_arguments)]
fn new_internal<Stdin, Stdout, Stderr, F>(
server_id: LanguageServerId,
server_name: LanguageServerName,
@@ -408,7 +403,6 @@ impl LanguageServer {
server: Option<Child>,
code_action_kinds: Option<Vec<CodeActionKind>>,
binary: LanguageServerBinary,
root_uri: Url,
cx: AsyncApp,
on_unhandled_notification: F,
) -> Self
@@ -492,7 +486,6 @@ impl LanguageServer {
output_done_rx: Mutex::new(Some(output_done_rx)),
server: Arc::new(Mutex::new(server)),
workspace_folders: Default::default(),
root_uri,
}
}
@@ -621,7 +614,7 @@ impl LanguageServer {
InitializeParams {
process_id: None,
root_path: None,
root_uri: Some(self.root_uri.clone()),
root_uri: None,
initialization_options: None,
capabilities: ClientCapabilities {
general: Some(GeneralClientCapabilities {
@@ -791,7 +784,7 @@ impl LanguageServer {
}),
},
trace: None,
workspace_folders: Some(vec![]),
workspace_folders: None,
client_info: release_channel::ReleaseChannel::try_global(cx).map(|release_channel| {
ClientInfo {
name: release_channel.display_name().to_string(),
@@ -1391,7 +1384,6 @@ impl FakeLanguageServer {
let server_name = LanguageServerName(name.clone().into());
let process_name = Arc::from(name.as_str());
let root = Self::root_path();
let mut server = LanguageServer::new_internal(
server_id,
server_name.clone(),
@@ -1402,7 +1394,6 @@ impl FakeLanguageServer {
None,
None,
binary.clone(),
root,
cx.clone(),
|_| {},
);
@@ -1420,7 +1411,6 @@ impl FakeLanguageServer {
None,
None,
binary,
Self::root_path(),
cx.clone(),
move |msg| {
notifications_tx
@@ -1455,15 +1445,6 @@ impl FakeLanguageServer {
(server, fake)
}
#[cfg(target_os = "windows")]
fn root_path() -> Url {
Url::from_file_path("C:/").unwrap()
}
#[cfg(not(target_os = "windows"))]
fn root_path() -> Url {
Url::from_file_path("/").unwrap()
}
}
#[cfg(any(test, feature = "test-support"))]

View File

@@ -2902,7 +2902,6 @@ impl MultiBuffer {
snapshot.check_invariants();
}
#[allow(clippy::too_many_arguments)]
fn recompute_diff_transforms_for_edit(
&self,
edit: &Edit<TypedOffset<Excerpt>>,

View File

@@ -2360,7 +2360,6 @@ impl OutlinePanel {
)
}
#[allow(clippy::too_many_arguments)]
fn render_search_match(
&mut self,
multi_buffer_snapshot: Option<&MultiBufferSnapshot>,
@@ -2452,7 +2451,6 @@ impl OutlinePanel {
))
}
#[allow(clippy::too_many_arguments)]
fn entry_element(
&self,
rendered_entry: PanelEntry,
@@ -3836,7 +3834,6 @@ impl OutlinePanel {
})
}
#[allow(clippy::too_many_arguments)]
fn push_entry(
&self,
state: &mut GenerationState,
@@ -4054,7 +4051,6 @@ impl OutlinePanel {
update_cached_entries
}
#[allow(clippy::too_many_arguments)]
fn add_excerpt_entries(
&self,
state: &mut GenerationState,
@@ -4113,7 +4109,6 @@ impl OutlinePanel {
}
}
#[allow(clippy::too_many_arguments)]
fn add_search_entries(
&mut self,
state: &mut GenerationState,

View File

@@ -1201,7 +1201,6 @@ impl LocalLspStore {
Ok(project_transaction)
}
#[allow(clippy::too_many_arguments)]
async fn execute_formatters(
lsp_store: WeakEntity<LspStore>,
formatters: &[Formatter],
@@ -1451,7 +1450,6 @@ impl LocalLspStore {
}
}
#[allow(clippy::too_many_arguments)]
async fn format_via_lsp(
this: &WeakEntity<LspStore>,
buffer: &Entity<Buffer>,
@@ -2960,7 +2958,6 @@ impl LspStore {
}
}
#[allow(clippy::too_many_arguments)]
pub fn new_local(
buffer_store: Entity<BufferStore>,
worktree_store: Entity<WorktreeStore>,
@@ -3054,7 +3051,6 @@ impl LspStore {
})
}
#[allow(clippy::too_many_arguments)]
pub(super) fn new_remote(
buffer_store: Entity<BufferStore>,
worktree_store: Entity<WorktreeStore>,
@@ -4466,7 +4462,6 @@ impl LspStore {
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn resolve_completion_remote(
project_id: u64,
server_id: LanguageServerId,
@@ -7519,7 +7514,6 @@ impl LspStore {
Ok(())
}
#[allow(clippy::too_many_arguments)]
fn insert_newly_running_language_server(
&mut self,
adapter: Arc<CachedLspAdapter>,
@@ -8950,7 +8944,7 @@ fn ensure_uniform_list_compatible_label(label: &mut CodeLabel) {
}
_ => {
new_text.push(c);
new_idx += c.len_utf8();
new_idx += 1;
last_char_was_space = false;
}
}
@@ -9021,16 +9015,27 @@ fn ensure_uniform_list_compatible_label(label: &mut CodeLabel) {
}
#[cfg(test)]
mod tests {
use language::HighlightId;
#[test]
fn test_glob_literal_prefix() {
assert_eq!(glob_literal_prefix(Path::new("**/*.js")), Path::new(""));
assert_eq!(
glob_literal_prefix(Path::new("node_modules/**/*.js")),
Path::new("node_modules")
);
assert_eq!(
glob_literal_prefix(Path::new("foo/{bar,baz}.js")),
Path::new("foo")
);
assert_eq!(
glob_literal_prefix(Path::new("foo/bar/baz.js")),
Path::new("foo/bar/baz.js")
);
use super::*;
#[test]
fn test_glob_literal_prefix() {
assert_eq!(glob_literal_prefix(Path::new("**/*.js")), Path::new(""));
#[cfg(target_os = "windows")]
{
assert_eq!(glob_literal_prefix(Path::new("**\\*.js")), Path::new(""));
assert_eq!(
glob_literal_prefix(Path::new("node_modules/**/*.js")),
glob_literal_prefix(Path::new("node_modules\\**/*.js")),
Path::new("node_modules")
);
assert_eq!(
@@ -9038,43 +9043,8 @@ mod tests {
Path::new("foo")
);
assert_eq!(
glob_literal_prefix(Path::new("foo/bar/baz.js")),
glob_literal_prefix(Path::new("foo\\bar\\baz.js")),
Path::new("foo/bar/baz.js")
);
#[cfg(target_os = "windows")]
{
assert_eq!(glob_literal_prefix(Path::new("**\\*.js")), Path::new(""));
assert_eq!(
glob_literal_prefix(Path::new("node_modules\\**/*.js")),
Path::new("node_modules")
);
assert_eq!(
glob_literal_prefix(Path::new("foo/{bar,baz}.js")),
Path::new("foo")
);
assert_eq!(
glob_literal_prefix(Path::new("foo\\bar\\baz.js")),
Path::new("foo/bar/baz.js")
);
}
}
#[test]
fn test_multi_len_chars_normalization() {
let mut label = CodeLabel {
text: "myElˇ (parameter) myElˇ: {\n foo: string;\n}".to_string(),
runs: vec![(0..6, HighlightId(1))],
filter_range: 0..6,
};
ensure_uniform_list_compatible_label(&mut label);
assert_eq!(
label,
CodeLabel {
text: "myElˇ (parameter) myElˇ: { foo: string; }".to_string(),
runs: vec![(0..6, HighlightId(1))],
filter_range: 0..6,
}
);
}
}

View File

@@ -971,7 +971,6 @@ impl Project {
.await
}
#[allow(clippy::too_many_arguments)]
async fn from_join_project_response(
response: TypedEnvelope<proto::JoinProjectResponse>,
subscriptions: [EntitySubscription; 5],

View File

@@ -1279,7 +1279,6 @@ impl From<SshRemoteClient> for AnyProtoClient {
#[async_trait(?Send)]
trait RemoteConnection: Send + Sync {
#[allow(clippy::too_many_arguments)]
fn start_proxy(
&self,
unique_identifier: String,

View File

@@ -175,7 +175,6 @@ impl RichText {
}
}
#[allow(clippy::too_many_arguments)]
pub fn render_markdown_mut(
block: &str,
mut mentions: &[Mention],

View File

@@ -116,7 +116,6 @@ impl WorktreeIndex {
})
}
#[allow(clippy::too_many_arguments)]
pub fn new(
worktree: Entity<Worktree>,
db_connection: heed::Env,

View File

@@ -325,7 +325,6 @@ pub struct TerminalBuilder {
}
impl TerminalBuilder {
#[allow(clippy::too_many_arguments)]
pub fn new(
working_directory: Option<PathBuf>,
python_venv_directory: Option<PathBuf>,

View File

@@ -171,7 +171,6 @@ impl InteractiveElement for TerminalElement {
impl StatefulInteractiveElement for TerminalElement {}
impl TerminalElement {
#[allow(clippy::too_many_arguments)]
pub fn new(
terminal: Entity<Terminal>,
terminal_view: Entity<TerminalView>,

View File

@@ -191,7 +191,6 @@ impl TitleBar {
)
}
#[allow(clippy::too_many_arguments)]
fn render_collaborator(
&self,
user: &Arc<User>,

View File

@@ -85,7 +85,6 @@ impl ToolchainSelector {
Some(())
}
#[allow(clippy::too_many_arguments)]
fn new(
workspace: WeakEntity<Workspace>,
project: Entity<Project>,
@@ -143,7 +142,6 @@ pub struct ToolchainSelectorDelegate {
}
impl ToolchainSelectorDelegate {
#[allow(clippy::too_many_arguments)]
fn new(
active_toolchain: Option<Toolchain>,
toolchain_selector: WeakEntity<ToolchainSelector>,

View File

@@ -843,7 +843,6 @@ impl Pane {
}
}
#[allow(clippy::too_many_arguments)]
pub(crate) fn open_item(
&mut self,
project_entry_id: Option<ProjectEntryId>,

View File

@@ -122,7 +122,6 @@ impl PaneGroup {
};
}
#[allow(clippy::too_many_arguments)]
pub fn render(
&self,
project: &Entity<Project>,
@@ -228,7 +227,6 @@ impl Member {
}
}
#[allow(clippy::too_many_arguments)]
pub fn render(
&self,
project: &Entity<Project>,
@@ -678,7 +676,6 @@ impl PaneAxis {
None
}
#[allow(clippy::too_many_arguments)]
fn render(
&self,
project: &Entity<Project>,
@@ -882,7 +879,6 @@ mod element {
self
}
#[allow(clippy::too_many_arguments)]
fn compute_resize(
flexes: &Arc<Mutex<Vec<f32>>>,
e: &MouseMoveEvent,
@@ -972,7 +968,6 @@ mod element {
window.refresh();
}
#[allow(clippy::too_many_arguments)]
fn layout_handle(
axis: Axis,
pane_bounds: Bounds<Pixels>,

View File

@@ -2696,7 +2696,6 @@ impl Workspace {
)
}
#[allow(clippy::too_many_arguments)]
pub fn add_item(
&mut self,
pane: Entity<Pane>,

View File

@@ -2,7 +2,7 @@
description = "The fast, collaborative code editor."
edition.workspace = true
name = "zed"
version = "0.175.3"
version = "0.175.0"
publish.workspace = true
license = "GPL-3.0-or-later"
authors = ["Zed Team <hi@zed.dev>"]

View File

@@ -1 +1 @@
preview
dev

View File

@@ -355,7 +355,6 @@ impl Zeta {
}
}
#[allow(clippy::too_many_arguments)]
fn request_completion_impl<F, R>(
&mut self,
workspace: Option<Entity<Workspace>>,
@@ -793,7 +792,6 @@ and then another
}
}
#[allow(clippy::too_many_arguments)]
fn process_completion_response(
prediction_response: PredictEditsResponse,
buffer: Entity<Buffer>,