chore: Bump Rust edition to 2024 (#27800)
Follow-up to https://github.com/zed-industries/zed/pull/27791 Release Notes: - N/A
This commit is contained in:
parent
d50905e000
commit
dc64ec9cc8
802 changed files with 3775 additions and 3662 deletions
|
@ -8,7 +8,7 @@ use workspace::{OpenOptions, OpenVisible};
|
|||
|
||||
use crate::lsp_ext::find_specific_language_server_in_selection;
|
||||
|
||||
use crate::{element::register_action, Editor, SwitchSourceHeader};
|
||||
use crate::{Editor, SwitchSourceHeader, element::register_action};
|
||||
|
||||
use project::lsp_store::clangd_ext::CLANGD_SERVER_NAME;
|
||||
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
div, px, uniform_list, AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight,
|
||||
ListSizingBehavior, ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText,
|
||||
UniformListScrollHandle,
|
||||
AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight, ListSizingBehavior,
|
||||
ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText, UniformListScrollHandle,
|
||||
div, px, uniform_list,
|
||||
};
|
||||
use language::Buffer;
|
||||
use language::CodeLabel;
|
||||
use markdown::Markdown;
|
||||
use multi_buffer::{Anchor, ExcerptId};
|
||||
use ordered_float::OrderedFloat;
|
||||
use project::lsp_store::CompletionDocumentation;
|
||||
use project::CompletionSource;
|
||||
use project::lsp_store::CompletionDocumentation;
|
||||
use project::{CodeAction, Completion, TaskSourceKind};
|
||||
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
cmp::{min, Reverse},
|
||||
cmp::{Reverse, min},
|
||||
iter,
|
||||
ops::Range,
|
||||
rc::Rc,
|
||||
};
|
||||
use task::ResolvedTask;
|
||||
use ui::{prelude::*, Color, IntoElement, ListItem, Pixels, Popover, Styled};
|
||||
use ui::{Color, IntoElement, ListItem, Pixels, Popover, Styled, prelude::*};
|
||||
use util::ResultExt;
|
||||
|
||||
use crate::hover_popover::{hover_markdown_style, open_markdown_url};
|
||||
use crate::{
|
||||
CodeActionProvider, CompletionId, CompletionProvider, DisplayRow, Editor, EditorStyle,
|
||||
ResolvedTasks,
|
||||
actions::{ConfirmCodeAction, ConfirmCompletion},
|
||||
split_words, styled_runs_for_code_label, CodeActionProvider, CompletionId, CompletionProvider,
|
||||
DisplayRow, Editor, EditorStyle, ResolvedTasks,
|
||||
split_words, styled_runs_for_code_label,
|
||||
};
|
||||
|
||||
pub const MENU_GAP: Pixels = px(4.);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use futures::Future;
|
||||
use git::blame::BlameEntry;
|
||||
use git::PullRequest;
|
||||
use git::blame::BlameEntry;
|
||||
use gpui::{
|
||||
App, Asset, ClipboardItem, Element, Entity, MouseButton, ParentElement, Render, ScrollHandle,
|
||||
StatefulInteractiveElement,
|
||||
|
@ -11,7 +11,7 @@ use std::hash::Hash;
|
|||
use theme::ThemeSettings;
|
||||
use time::{OffsetDateTime, UtcOffset};
|
||||
use time_format::format_local_timestamp;
|
||||
use ui::{prelude::*, tooltip_container, Avatar, Divider, IconButtonShape};
|
||||
use ui::{Avatar, Divider, IconButtonShape, prelude::*, tooltip_container};
|
||||
use url::Url;
|
||||
|
||||
use crate::git::blame::GitRemote;
|
||||
|
|
|
@ -27,7 +27,7 @@ mod tab_map;
|
|||
mod wrap_map;
|
||||
|
||||
use crate::{
|
||||
hover_links::InlayHighlight, movement::TextLayoutDetails, EditorStyle, InlayId, RowExt,
|
||||
EditorStyle, InlayId, RowExt, hover_links::InlayHighlight, movement::TextLayoutDetails,
|
||||
};
|
||||
pub use block_map::{
|
||||
Block, BlockChunks as DisplayChunks, BlockContext, BlockId, BlockMap, BlockPlacement,
|
||||
|
@ -45,8 +45,8 @@ use inlay_map::{InlayMap, InlaySnapshot};
|
|||
pub use inlay_map::{InlayOffset, InlayPoint};
|
||||
pub use invisibles::{is_invisible, replacement};
|
||||
use language::{
|
||||
language_settings::language_settings, ChunkRenderer, OffsetUtf16, Point,
|
||||
Subscription as BufferSubscription,
|
||||
ChunkRenderer, OffsetUtf16, Point, Subscription as BufferSubscription,
|
||||
language_settings::language_settings,
|
||||
};
|
||||
use lsp::DiagnosticSeverity;
|
||||
use multi_buffer::{
|
||||
|
@ -66,7 +66,7 @@ use std::{
|
|||
use sum_tree::{Bias, TreeMap};
|
||||
use tab_map::{TabMap, TabSnapshot};
|
||||
use text::{BufferId, LineIndent};
|
||||
use ui::{px, SharedString};
|
||||
use ui::{SharedString, px};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use wrap_map::{WrapMap, WrapSnapshot};
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ impl Add for DisplayPoint {
|
|||
type Output = Self;
|
||||
|
||||
fn add(self, other: Self) -> Self::Output {
|
||||
DisplayPoint(BlockPoint(self.0 .0 + other.0 .0))
|
||||
DisplayPoint(BlockPoint(self.0.0 + other.0.0))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ impl Sub for DisplayPoint {
|
|||
type Output = Self;
|
||||
|
||||
fn sub(self, other: Self) -> Self::Output {
|
||||
DisplayPoint(BlockPoint(self.0 .0 - other.0 .0))
|
||||
DisplayPoint(BlockPoint(self.0.0 - other.0.0))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1417,18 +1417,19 @@ pub mod tests {
|
|||
movement,
|
||||
test::{marked_display_snapshot, test_font},
|
||||
};
|
||||
use Bias::*;
|
||||
use block_map::BlockPlacement;
|
||||
use gpui::{
|
||||
div, font, observe, px, App, AppContext as _, BorrowAppContext, Element, Hsla, Rgba,
|
||||
App, AppContext as _, BorrowAppContext, Element, Hsla, Rgba, div, font, observe, px,
|
||||
};
|
||||
use language::{
|
||||
language_settings::{AllLanguageSettings, AllLanguageSettingsContent},
|
||||
Buffer, Diagnostic, DiagnosticEntry, DiagnosticSet, Language, LanguageConfig,
|
||||
LanguageMatcher,
|
||||
language_settings::{AllLanguageSettings, AllLanguageSettingsContent},
|
||||
};
|
||||
use lsp::LanguageServerId;
|
||||
use project::Project;
|
||||
use rand::{prelude::*, Rng};
|
||||
use rand::{Rng, prelude::*};
|
||||
use settings::SettingsStore;
|
||||
use smol::stream::StreamExt;
|
||||
use std::{env, sync::Arc};
|
||||
|
@ -1436,7 +1437,6 @@ pub mod tests {
|
|||
use theme::{LoadThemes, SyntaxTheme};
|
||||
use unindent::Unindent as _;
|
||||
use util::test::{marked_text_ranges, sample_text};
|
||||
use Bias::*;
|
||||
|
||||
#[gpui::test(iterations = 100)]
|
||||
async fn test_random_display_map(cx: &mut gpui::TestAppContext, mut rng: StdRng) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
wrap_map::{self, WrapEdit, WrapPoint, WrapSnapshot},
|
||||
Highlights,
|
||||
wrap_map::{self, WrapEdit, WrapPoint, WrapSnapshot},
|
||||
};
|
||||
use crate::{EditorStyle, GutterDimensions};
|
||||
use collections::{Bound, HashMap, HashSet};
|
||||
|
@ -17,8 +17,8 @@ use std::{
|
|||
fmt::Debug,
|
||||
ops::{Deref, DerefMut, Range, RangeBounds, RangeInclusive},
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
Arc,
|
||||
atomic::{AtomicUsize, Ordering::SeqCst},
|
||||
},
|
||||
};
|
||||
use sum_tree::{Bias, SumTree, Summary, TreeMap};
|
||||
|
@ -1282,8 +1282,8 @@ impl BlockSnapshot {
|
|||
|
||||
let mut cursor = self.transforms.cursor::<(BlockRow, WrapRow)>(&());
|
||||
cursor.seek(&BlockRow(rows.start), Bias::Right, &());
|
||||
let transform_output_start = cursor.start().0 .0;
|
||||
let transform_input_start = cursor.start().1 .0;
|
||||
let transform_output_start = cursor.start().0.0;
|
||||
let transform_input_start = cursor.start().1.0;
|
||||
|
||||
let mut input_start = transform_input_start;
|
||||
let mut input_end = transform_input_start;
|
||||
|
@ -1441,7 +1441,7 @@ impl BlockSnapshot {
|
|||
let wrap_start_row = input_start.0 + overshoot;
|
||||
let wrap_end_row = cmp::min(
|
||||
input_start.0 + (range.end.0 - output_start.0),
|
||||
cursor.end(&()).1 .0,
|
||||
cursor.end(&()).1.0,
|
||||
);
|
||||
let summary = self
|
||||
.wrap_snapshot
|
||||
|
@ -1532,7 +1532,7 @@ impl BlockSnapshot {
|
|||
|
||||
let max_input_row = WrapRow(self.transforms.summary().input_rows);
|
||||
let mut search_left =
|
||||
(bias == Bias::Left && cursor.start().1 .0 > 0) || cursor.end(&()).1 == max_input_row;
|
||||
(bias == Bias::Left && cursor.start().1.0 > 0) || cursor.end(&()).1 == max_input_row;
|
||||
let mut reversed = false;
|
||||
|
||||
loop {
|
||||
|
@ -1591,7 +1591,7 @@ impl BlockSnapshot {
|
|||
cursor.seek(&WrapRow(wrap_point.row()), Bias::Right, &());
|
||||
if let Some(transform) = cursor.item() {
|
||||
if transform.block.is_some() {
|
||||
BlockPoint::new(cursor.start().1 .0, 0)
|
||||
BlockPoint::new(cursor.start().1.0, 0)
|
||||
} else {
|
||||
let (input_start_row, output_start_row) = cursor.start();
|
||||
let input_start = Point::new(input_start_row.0, 0);
|
||||
|
@ -1611,20 +1611,20 @@ impl BlockSnapshot {
|
|||
match transform.block.as_ref() {
|
||||
Some(block) => {
|
||||
if block.place_below() {
|
||||
let wrap_row = cursor.start().1 .0 - 1;
|
||||
let wrap_row = cursor.start().1.0 - 1;
|
||||
WrapPoint::new(wrap_row, self.wrap_snapshot.line_len(wrap_row))
|
||||
} else if block.place_above() {
|
||||
WrapPoint::new(cursor.start().1 .0, 0)
|
||||
WrapPoint::new(cursor.start().1.0, 0)
|
||||
} else if bias == Bias::Left {
|
||||
WrapPoint::new(cursor.start().1 .0, 0)
|
||||
WrapPoint::new(cursor.start().1.0, 0)
|
||||
} else {
|
||||
let wrap_row = cursor.end(&()).1 .0 - 1;
|
||||
let wrap_row = cursor.end(&()).1.0 - 1;
|
||||
WrapPoint::new(wrap_row, self.wrap_snapshot.line_len(wrap_row))
|
||||
}
|
||||
}
|
||||
None => {
|
||||
let overshoot = block_point.row - cursor.start().0 .0;
|
||||
let wrap_row = cursor.start().1 .0 + overshoot;
|
||||
let overshoot = block_point.row - cursor.start().0.0;
|
||||
let wrap_row = cursor.start().1.0 + overshoot;
|
||||
WrapPoint::new(wrap_row, block_point.column)
|
||||
}
|
||||
}
|
||||
|
@ -1656,11 +1656,11 @@ impl BlockChunks<'_> {
|
|||
.item()
|
||||
.map_or(false, |transform| transform.block.is_none())
|
||||
{
|
||||
let start_input_row = self.transforms.start().1 .0;
|
||||
let start_output_row = self.transforms.start().0 .0;
|
||||
let start_input_row = self.transforms.start().1.0;
|
||||
let start_output_row = self.transforms.start().0.0;
|
||||
if start_output_row < self.max_output_row {
|
||||
let end_input_row = cmp::min(
|
||||
self.transforms.end(&()).1 .0,
|
||||
self.transforms.end(&()).1.0,
|
||||
start_input_row + (self.max_output_row - start_output_row),
|
||||
);
|
||||
self.input_chunks.seek(start_input_row..end_input_row);
|
||||
|
@ -1683,8 +1683,8 @@ impl<'a> Iterator for BlockChunks<'a> {
|
|||
|
||||
let transform = self.transforms.item()?;
|
||||
if transform.block.is_some() {
|
||||
let block_start = self.transforms.start().0 .0;
|
||||
let mut block_end = self.transforms.end(&()).0 .0;
|
||||
let block_start = self.transforms.start().0.0;
|
||||
let mut block_end = self.transforms.end(&()).0.0;
|
||||
self.advance();
|
||||
if self.transforms.item().is_none() {
|
||||
block_end -= 1;
|
||||
|
@ -1719,7 +1719,7 @@ impl<'a> Iterator for BlockChunks<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
let transform_end = self.transforms.end(&()).0 .0;
|
||||
let transform_end = self.transforms.end(&()).0.0;
|
||||
let (prefix_rows, prefix_bytes) =
|
||||
offset_for_row(self.input_chunk.text, transform_end - self.output_row);
|
||||
self.output_row += prefix_rows;
|
||||
|
@ -1758,7 +1758,7 @@ impl Iterator for BlockRows<'_> {
|
|||
self.started = true;
|
||||
}
|
||||
|
||||
if self.output_row.0 >= self.transforms.end(&()).0 .0 {
|
||||
if self.output_row.0 >= self.transforms.end(&()).0.0 {
|
||||
self.transforms.next(&());
|
||||
while let Some(transform) = self.transforms.item() {
|
||||
if transform
|
||||
|
@ -1778,7 +1778,7 @@ impl Iterator for BlockRows<'_> {
|
|||
.as_ref()
|
||||
.map_or(true, |block| block.is_replacement())
|
||||
{
|
||||
self.input_rows.seek(self.transforms.start().1 .0);
|
||||
self.input_rows.seek(self.transforms.start().1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1913,7 +1913,7 @@ mod tests {
|
|||
display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap, wrap_map::WrapMap},
|
||||
test::test_font,
|
||||
};
|
||||
use gpui::{div, font, px, App, AppContext as _, Element};
|
||||
use gpui::{App, AppContext as _, Element, div, font, px};
|
||||
use itertools::Itertools;
|
||||
use language::{Buffer, Capability};
|
||||
use multi_buffer::{ExcerptRange, MultiBuffer};
|
||||
|
|
|
@ -389,7 +389,7 @@ impl SeekTarget<'_, ItemSummary, ItemSummary> for Anchor {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use gpui::{div, App};
|
||||
use gpui::{App, div};
|
||||
use multi_buffer::MultiBuffer;
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -419,24 +419,32 @@ mod test {
|
|||
|
||||
// Verify creases are inserted
|
||||
let crease_snapshot = crease_map.snapshot();
|
||||
assert!(crease_snapshot
|
||||
.query_row(MultiBufferRow(1), &snapshot)
|
||||
.is_some());
|
||||
assert!(crease_snapshot
|
||||
.query_row(MultiBufferRow(3), &snapshot)
|
||||
.is_some());
|
||||
assert!(
|
||||
crease_snapshot
|
||||
.query_row(MultiBufferRow(1), &snapshot)
|
||||
.is_some()
|
||||
);
|
||||
assert!(
|
||||
crease_snapshot
|
||||
.query_row(MultiBufferRow(3), &snapshot)
|
||||
.is_some()
|
||||
);
|
||||
|
||||
// Remove creases
|
||||
crease_map.remove(crease_ids, &snapshot);
|
||||
|
||||
// Verify creases are removed
|
||||
let crease_snapshot = crease_map.snapshot();
|
||||
assert!(crease_snapshot
|
||||
.query_row(MultiBufferRow(1), &snapshot)
|
||||
.is_none());
|
||||
assert!(crease_snapshot
|
||||
.query_row(MultiBufferRow(3), &snapshot)
|
||||
.is_none());
|
||||
assert!(
|
||||
crease_snapshot
|
||||
.query_row(MultiBufferRow(1), &snapshot)
|
||||
.is_none()
|
||||
);
|
||||
assert!(
|
||||
crease_snapshot
|
||||
.query_row(MultiBufferRow(3), &snapshot)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot},
|
||||
Highlights,
|
||||
inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot},
|
||||
};
|
||||
use gpui::{AnyElement, App, ElementId};
|
||||
use language::{Chunk, ChunkRenderer, Edit, Point, TextSummary};
|
||||
|
@ -97,8 +97,8 @@ impl FoldPoint {
|
|||
pub fn to_inlay_point(self, snapshot: &FoldSnapshot) -> InlayPoint {
|
||||
let mut cursor = snapshot.transforms.cursor::<(FoldPoint, InlayPoint)>(&());
|
||||
cursor.seek(&self, Bias::Right, &());
|
||||
let overshoot = self.0 - cursor.start().0 .0;
|
||||
InlayPoint(cursor.start().1 .0 + overshoot)
|
||||
let overshoot = self.0 - cursor.start().0.0;
|
||||
InlayPoint(cursor.start().1.0 + overshoot)
|
||||
}
|
||||
|
||||
pub fn to_offset(self, snapshot: &FoldSnapshot) -> FoldOffset {
|
||||
|
@ -527,7 +527,7 @@ impl FoldMap {
|
|||
edit.old.start = old_transforms.start().0;
|
||||
}
|
||||
let old_start =
|
||||
old_transforms.start().1 .0 + (edit.old.start - old_transforms.start().0).0;
|
||||
old_transforms.start().1.0 + (edit.old.start - old_transforms.start().0).0;
|
||||
|
||||
old_transforms.seek_forward(&edit.old.end, Bias::Right, &());
|
||||
if old_transforms.item().map_or(false, |t| t.is_fold()) {
|
||||
|
@ -535,14 +535,14 @@ impl FoldMap {
|
|||
edit.old.end = old_transforms.start().0;
|
||||
}
|
||||
let old_end =
|
||||
old_transforms.start().1 .0 + (edit.old.end - old_transforms.start().0).0;
|
||||
old_transforms.start().1.0 + (edit.old.end - old_transforms.start().0).0;
|
||||
|
||||
new_transforms.seek(&edit.new.start, Bias::Left, &());
|
||||
if new_transforms.item().map_or(false, |t| t.is_fold()) {
|
||||
edit.new.start = new_transforms.start().0;
|
||||
}
|
||||
let new_start =
|
||||
new_transforms.start().1 .0 + (edit.new.start - new_transforms.start().0).0;
|
||||
new_transforms.start().1.0 + (edit.new.start - new_transforms.start().0).0;
|
||||
|
||||
new_transforms.seek_forward(&edit.new.end, Bias::Right, &());
|
||||
if new_transforms.item().map_or(false, |t| t.is_fold()) {
|
||||
|
@ -550,7 +550,7 @@ impl FoldMap {
|
|||
edit.new.end = new_transforms.start().0;
|
||||
}
|
||||
let new_end =
|
||||
new_transforms.start().1 .0 + (edit.new.end - new_transforms.start().0).0;
|
||||
new_transforms.start().1.0 + (edit.new.end - new_transforms.start().0).0;
|
||||
|
||||
fold_edits.push(FoldEdit {
|
||||
old: FoldOffset(old_start)..FoldOffset(old_end),
|
||||
|
@ -600,8 +600,8 @@ impl FoldSnapshot {
|
|||
let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&());
|
||||
cursor.seek(&range.start, Bias::Right, &());
|
||||
if let Some(transform) = cursor.item() {
|
||||
let start_in_transform = range.start.0 - cursor.start().0 .0;
|
||||
let end_in_transform = cmp::min(range.end, cursor.end(&()).0).0 - cursor.start().0 .0;
|
||||
let start_in_transform = range.start.0 - cursor.start().0.0;
|
||||
let end_in_transform = cmp::min(range.end, cursor.end(&()).0).0 - cursor.start().0.0;
|
||||
if let Some(placeholder) = transform.placeholder.as_ref() {
|
||||
summary = TextSummary::from(
|
||||
&placeholder.text
|
||||
|
@ -610,10 +610,10 @@ impl FoldSnapshot {
|
|||
} else {
|
||||
let inlay_start = self
|
||||
.inlay_snapshot
|
||||
.to_offset(InlayPoint(cursor.start().1 .0 + start_in_transform));
|
||||
.to_offset(InlayPoint(cursor.start().1.0 + start_in_transform));
|
||||
let inlay_end = self
|
||||
.inlay_snapshot
|
||||
.to_offset(InlayPoint(cursor.start().1 .0 + end_in_transform));
|
||||
.to_offset(InlayPoint(cursor.start().1.0 + end_in_transform));
|
||||
summary = self
|
||||
.inlay_snapshot
|
||||
.text_summary_for_range(inlay_start..inlay_end);
|
||||
|
@ -626,7 +626,7 @@ impl FoldSnapshot {
|
|||
.summary::<_, TransformSummary>(&range.end, Bias::Right, &())
|
||||
.output;
|
||||
if let Some(transform) = cursor.item() {
|
||||
let end_in_transform = range.end.0 - cursor.start().0 .0;
|
||||
let end_in_transform = range.end.0 - cursor.start().0.0;
|
||||
if let Some(placeholder) = transform.placeholder.as_ref() {
|
||||
summary +=
|
||||
TextSummary::from(&placeholder.text[..end_in_transform.column as usize]);
|
||||
|
@ -634,7 +634,7 @@ impl FoldSnapshot {
|
|||
let inlay_start = self.inlay_snapshot.to_offset(cursor.start().1);
|
||||
let inlay_end = self
|
||||
.inlay_snapshot
|
||||
.to_offset(InlayPoint(cursor.start().1 .0 + end_in_transform));
|
||||
.to_offset(InlayPoint(cursor.start().1.0 + end_in_transform));
|
||||
summary += self
|
||||
.inlay_snapshot
|
||||
.text_summary_for_range(inlay_start..inlay_end);
|
||||
|
@ -655,10 +655,10 @@ impl FoldSnapshot {
|
|||
cursor.end(&()).1
|
||||
}
|
||||
} else {
|
||||
let overshoot = point.0 - cursor.start().0 .0;
|
||||
let overshoot = point.0 - cursor.start().0.0;
|
||||
FoldPoint(cmp::min(
|
||||
cursor.start().1 .0 + overshoot,
|
||||
cursor.end(&()).1 .0,
|
||||
cursor.start().1.0 + overshoot,
|
||||
cursor.end(&()).1.0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -686,8 +686,8 @@ impl FoldSnapshot {
|
|||
let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&());
|
||||
cursor.seek(&fold_point, Bias::Left, &());
|
||||
|
||||
let overshoot = fold_point.0 - cursor.start().0 .0;
|
||||
let inlay_point = InlayPoint(cursor.start().1 .0 + overshoot);
|
||||
let overshoot = fold_point.0 - cursor.start().0.0;
|
||||
let inlay_point = InlayPoint(cursor.start().1.0 + overshoot);
|
||||
let input_rows = self.inlay_snapshot.row_infos(inlay_point.row());
|
||||
|
||||
FoldRows {
|
||||
|
@ -769,7 +769,7 @@ impl FoldSnapshot {
|
|||
transform_cursor.seek(&range.start, Bias::Right, &());
|
||||
|
||||
let inlay_start = {
|
||||
let overshoot = range.start.0 - transform_cursor.start().0 .0;
|
||||
let overshoot = range.start.0 - transform_cursor.start().0.0;
|
||||
transform_cursor.start().1 + InlayOffset(overshoot)
|
||||
};
|
||||
|
||||
|
@ -781,7 +781,7 @@ impl FoldSnapshot {
|
|||
{
|
||||
inlay_start
|
||||
} else if range.end < transform_end.0 {
|
||||
let overshoot = range.end.0 - transform_cursor.start().0 .0;
|
||||
let overshoot = range.end.0 - transform_cursor.start().0.0;
|
||||
transform_cursor.start().1 + InlayOffset(overshoot)
|
||||
} else {
|
||||
transform_end.1
|
||||
|
@ -823,18 +823,18 @@ impl FoldSnapshot {
|
|||
let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&());
|
||||
cursor.seek(&point, Bias::Right, &());
|
||||
if let Some(transform) = cursor.item() {
|
||||
let transform_start = cursor.start().0 .0;
|
||||
let transform_start = cursor.start().0.0;
|
||||
if transform.placeholder.is_some() {
|
||||
if point.0 == transform_start || matches!(bias, Bias::Left) {
|
||||
FoldPoint(transform_start)
|
||||
} else {
|
||||
FoldPoint(cursor.end(&()).0 .0)
|
||||
FoldPoint(cursor.end(&()).0.0)
|
||||
}
|
||||
} else {
|
||||
let overshoot = InlayPoint(point.0 - transform_start);
|
||||
let inlay_point = cursor.start().1 + overshoot;
|
||||
let clipped_inlay_point = self.inlay_snapshot.clip_point(inlay_point, bias);
|
||||
FoldPoint(cursor.start().0 .0 + (clipped_inlay_point - cursor.start().1).0)
|
||||
FoldPoint(cursor.start().0.0 + (clipped_inlay_point - cursor.start().1).0)
|
||||
}
|
||||
} else {
|
||||
FoldPoint(self.transforms.summary().output.lines)
|
||||
|
@ -1148,8 +1148,8 @@ impl FoldRows<'_> {
|
|||
pub(crate) fn seek(&mut self, row: u32) {
|
||||
let fold_point = FoldPoint::new(row, 0);
|
||||
self.cursor.seek(&fold_point, Bias::Left, &());
|
||||
let overshoot = fold_point.0 - self.cursor.start().0 .0;
|
||||
let inlay_point = InlayPoint(self.cursor.start().1 .0 + overshoot);
|
||||
let overshoot = fold_point.0 - self.cursor.start().0.0;
|
||||
let inlay_point = InlayPoint(self.cursor.start().1.0 + overshoot);
|
||||
self.input_rows.seek(inlay_point.row());
|
||||
self.fold_point = fold_point;
|
||||
}
|
||||
|
@ -1170,7 +1170,7 @@ impl Iterator for FoldRows<'_> {
|
|||
|
||||
if self.cursor.item().is_some() {
|
||||
if traversed_fold {
|
||||
self.input_rows.seek(self.cursor.start().1 .0.row);
|
||||
self.input_rows.seek(self.cursor.start().1.0.row);
|
||||
self.input_rows.next();
|
||||
}
|
||||
*self.fold_point.row_mut() += 1;
|
||||
|
@ -1195,7 +1195,7 @@ impl FoldChunks<'_> {
|
|||
self.transform_cursor.seek(&range.start, Bias::Right, &());
|
||||
|
||||
let inlay_start = {
|
||||
let overshoot = range.start.0 - self.transform_cursor.start().0 .0;
|
||||
let overshoot = range.start.0 - self.transform_cursor.start().0.0;
|
||||
self.transform_cursor.start().1 + InlayOffset(overshoot)
|
||||
};
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ impl FoldChunks<'_> {
|
|||
{
|
||||
inlay_start
|
||||
} else if range.end < transform_end.0 {
|
||||
let overshoot = range.end.0 - self.transform_cursor.start().0 .0;
|
||||
let overshoot = range.end.0 - self.transform_cursor.start().0.0;
|
||||
self.transform_cursor.start().1 + InlayOffset(overshoot)
|
||||
} else {
|
||||
transform_end.1
|
||||
|
@ -1260,7 +1260,7 @@ impl<'a> Iterator for FoldChunks<'a> {
|
|||
let transform_start = self.transform_cursor.start();
|
||||
let transform_end = self.transform_cursor.end(&());
|
||||
let inlay_end = if self.max_output_offset < transform_end.0 {
|
||||
let overshoot = self.max_output_offset.0 - transform_start.0 .0;
|
||||
let overshoot = self.max_output_offset.0 - transform_start.0.0;
|
||||
transform_start.1 + InlayOffset(overshoot)
|
||||
} else {
|
||||
transform_end.1
|
||||
|
@ -1309,9 +1309,9 @@ impl FoldOffset {
|
|||
.cursor::<(FoldOffset, TransformSummary)>(&());
|
||||
cursor.seek(&self, Bias::Right, &());
|
||||
let overshoot = if cursor.item().map_or(true, |t| t.is_fold()) {
|
||||
Point::new(0, (self.0 - cursor.start().0 .0) as u32)
|
||||
Point::new(0, (self.0 - cursor.start().0.0) as u32)
|
||||
} else {
|
||||
let inlay_offset = cursor.start().1.input.len + self.0 - cursor.start().0 .0;
|
||||
let inlay_offset = cursor.start().1.input.len + self.0 - cursor.start().0.0;
|
||||
let inlay_point = snapshot.inlay_snapshot.to_point(InlayOffset(inlay_offset));
|
||||
inlay_point.0 - cursor.start().1.input.lines
|
||||
};
|
||||
|
@ -1322,8 +1322,8 @@ impl FoldOffset {
|
|||
pub fn to_inlay_offset(self, snapshot: &FoldSnapshot) -> InlayOffset {
|
||||
let mut cursor = snapshot.transforms.cursor::<(FoldOffset, InlayOffset)>(&());
|
||||
cursor.seek(&self, Bias::Right, &());
|
||||
let overshoot = self.0 - cursor.start().0 .0;
|
||||
InlayOffset(cursor.start().1 .0 + overshoot)
|
||||
let overshoot = self.0 - cursor.start().0.0;
|
||||
InlayOffset(cursor.start().1.0 + overshoot)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1384,15 +1384,15 @@ pub type FoldEdit = Edit<FoldOffset>;
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{display_map::inlay_map::InlayMap, MultiBuffer, ToPoint};
|
||||
use crate::{MultiBuffer, ToPoint, display_map::inlay_map::InlayMap};
|
||||
use Bias::{Left, Right};
|
||||
use collections::HashSet;
|
||||
use rand::prelude::*;
|
||||
use settings::SettingsStore;
|
||||
use std::{env, mem};
|
||||
use text::Patch;
|
||||
use util::test::sample_text;
|
||||
use util::RandomCharIter;
|
||||
use Bias::{Left, Right};
|
||||
use util::test::sample_text;
|
||||
|
||||
#[gpui::test]
|
||||
fn test_basic_folds(cx: &mut gpui::App) {
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::{
|
|||
use sum_tree::{Bias, Cursor, SumTree};
|
||||
use text::{Patch, Rope};
|
||||
|
||||
use super::{custom_highlights::CustomHighlightsChunks, Highlights};
|
||||
use super::{Highlights, custom_highlights::CustomHighlightsChunks};
|
||||
|
||||
/// Decides where the [`Inlay`]s should be displayed.
|
||||
///
|
||||
|
@ -254,7 +254,7 @@ impl<'a> Iterator for InlayChunks<'a> {
|
|||
chunk
|
||||
.text
|
||||
.len()
|
||||
.min(self.transforms.end(&()).0 .0 - self.output_offset.0),
|
||||
.min(self.transforms.end(&()).0.0 - self.output_offset.0),
|
||||
);
|
||||
|
||||
chunk.text = suffix;
|
||||
|
@ -352,7 +352,7 @@ impl InlayBufferRows<'_> {
|
|||
} else {
|
||||
match self.transforms.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
buffer_point += inlay_point.0 - self.transforms.start().0 .0;
|
||||
buffer_point += inlay_point.0 - self.transforms.start().0.0;
|
||||
buffer_point.row
|
||||
}
|
||||
_ => cmp::min(buffer_point.row + 1, self.max_buffer_row.0),
|
||||
|
@ -664,18 +664,18 @@ impl InlaySnapshot {
|
|||
.transforms
|
||||
.cursor::<(InlayOffset, (InlayPoint, usize))>(&());
|
||||
cursor.seek(&offset, Bias::Right, &());
|
||||
let overshoot = offset.0 - cursor.start().0 .0;
|
||||
let overshoot = offset.0 - cursor.start().0.0;
|
||||
match cursor.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
let buffer_offset_start = cursor.start().1 .1;
|
||||
let buffer_offset_start = cursor.start().1.1;
|
||||
let buffer_offset_end = buffer_offset_start + overshoot;
|
||||
let buffer_start = self.buffer.offset_to_point(buffer_offset_start);
|
||||
let buffer_end = self.buffer.offset_to_point(buffer_offset_end);
|
||||
InlayPoint(cursor.start().1 .0 .0 + (buffer_end - buffer_start))
|
||||
InlayPoint(cursor.start().1.0.0 + (buffer_end - buffer_start))
|
||||
}
|
||||
Some(Transform::Inlay(inlay)) => {
|
||||
let overshoot = inlay.text.offset_to_point(overshoot);
|
||||
InlayPoint(cursor.start().1 .0 .0 + overshoot)
|
||||
InlayPoint(cursor.start().1.0.0 + overshoot)
|
||||
}
|
||||
None => self.max_point(),
|
||||
}
|
||||
|
@ -694,18 +694,18 @@ impl InlaySnapshot {
|
|||
.transforms
|
||||
.cursor::<(InlayPoint, (InlayOffset, Point))>(&());
|
||||
cursor.seek(&point, Bias::Right, &());
|
||||
let overshoot = point.0 - cursor.start().0 .0;
|
||||
let overshoot = point.0 - cursor.start().0.0;
|
||||
match cursor.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
let buffer_point_start = cursor.start().1 .1;
|
||||
let buffer_point_start = cursor.start().1.1;
|
||||
let buffer_point_end = buffer_point_start + overshoot;
|
||||
let buffer_offset_start = self.buffer.point_to_offset(buffer_point_start);
|
||||
let buffer_offset_end = self.buffer.point_to_offset(buffer_point_end);
|
||||
InlayOffset(cursor.start().1 .0 .0 + (buffer_offset_end - buffer_offset_start))
|
||||
InlayOffset(cursor.start().1.0.0 + (buffer_offset_end - buffer_offset_start))
|
||||
}
|
||||
Some(Transform::Inlay(inlay)) => {
|
||||
let overshoot = inlay.text.point_to_offset(overshoot);
|
||||
InlayOffset(cursor.start().1 .0 .0 + overshoot)
|
||||
InlayOffset(cursor.start().1.0.0 + overshoot)
|
||||
}
|
||||
None => self.len(),
|
||||
}
|
||||
|
@ -715,7 +715,7 @@ impl InlaySnapshot {
|
|||
cursor.seek(&point, Bias::Right, &());
|
||||
match cursor.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
let overshoot = point.0 - cursor.start().0 .0;
|
||||
let overshoot = point.0 - cursor.start().0.0;
|
||||
cursor.start().1 + overshoot
|
||||
}
|
||||
Some(Transform::Inlay(_)) => cursor.start().1,
|
||||
|
@ -752,7 +752,7 @@ impl InlaySnapshot {
|
|||
return cursor.end(&()).1;
|
||||
} else {
|
||||
let overshoot = offset - cursor.start().0;
|
||||
return InlayOffset(cursor.start().1 .0 + overshoot);
|
||||
return InlayOffset(cursor.start().1.0 + overshoot);
|
||||
}
|
||||
}
|
||||
Some(Transform::Inlay(inlay)) => {
|
||||
|
@ -785,7 +785,7 @@ impl InlaySnapshot {
|
|||
return cursor.end(&()).1;
|
||||
} else {
|
||||
let overshoot = point - cursor.start().0;
|
||||
return InlayPoint(cursor.start().1 .0 + overshoot);
|
||||
return InlayPoint(cursor.start().1.0 + overshoot);
|
||||
}
|
||||
}
|
||||
Some(Transform::Inlay(inlay)) => {
|
||||
|
@ -838,11 +838,11 @@ impl InlaySnapshot {
|
|||
return point;
|
||||
}
|
||||
} else {
|
||||
let overshoot = point.0 - cursor.start().0 .0;
|
||||
let overshoot = point.0 - cursor.start().0.0;
|
||||
let buffer_point = cursor.start().1 + overshoot;
|
||||
let clipped_buffer_point = self.buffer.clip_point(buffer_point, bias);
|
||||
let clipped_overshoot = clipped_buffer_point - cursor.start().1;
|
||||
let clipped_point = InlayPoint(cursor.start().0 .0 + clipped_overshoot);
|
||||
let clipped_point = InlayPoint(cursor.start().0.0 + clipped_overshoot);
|
||||
if clipped_point == point {
|
||||
return clipped_point;
|
||||
} else {
|
||||
|
@ -903,19 +903,19 @@ impl InlaySnapshot {
|
|||
let mut cursor = self.transforms.cursor::<(InlayOffset, usize)>(&());
|
||||
cursor.seek(&range.start, Bias::Right, &());
|
||||
|
||||
let overshoot = range.start.0 - cursor.start().0 .0;
|
||||
let overshoot = range.start.0 - cursor.start().0.0;
|
||||
match cursor.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
let buffer_start = cursor.start().1;
|
||||
let suffix_start = buffer_start + overshoot;
|
||||
let suffix_end =
|
||||
buffer_start + (cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0 .0);
|
||||
buffer_start + (cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0.0);
|
||||
summary = self.buffer.text_summary_for_range(suffix_start..suffix_end);
|
||||
cursor.next(&());
|
||||
}
|
||||
Some(Transform::Inlay(inlay)) => {
|
||||
let suffix_start = overshoot;
|
||||
let suffix_end = cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0 .0;
|
||||
let suffix_end = cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0.0;
|
||||
summary = inlay.text.cursor(suffix_start).summary(suffix_end);
|
||||
cursor.next(&());
|
||||
}
|
||||
|
@ -927,7 +927,7 @@ impl InlaySnapshot {
|
|||
.summary::<_, TransformSummary>(&range.end, Bias::Right, &())
|
||||
.output;
|
||||
|
||||
let overshoot = range.end.0 - cursor.start().0 .0;
|
||||
let overshoot = range.end.0 - cursor.start().0.0;
|
||||
match cursor.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
let prefix_start = cursor.start().1;
|
||||
|
@ -959,7 +959,7 @@ impl InlaySnapshot {
|
|||
} else {
|
||||
match cursor.item() {
|
||||
Some(Transform::Isomorphic(_)) => {
|
||||
buffer_point += inlay_point.0 - cursor.start().0 .0;
|
||||
buffer_point += inlay_point.0 - cursor.start().0.0;
|
||||
MultiBufferRow(buffer_point.row)
|
||||
}
|
||||
_ => cmp::min(MultiBufferRow(buffer_point.row + 1), max_buffer_row),
|
||||
|
@ -1066,9 +1066,9 @@ fn push_isomorphic(sum_tree: &mut SumTree<Transform>, summary: TextSummary) {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
InlayId, MultiBuffer,
|
||||
display_map::{InlayHighlights, TextHighlights},
|
||||
hover_links::InlayHighlight,
|
||||
InlayId, MultiBuffer,
|
||||
};
|
||||
use gpui::{App, HighlightStyle};
|
||||
use project::{InlayHint, InlayHintLabel, ResolveState};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
fold_map::{self, FoldChunks, FoldEdit, FoldPoint, FoldSnapshot},
|
||||
Highlights,
|
||||
fold_map::{self, FoldChunks, FoldEdit, FoldPoint, FoldSnapshot},
|
||||
};
|
||||
use language::{Chunk, Point};
|
||||
use multi_buffer::MultiBufferSnapshot;
|
||||
|
@ -602,10 +602,10 @@ impl<'a> Iterator for TabChunks<'a> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
display_map::{fold_map::FoldMap, inlay_map::InlayMap},
|
||||
MultiBuffer,
|
||||
display_map::{fold_map::FoldMap, inlay_map::InlayMap},
|
||||
};
|
||||
use rand::{prelude::StdRng, Rng};
|
||||
use rand::{Rng, prelude::StdRng};
|
||||
|
||||
#[gpui::test]
|
||||
fn test_expand_tabs(cx: &mut gpui::App) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use super::{
|
||||
Highlights,
|
||||
fold_map::FoldRows,
|
||||
tab_map::{self, TabEdit, TabPoint, TabSnapshot},
|
||||
Highlights,
|
||||
};
|
||||
use gpui::{App, AppContext as _, Context, Entity, Font, LineWrapper, Pixels, Task};
|
||||
use language::{Chunk, Point};
|
||||
|
@ -593,9 +593,9 @@ impl WrapSnapshot {
|
|||
let output_end = WrapPoint::new(rows.end, 0);
|
||||
let mut transforms = self.transforms.cursor::<(WrapPoint, TabPoint)>(&());
|
||||
transforms.seek(&output_start, Bias::Right, &());
|
||||
let mut input_start = TabPoint(transforms.start().1 .0);
|
||||
let mut input_start = TabPoint(transforms.start().1.0);
|
||||
if transforms.item().map_or(false, |t| t.is_isomorphic()) {
|
||||
input_start.0 += output_start.0 - transforms.start().0 .0;
|
||||
input_start.0 += output_start.0 - transforms.start().0.0;
|
||||
}
|
||||
let input_end = self
|
||||
.to_tab_point(output_end)
|
||||
|
@ -647,11 +647,11 @@ impl WrapSnapshot {
|
|||
let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(&());
|
||||
cursor.seek(&start, Bias::Right, &());
|
||||
if let Some(transform) = cursor.item() {
|
||||
let start_in_transform = start.0 - cursor.start().0 .0;
|
||||
let end_in_transform = cmp::min(end, cursor.end(&()).0).0 - cursor.start().0 .0;
|
||||
let start_in_transform = start.0 - cursor.start().0.0;
|
||||
let end_in_transform = cmp::min(end, cursor.end(&()).0).0 - cursor.start().0.0;
|
||||
if transform.is_isomorphic() {
|
||||
let tab_start = TabPoint(cursor.start().1 .0 + start_in_transform);
|
||||
let tab_end = TabPoint(cursor.start().1 .0 + end_in_transform);
|
||||
let tab_start = TabPoint(cursor.start().1.0 + start_in_transform);
|
||||
let tab_end = TabPoint(cursor.start().1.0 + end_in_transform);
|
||||
summary += &self.tab_snapshot.text_summary_for_range(tab_start..tab_end);
|
||||
} else {
|
||||
debug_assert_eq!(start_in_transform.row, end_in_transform.row);
|
||||
|
@ -674,7 +674,7 @@ impl WrapSnapshot {
|
|||
.output;
|
||||
|
||||
if let Some(transform) = cursor.item() {
|
||||
let end_in_transform = end.0 - cursor.start().0 .0;
|
||||
let end_in_transform = end.0 - cursor.start().0.0;
|
||||
if transform.is_isomorphic() {
|
||||
let char_start = cursor.start().1;
|
||||
let char_end = TabPoint(char_start.0 + end_in_transform);
|
||||
|
@ -736,9 +736,9 @@ impl WrapSnapshot {
|
|||
pub fn to_tab_point(&self, point: WrapPoint) -> TabPoint {
|
||||
let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(&());
|
||||
cursor.seek(&point, Bias::Right, &());
|
||||
let mut tab_point = cursor.start().1 .0;
|
||||
let mut tab_point = cursor.start().1.0;
|
||||
if cursor.item().map_or(false, |t| t.is_isomorphic()) {
|
||||
tab_point += point.0 - cursor.start().0 .0;
|
||||
tab_point += point.0 - cursor.start().0.0;
|
||||
}
|
||||
TabPoint(tab_point)
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ impl WrapSnapshot {
|
|||
pub fn tab_point_to_wrap_point(&self, point: TabPoint) -> WrapPoint {
|
||||
let mut cursor = self.transforms.cursor::<(TabPoint, WrapPoint)>(&());
|
||||
cursor.seek(&point, Bias::Right, &());
|
||||
WrapPoint(cursor.start().1 .0 + (point.0 - cursor.start().0 .0))
|
||||
WrapPoint(cursor.start().1.0 + (point.0 - cursor.start().0.0))
|
||||
}
|
||||
|
||||
pub fn clip_point(&self, mut point: WrapPoint, bias: Bias) -> WrapPoint {
|
||||
|
@ -877,9 +877,9 @@ impl WrapChunks<'_> {
|
|||
let output_start = WrapPoint::new(rows.start, 0);
|
||||
let output_end = WrapPoint::new(rows.end, 0);
|
||||
self.transforms.seek(&output_start, Bias::Right, &());
|
||||
let mut input_start = TabPoint(self.transforms.start().1 .0);
|
||||
let mut input_start = TabPoint(self.transforms.start().1.0);
|
||||
if self.transforms.item().map_or(false, |t| t.is_isomorphic()) {
|
||||
input_start.0 += output_start.0 - self.transforms.start().0 .0;
|
||||
input_start.0 += output_start.0 - self.transforms.start().0.0;
|
||||
}
|
||||
let input_end = self
|
||||
.snapshot
|
||||
|
@ -1169,9 +1169,9 @@ fn consolidate_wrap_edits(edits: Vec<WrapEdit>) -> Vec<WrapEdit> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
MultiBuffer,
|
||||
display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap},
|
||||
test::test_font,
|
||||
MultiBuffer,
|
||||
};
|
||||
use gpui::{px, test::observe};
|
||||
use rand::prelude::*;
|
||||
|
|
|
@ -51,7 +51,7 @@ pub mod test;
|
|||
pub(crate) use actions::*;
|
||||
pub use actions::{AcceptEditPrediction, OpenExcerpts, OpenExcerptsSplit};
|
||||
use aho_corasick::AhoCorasick;
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use blink_manager::BlinkManager;
|
||||
use buffer_diff::DiffHunkStatus;
|
||||
use client::{Collaborator, ParticipantIndex};
|
||||
|
@ -66,14 +66,14 @@ pub use editor_settings::{
|
|||
ShowScrollbar,
|
||||
};
|
||||
pub use editor_settings_controls::*;
|
||||
use element::{layout_line, AcceptEditPredictionBinding, LineWithInvisibles, PositionMap};
|
||||
use element::{AcceptEditPredictionBinding, LineWithInvisibles, PositionMap, layout_line};
|
||||
pub use element::{
|
||||
CursorLayout, EditorElement, HighlightedRange, HighlightedRangeLine, PointForPosition,
|
||||
};
|
||||
use feature_flags::{Debugger, FeatureFlagAppExt};
|
||||
use futures::{
|
||||
future::{self, join, Shared},
|
||||
FutureExt,
|
||||
future::{self, Shared, join},
|
||||
};
|
||||
use fuzzy::StringMatchCandidate;
|
||||
|
||||
|
@ -84,18 +84,18 @@ use code_context_menus::{
|
|||
};
|
||||
use git::blame::GitBlame;
|
||||
use gpui::{
|
||||
div, impl_actions, point, prelude::*, pulsating_between, px, relative, size, Action, Animation,
|
||||
AnimationExt, AnyElement, App, AppContext, AsyncWindowContext, AvailableSpace, Background,
|
||||
Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context, DispatchPhase, Edges, Entity,
|
||||
EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent, Focusable, FontId, FontWeight,
|
||||
Global, HighlightStyle, Hsla, KeyContext, Modifiers, MouseButton, MouseDownEvent, PaintQuad,
|
||||
ParentElement, Pixels, Render, SharedString, Size, Stateful, Styled, StyledText, Subscription,
|
||||
Task, TextStyle, TextStyleRefinement, UTF16Selection, UnderlineStyle, UniformListScrollHandle,
|
||||
WeakEntity, WeakFocusHandle, Window,
|
||||
Action, Animation, AnimationExt, AnyElement, App, AppContext, AsyncWindowContext,
|
||||
AvailableSpace, Background, Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context,
|
||||
DispatchPhase, Edges, Entity, EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent,
|
||||
Focusable, FontId, FontWeight, Global, HighlightStyle, Hsla, KeyContext, Modifiers,
|
||||
MouseButton, MouseDownEvent, PaintQuad, ParentElement, Pixels, Render, SharedString, Size,
|
||||
Stateful, Styled, StyledText, Subscription, Task, TextStyle, TextStyleRefinement,
|
||||
UTF16Selection, UnderlineStyle, UniformListScrollHandle, WeakEntity, WeakFocusHandle, Window,
|
||||
div, impl_actions, point, prelude::*, pulsating_between, px, relative, size,
|
||||
};
|
||||
use highlight_matching_bracket::refresh_matching_bracket_highlights;
|
||||
use hover_links::{find_file, HoverLink, HoveredLinkState, InlayHighlight};
|
||||
use hover_popover::{hide_hover, HoverState};
|
||||
use hover_links::{HoverLink, HoveredLinkState, InlayHighlight, find_file};
|
||||
use hover_popover::{HoverState, hide_hover};
|
||||
use indent_guides::ActiveIndentGuidesState;
|
||||
use inlay_hint_cache::{InlayHintCache, InlaySplice, InvalidationStrategy};
|
||||
pub use inline_completion::Direction;
|
||||
|
@ -103,24 +103,25 @@ use inline_completion::{EditPredictionProvider, InlineCompletionProviderHandle};
|
|||
pub use items::MAX_TAB_TITLE_LEN;
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
AutoindentMode, BracketMatch, BracketPair, Buffer, Capability, CharKind, CodeLabel,
|
||||
CursorShape, Diagnostic, DiffOptions, EditPredictionsMode, EditPreview, HighlightedText,
|
||||
IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject,
|
||||
TransactionId, TreeSitterOptions, WordsQuery,
|
||||
language_settings::{
|
||||
self, all_language_settings, language_settings, InlayHintSettings, RewrapBehavior,
|
||||
WordsCompletionMode,
|
||||
self, InlayHintSettings, RewrapBehavior, WordsCompletionMode, all_language_settings,
|
||||
language_settings,
|
||||
},
|
||||
point_from_lsp, text_diff_with_options, AutoindentMode, BracketMatch, BracketPair, Buffer,
|
||||
Capability, CharKind, CodeLabel, CursorShape, Diagnostic, DiffOptions, EditPredictionsMode,
|
||||
EditPreview, HighlightedText, IndentKind, IndentSize, Language, OffsetRangeExt, Point,
|
||||
Selection, SelectionGoal, TextObject, TransactionId, TreeSitterOptions, WordsQuery,
|
||||
point_from_lsp, text_diff_with_options,
|
||||
};
|
||||
use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange};
|
||||
use language::{BufferRow, CharClassifier, Runnable, RunnableRange, point_to_lsp};
|
||||
use linked_editing_ranges::refresh_linked_ranges;
|
||||
use mouse_context_menu::MouseContextMenu;
|
||||
use persistence::DB;
|
||||
use project::{
|
||||
ProjectPath,
|
||||
debugger::breakpoint_store::{
|
||||
BreakpointEditAction, BreakpointState, BreakpointStore, BreakpointStoreEvent,
|
||||
},
|
||||
ProjectPath,
|
||||
};
|
||||
|
||||
pub use proposed_changes_editor::{
|
||||
|
@ -148,21 +149,21 @@ use multi_buffer::{
|
|||
};
|
||||
use parking_lot::Mutex;
|
||||
use project::{
|
||||
debugger::breakpoint_store::Breakpoint,
|
||||
lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle},
|
||||
project_settings::{GitGutterSetting, ProjectSettings},
|
||||
CodeAction, Completion, CompletionIntent, CompletionSource, DocumentHighlight, InlayHint,
|
||||
Location, LocationLink, PrepareRenameResponse, Project, ProjectItem, ProjectTransaction,
|
||||
TaskSourceKind,
|
||||
debugger::breakpoint_store::Breakpoint,
|
||||
lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle},
|
||||
project_settings::{GitGutterSetting, ProjectSettings},
|
||||
};
|
||||
use rand::prelude::*;
|
||||
use rpc::{proto::*, ErrorExt};
|
||||
use rpc::{ErrorExt, proto::*};
|
||||
use scroll::{Autoscroll, OngoingScroll, ScrollAnchor, ScrollManager, ScrollbarAutoHide};
|
||||
use selections_collection::{
|
||||
resolve_selections, MutableSelectionsCollection, SelectionsCollection,
|
||||
MutableSelectionsCollection, SelectionsCollection, resolve_selections,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::{update_settings_file, Settings, SettingsLocation, SettingsStore};
|
||||
use settings::{Settings, SettingsLocation, SettingsStore, update_settings_file};
|
||||
use smallvec::SmallVec;
|
||||
use snippet::Snippet;
|
||||
use std::sync::Arc;
|
||||
|
@ -182,21 +183,21 @@ pub use sum_tree::Bias;
|
|||
use sum_tree::TreeMap;
|
||||
use text::{BufferId, OffsetUtf16, Rope};
|
||||
use theme::{
|
||||
observe_buffer_font_size_adjustment, ActiveTheme, PlayerColor, StatusColors, SyntaxTheme,
|
||||
ThemeColors, ThemeSettings,
|
||||
ActiveTheme, PlayerColor, StatusColors, SyntaxTheme, ThemeColors, ThemeSettings,
|
||||
observe_buffer_font_size_adjustment,
|
||||
};
|
||||
use ui::{
|
||||
h_flex, prelude::*, ButtonSize, ButtonStyle, Disclosure, IconButton, IconButtonShape, IconName,
|
||||
IconSize, Key, Tooltip,
|
||||
ButtonSize, ButtonStyle, Disclosure, IconButton, IconButtonShape, IconName, IconSize, Key,
|
||||
Tooltip, h_flex, prelude::*,
|
||||
};
|
||||
use util::{maybe, post_inc, RangeExt, ResultExt, TryFutureExt};
|
||||
use util::{RangeExt, ResultExt, TryFutureExt, maybe, post_inc};
|
||||
use workspace::{
|
||||
Item as WorkspaceItem, ItemId, ItemNavHistory, OpenInTerminal, OpenTerminal,
|
||||
RestoreOnStartupBehavior, SERIALIZATION_THROTTLE_TIME, SplitDirection, TabBarSettings, Toast,
|
||||
ViewId, Workspace, WorkspaceId, WorkspaceSettings,
|
||||
item::{ItemHandle, PreviewTabsSettings},
|
||||
notifications::{DetachAndPromptErr, NotificationId, NotifyTaskExt},
|
||||
searchable::SearchEvent,
|
||||
Item as WorkspaceItem, ItemId, ItemNavHistory, OpenInTerminal, OpenTerminal,
|
||||
RestoreOnStartupBehavior, SplitDirection, TabBarSettings, Toast, ViewId, Workspace,
|
||||
WorkspaceId, WorkspaceSettings, SERIALIZATION_THROTTLE_TIME,
|
||||
};
|
||||
|
||||
use crate::hover_links::{find_url, find_url_from_range};
|
||||
|
@ -271,11 +272,7 @@ pub enum Navigated {
|
|||
|
||||
impl Navigated {
|
||||
pub fn from_bool(yes: bool) -> Navigated {
|
||||
if yes {
|
||||
Navigated::Yes
|
||||
} else {
|
||||
Navigated::No
|
||||
}
|
||||
if yes { Navigated::Yes } else { Navigated::No }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1969,12 +1966,12 @@ impl Editor {
|
|||
pub fn set_custom_context_menu(
|
||||
&mut self,
|
||||
f: impl 'static
|
||||
+ Fn(
|
||||
&mut Self,
|
||||
DisplayPoint,
|
||||
&mut Window,
|
||||
&mut Context<Self>,
|
||||
) -> Option<Entity<ui::ContextMenu>>,
|
||||
+ Fn(
|
||||
&mut Self,
|
||||
DisplayPoint,
|
||||
&mut Window,
|
||||
&mut Context<Self>,
|
||||
) -> Option<Entity<ui::ContextMenu>>,
|
||||
) {
|
||||
self.custom_context_menu = Some(Box::new(f))
|
||||
}
|
||||
|
@ -12474,11 +12471,7 @@ impl Editor {
|
|||
best_in_bracket_range = in_bracket_range;
|
||||
best_destination = Some(
|
||||
if close.contains(&selection.start) && close.contains(&selection.end) {
|
||||
if inside {
|
||||
open.end
|
||||
} else {
|
||||
open.start
|
||||
}
|
||||
if inside { open.end } else { open.start }
|
||||
} else if inside {
|
||||
*close.start()
|
||||
} else {
|
||||
|
|
|
@ -5,8 +5,8 @@ use project::project_settings::{InlineBlameSettings, ProjectSettings};
|
|||
use settings::{EditableSettingControl, Settings};
|
||||
use theme::{FontFamilyCache, ThemeSettings};
|
||||
use ui::{
|
||||
prelude::*, CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer,
|
||||
SettingsGroup,
|
||||
CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, SettingsGroup,
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
use crate::EditorSettings;
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
use super::*;
|
||||
use crate::{
|
||||
JoinLines,
|
||||
scroll::scroll_amount::ScrollAmount,
|
||||
test::{
|
||||
assert_text_with_selections, build_editor,
|
||||
editor_lsp_test_context::{git_commit_lang, EditorLspTestContext},
|
||||
editor_lsp_test_context::{EditorLspTestContext, git_commit_lang},
|
||||
editor_test_context::EditorTestContext,
|
||||
select_ranges,
|
||||
},
|
||||
JoinLines,
|
||||
};
|
||||
use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind};
|
||||
use futures::StreamExt;
|
||||
use gpui::{
|
||||
div, BackgroundExecutor, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext,
|
||||
WindowBounds, WindowOptions,
|
||||
BackgroundExecutor, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext,
|
||||
WindowBounds, WindowOptions, div,
|
||||
};
|
||||
use indoc::indoc;
|
||||
use language::{
|
||||
language_settings::{
|
||||
AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings,
|
||||
LanguageSettingsContent, PrettierSettings,
|
||||
},
|
||||
BracketPairConfig,
|
||||
Capability::ReadWrite,
|
||||
FakeLspAdapter, LanguageConfig, LanguageConfigOverride, LanguageMatcher, LanguageName,
|
||||
Override, Point,
|
||||
language_settings::{
|
||||
AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings,
|
||||
LanguageSettingsContent, PrettierSettings,
|
||||
},
|
||||
};
|
||||
use language_settings::{Formatter, FormatterList, IndentGuideSettings};
|
||||
use lsp::CompletionParams;
|
||||
|
@ -32,9 +32,9 @@ use multi_buffer::{IndentGuide, PathKey};
|
|||
use parking_lot::Mutex;
|
||||
use pretty_assertions::{assert_eq, assert_ne};
|
||||
use project::{
|
||||
FakeFs,
|
||||
debugger::breakpoint_store::{BreakpointState, SourceBreakpoint},
|
||||
project_settings::{LspSettings, ProjectSettings},
|
||||
FakeFs,
|
||||
};
|
||||
use serde_json::{self, json};
|
||||
use std::{cell::RefCell, future::Future, rc::Rc, sync::atomic::AtomicBool, time::Instant};
|
||||
|
@ -47,12 +47,12 @@ use text::ToPoint as _;
|
|||
use unindent::Unindent;
|
||||
use util::{
|
||||
assert_set_eq, path,
|
||||
test::{marked_text_ranges, marked_text_ranges_by, sample_text, TextRangeMarker},
|
||||
test::{TextRangeMarker, marked_text_ranges, marked_text_ranges_by, sample_text},
|
||||
uri,
|
||||
};
|
||||
use workspace::{
|
||||
item::{FollowEvent, FollowableItem, Item, ItemHandle},
|
||||
CloseAllItems, CloseInactiveItems, NavigationEntry, ViewId,
|
||||
item::{FollowEvent, FollowableItem, Item, ItemHandle},
|
||||
};
|
||||
|
||||
#[gpui::test]
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
use crate::{
|
||||
BlockId, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR, ChunkReplacement,
|
||||
ContextMenuPlacement, CursorShape, CustomBlockId, DisplayDiffHunk, DisplayPoint, DisplayRow,
|
||||
DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, Editor, EditorMode,
|
||||
EditorSettings, EditorSnapshot, EditorStyle, FILE_HEADER_HEIGHT, FocusedBlock,
|
||||
GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput,
|
||||
HoveredCursor, InlayHintRefreshReason, InlineCompletion, JumpData, LineDown, LineHighlight,
|
||||
LineUp, MAX_LINE_LEN, MIN_LINE_NUMBER_DIGITS, MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, OpenExcerpts,
|
||||
PageDown, PageUp, Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection,
|
||||
SoftWrap, StickyHeaderExcerpt, ToPoint, ToggleFold,
|
||||
code_context_menus::{CodeActionsMenu, MENU_ASIDE_MAX_WIDTH, MENU_ASIDE_MIN_WIDTH, MENU_GAP},
|
||||
commit_tooltip::{blame_entry_relative_timestamp, CommitTooltip, ParsedCommitMessage},
|
||||
commit_tooltip::{CommitTooltip, ParsedCommitMessage, blame_entry_relative_timestamp},
|
||||
display_map::{
|
||||
Block, BlockContext, BlockStyle, DisplaySnapshot, HighlightedChunk, ToDisplayPoint,
|
||||
},
|
||||
|
@ -10,46 +19,37 @@ use crate::{
|
|||
},
|
||||
git::blame::GitBlame,
|
||||
hover_popover::{
|
||||
self, hover_at, HOVER_POPOVER_GAP, MIN_POPOVER_CHARACTER_WIDTH, MIN_POPOVER_LINE_HEIGHT,
|
||||
self, HOVER_POPOVER_GAP, MIN_POPOVER_CHARACTER_WIDTH, MIN_POPOVER_LINE_HEIGHT, hover_at,
|
||||
},
|
||||
inlay_hint_settings,
|
||||
items::BufferSearchHighlights,
|
||||
mouse_context_menu::{self, MenuPosition, MouseContextMenu},
|
||||
scroll::scroll_amount::ScrollAmount,
|
||||
BlockId, ChunkReplacement, ContextMenuPlacement, CursorShape, CustomBlockId, DisplayDiffHunk,
|
||||
DisplayPoint, DisplayRow, DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode,
|
||||
Editor, EditorMode, EditorSettings, EditorSnapshot, EditorStyle, FocusedBlock,
|
||||
GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor, InlayHintRefreshReason,
|
||||
InlineCompletion, JumpData, LineDown, LineHighlight, LineUp, OpenExcerpts, PageDown, PageUp,
|
||||
Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, SoftWrap,
|
||||
StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR,
|
||||
FILE_HEADER_HEIGHT, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, MAX_LINE_LEN, MIN_LINE_NUMBER_DIGITS,
|
||||
MULTI_BUFFER_EXCERPT_HEADER_HEIGHT,
|
||||
};
|
||||
use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind};
|
||||
use client::ParticipantIndex;
|
||||
use collections::{BTreeMap, HashMap, HashSet};
|
||||
use feature_flags::{Debugger, FeatureFlagAppExt};
|
||||
use file_icons::FileIcons;
|
||||
use git::{blame::BlameEntry, status::FileStatus, Oid};
|
||||
use git::{Oid, blame::BlameEntry, status::FileStatus};
|
||||
use gpui::{
|
||||
anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline, point, px, quad,
|
||||
relative, size, solid_background, transparent_black, Action, Along, AnyElement, App,
|
||||
AvailableSpace, Axis as ScrollbarAxis, BorderStyle, Bounds, ClickEvent, ClipboardItem,
|
||||
ContentMask, Context, Corner, Corners, CursorStyle, DispatchPhase, Edges, Element,
|
||||
ElementInputHandler, Entity, Focusable as _, FontId, GlobalElementId, Hitbox, Hsla,
|
||||
InteractiveElement, IntoElement, Keystroke, Length, ModifiersChangedEvent, MouseButton,
|
||||
Action, Along, AnyElement, App, AvailableSpace, Axis as ScrollbarAxis, BorderStyle, Bounds,
|
||||
ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners, CursorStyle, DispatchPhase,
|
||||
Edges, Element, ElementInputHandler, Entity, Focusable as _, 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, Window,
|
||||
Subscription, TextRun, TextStyleRefinement, Window, anchored, deferred, div, fill,
|
||||
linear_color_stop, linear_gradient, outline, point, px, quad, relative, size, solid_background,
|
||||
transparent_black,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
ChunkRendererContext,
|
||||
language_settings::{
|
||||
IndentGuideBackgroundColoring, IndentGuideColoring, IndentGuideSettings,
|
||||
ShowWhitespaceSetting,
|
||||
},
|
||||
ChunkRendererContext,
|
||||
};
|
||||
use lsp::DiagnosticSeverity;
|
||||
use multi_buffer::{
|
||||
|
@ -61,7 +61,7 @@ use project::{
|
|||
project_settings::{self, GitGutterSetting, GitHunkStyleSetting, ProjectSettings},
|
||||
};
|
||||
use settings::Settings;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use std::{
|
||||
any::TypeId,
|
||||
borrow::Cow,
|
||||
|
@ -76,9 +76,9 @@ use std::{
|
|||
use sum_tree::Bias;
|
||||
use text::BufferId;
|
||||
use theme::{ActiveTheme, Appearance, BufferLineHeight, PlayerColor};
|
||||
use ui::{h_flex, prelude::*, ButtonLike, ContextMenu, KeyBinding, Tooltip, POPOVER_Y_PADDING};
|
||||
use ui::{ButtonLike, ContextMenu, KeyBinding, POPOVER_Y_PADDING, Tooltip, h_flex, prelude::*};
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use util::{debug_panic, RangeExt, ResultExt};
|
||||
use util::{RangeExt, ResultExt, debug_panic};
|
||||
use workspace::{item::Item, notifications::NotifyTaskExt};
|
||||
|
||||
const INLINE_BLAME_PADDING_EM_WIDTHS: f32 = 7.;
|
||||
|
@ -8490,9 +8490,9 @@ fn compute_auto_height_layout(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
Editor, MultiBuffer,
|
||||
display_map::{BlockPlacement, BlockProperties},
|
||||
editor_tests::{init_test, update_test_language_settings},
|
||||
Editor, MultiBuffer,
|
||||
};
|
||||
use gpui::{TestAppContext, VisualTestContext};
|
||||
use language::language_settings;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use anyhow::Result;
|
||||
use collections::HashMap;
|
||||
use git::{
|
||||
GitHostingProvider, GitHostingProviderRegistry, Oid,
|
||||
blame::{Blame, BlameEntry},
|
||||
parse_git_remote_url, GitHostingProvider, GitHostingProviderRegistry, Oid,
|
||||
parse_git_remote_url,
|
||||
};
|
||||
use gpui::{App, AppContext as _, Context, Entity, Subscription, Task};
|
||||
use http_client::HttpClient;
|
||||
|
@ -529,7 +530,7 @@ mod tests {
|
|||
use std::{cmp, env, ops::Range, path::Path};
|
||||
use text::BufferId;
|
||||
use unindent::Unindent as _;
|
||||
use util::{path, RandomCharIter};
|
||||
use util::{RandomCharIter, path};
|
||||
|
||||
// macro_rules! assert_blame_rows {
|
||||
// ($blame:expr, $rows:expr, $expected:expr, $cx:expr) => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::{
|
||||
Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition,
|
||||
GoToTypeDefinition, GotoDefinitionKind, InlayId, Navigated, PointForPosition, SelectPhase,
|
||||
editor_settings::{GoToDefinitionFallback, MultiCursorModifier},
|
||||
hover_popover::{self, InlayHover},
|
||||
scroll::ScrollAmount,
|
||||
Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition,
|
||||
GoToTypeDefinition, GotoDefinitionKind, InlayId, Navigated, PointForPosition, SelectPhase,
|
||||
};
|
||||
use gpui::{px, App, AsyncWindowContext, Context, Entity, Modifiers, Task, Window};
|
||||
use gpui::{App, AsyncWindowContext, Context, Entity, Modifiers, Task, Window, px};
|
||||
use language::{Bias, ToOffset};
|
||||
use linkify::{LinkFinder, LinkKind};
|
||||
use lsp::LanguageServerId;
|
||||
|
@ -16,7 +16,7 @@ use project::{
|
|||
use settings::Settings;
|
||||
use std::ops::Range;
|
||||
use theme::ActiveTheme as _;
|
||||
use util::{maybe, ResultExt, TryFutureExt as _};
|
||||
use util::{ResultExt, TryFutureExt as _, maybe};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HoveredLinkState {
|
||||
|
@ -920,11 +920,11 @@ fn surrounding_filename(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
DisplayPoint,
|
||||
display_map::ToDisplayPoint,
|
||||
editor_tests::init_test,
|
||||
inlay_hint_cache::tests::{cached_hint_labels, visible_hint_labels},
|
||||
test::editor_lsp_test_context::EditorLspTestContext,
|
||||
DisplayPoint,
|
||||
};
|
||||
use futures::StreamExt;
|
||||
use gpui::Modifiers;
|
||||
|
@ -1633,12 +1633,14 @@ mod tests {
|
|||
cx.simulate_mouse_move(screen_coord, None, Modifiers::secondary_key());
|
||||
// No highlight
|
||||
cx.update_editor(|editor, window, cx| {
|
||||
assert!(editor
|
||||
.snapshot(window, cx)
|
||||
.text_highlight_ranges::<HoveredLinkState>()
|
||||
.unwrap_or_default()
|
||||
.1
|
||||
.is_empty());
|
||||
assert!(
|
||||
editor
|
||||
.snapshot(window, cx)
|
||||
.text_highlight_ranges::<HoveredLinkState>()
|
||||
.unwrap_or_default()
|
||||
.1
|
||||
.is_empty()
|
||||
);
|
||||
});
|
||||
|
||||
// Moving the mouse over a file that does exist should highlight it.
|
||||
|
@ -1838,12 +1840,14 @@ mod tests {
|
|||
|
||||
// No highlight
|
||||
cx.update_editor(|editor, window, cx| {
|
||||
assert!(editor
|
||||
.snapshot(window, cx)
|
||||
.text_highlight_ranges::<HoveredLinkState>()
|
||||
.unwrap_or_default()
|
||||
.1
|
||||
.is_empty());
|
||||
assert!(
|
||||
editor
|
||||
.snapshot(window, cx)
|
||||
.text_highlight_ranges::<HoveredLinkState>()
|
||||
.unwrap_or_default()
|
||||
.1
|
||||
.is_empty()
|
||||
);
|
||||
});
|
||||
|
||||
// Does not open the directory
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
use crate::{
|
||||
display_map::{invisibles::is_invisible, InlayOffset, ToDisplayPoint},
|
||||
hover_links::{InlayHighlight, RangeInEditor},
|
||||
scroll::{Autoscroll, ScrollAmount},
|
||||
Anchor, AnchorRangeExt, DisplayPoint, DisplayRow, Editor, EditorSettings, EditorSnapshot,
|
||||
Hover,
|
||||
display_map::{InlayOffset, ToDisplayPoint, invisibles::is_invisible},
|
||||
hover_links::{InlayHighlight, RangeInEditor},
|
||||
scroll::{Autoscroll, ScrollAmount},
|
||||
};
|
||||
use gpui::{
|
||||
div, px, AnyElement, AsyncWindowContext, Context, Entity, Focusable as _, FontWeight, Hsla,
|
||||
AnyElement, AsyncWindowContext, Context, Entity, Focusable as _, FontWeight, Hsla,
|
||||
InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, ScrollHandle, Size,
|
||||
Stateful, StatefulInteractiveElement, StyleRefinement, Styled, Task, TextStyleRefinement,
|
||||
Window,
|
||||
Window, div, px,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{DiagnosticEntry, Language, LanguageRegistry};
|
||||
|
@ -22,7 +22,7 @@ use std::{borrow::Cow, cell::RefCell};
|
|||
use std::{ops::Range, sync::Arc, time::Duration};
|
||||
use std::{path::PathBuf, rc::Rc};
|
||||
use theme::ThemeSettings;
|
||||
use ui::{prelude::*, theme_is_transparent, Scrollbar, ScrollbarState};
|
||||
use ui::{Scrollbar, ScrollbarState, prelude::*, theme_is_transparent};
|
||||
use url::Url;
|
||||
use util::TryFutureExt;
|
||||
use workspace::{OpenOptions, OpenVisible, Workspace};
|
||||
|
@ -918,17 +918,17 @@ impl DiagnosticPopover {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
InlayId, PointForPosition,
|
||||
actions::ConfirmCompletion,
|
||||
editor_tests::{handle_completion_request, init_test},
|
||||
hover_links::update_inlay_link_and_hover_points,
|
||||
inlay_hint_cache::tests::{cached_hint_labels, visible_hint_labels},
|
||||
test::editor_lsp_test_context::EditorLspTestContext,
|
||||
InlayId, PointForPosition,
|
||||
};
|
||||
use collections::BTreeSet;
|
||||
use gpui::App;
|
||||
use indoc::indoc;
|
||||
use language::{language_settings::InlayHintSettings, Diagnostic, DiagnosticSet};
|
||||
use language::{Diagnostic, DiagnosticSet, language_settings::InlayHintSettings};
|
||||
use lsp::LanguageServerId;
|
||||
use markdown::parser::MarkdownEvent;
|
||||
use smol::stream::StreamExt;
|
||||
|
|
|
@ -14,22 +14,22 @@ use std::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
display_map::Inlay, Anchor, Editor, ExcerptId, InlayId, MultiBuffer, MultiBufferSnapshot,
|
||||
Anchor, Editor, ExcerptId, InlayId, MultiBuffer, MultiBufferSnapshot, display_map::Inlay,
|
||||
};
|
||||
use anyhow::Context as _;
|
||||
use clock::Global;
|
||||
use futures::future;
|
||||
use gpui::{AppContext as _, AsyncApp, Context, Entity, Task, Window};
|
||||
use language::{language_settings::InlayHintKind, Buffer, BufferSnapshot};
|
||||
use language::{Buffer, BufferSnapshot, language_settings::InlayHintKind};
|
||||
use parking_lot::RwLock;
|
||||
use project::{InlayHint, ResolveState};
|
||||
|
||||
use collections::{hash_map, HashMap, HashSet};
|
||||
use collections::{HashMap, HashSet, hash_map};
|
||||
use language::language_settings::InlayHintSettings;
|
||||
use smol::lock::Semaphore;
|
||||
use sum_tree::Bias;
|
||||
use text::{BufferId, ToOffset, ToPoint};
|
||||
use util::{post_inc, ResultExt};
|
||||
use util::{ResultExt, post_inc};
|
||||
|
||||
pub struct InlayHintCache {
|
||||
hints: HashMap<ExcerptId, Arc<RwLock<CachedExcerptHints>>>,
|
||||
|
@ -1292,11 +1292,11 @@ fn apply_hint_update(
|
|||
pub mod tests {
|
||||
use crate::editor_tests::update_test_language_settings;
|
||||
use crate::scroll::ScrollAmount;
|
||||
use crate::{scroll::Autoscroll, test::editor_lsp_test_context::rust_lang, ExcerptRange};
|
||||
use crate::{ExcerptRange, scroll::Autoscroll, test::editor_lsp_test_context::rust_lang};
|
||||
use futures::StreamExt;
|
||||
use gpui::{AppContext as _, Context, SemanticVersion, TestAppContext, WindowHandle};
|
||||
use itertools::Itertools as _;
|
||||
use language::{language_settings::AllLanguageSettingsContent, Capability, FakeLspAdapter};
|
||||
use language::{Capability, FakeLspAdapter, language_settings::AllLanguageSettingsContent};
|
||||
use language::{Language, LanguageConfig, LanguageMatcher};
|
||||
use lsp::FakeLanguageServer;
|
||||
use parking_lot::Mutex;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use gpui::{prelude::*, Entity};
|
||||
use gpui::{Entity, prelude::*};
|
||||
use indoc::indoc;
|
||||
use inline_completion::EditPredictionProvider;
|
||||
use multi_buffer::{Anchor, MultiBufferSnapshot, ToPoint};
|
||||
|
@ -7,7 +7,7 @@ use std::ops::Range;
|
|||
use text::{Point, ToOffset};
|
||||
|
||||
use crate::{
|
||||
editor_tests::init_test, test::editor_test_context::EditorTestContext, InlineCompletion,
|
||||
InlineCompletion, editor_tests::init_test, test::editor_test_context::EditorTestContext,
|
||||
};
|
||||
|
||||
#[gpui::test]
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
use crate::{
|
||||
editor_settings::SeedQuerySetting,
|
||||
persistence::{SerializedEditor, DB},
|
||||
scroll::ScrollAnchor,
|
||||
Anchor, Autoscroll, Editor, EditorEvent, EditorSettings, ExcerptId, ExcerptRange, FormatTarget,
|
||||
MultiBuffer, MultiBufferSnapshot, NavigationData, SearchWithinRange, ToPoint as _,
|
||||
editor_settings::SeedQuerySetting,
|
||||
persistence::{DB, SerializedEditor},
|
||||
scroll::ScrollAnchor,
|
||||
};
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use clock::Global;
|
||||
use collections::{HashMap, HashSet};
|
||||
use file_icons::FileIcons;
|
||||
use futures::future::try_join_all;
|
||||
use git::status::GitSummary;
|
||||
use gpui::{
|
||||
point, AnyElement, App, AsyncWindowContext, Context, Entity, EntityId, EventEmitter,
|
||||
IntoElement, ParentElement, Pixels, SharedString, Styled, Task, WeakEntity, Window,
|
||||
AnyElement, App, AsyncWindowContext, Context, Entity, EntityId, EventEmitter, IntoElement,
|
||||
ParentElement, Pixels, SharedString, Styled, Task, WeakEntity, Window, point,
|
||||
};
|
||||
use language::{
|
||||
proto::serialize_anchor as serialize_text_anchor, Bias, Buffer, CharKind, DiskState, Point,
|
||||
SelectionGoal,
|
||||
Bias, Buffer, CharKind, DiskState, Point, SelectionGoal,
|
||||
proto::serialize_anchor as serialize_text_anchor,
|
||||
};
|
||||
use lsp::DiagnosticSeverity;
|
||||
use project::{
|
||||
lsp_store::FormatTrigger, project_settings::ProjectSettings, search::SearchQuery, Project,
|
||||
ProjectEntryId, ProjectItem as _, ProjectPath,
|
||||
Project, ProjectEntryId, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger,
|
||||
project_settings::ProjectSettings, search::SearchQuery,
|
||||
};
|
||||
use rpc::proto::{self, update_view, PeerId};
|
||||
use rpc::proto::{self, PeerId, update_view};
|
||||
use settings::Settings;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
|
@ -38,21 +38,21 @@ use std::{
|
|||
};
|
||||
use text::{BufferId, Selection};
|
||||
use theme::{Theme, ThemeSettings};
|
||||
use ui::{prelude::*, IconDecorationKind};
|
||||
use util::{paths::PathExt, ResultExt, TryFutureExt};
|
||||
use workspace::{
|
||||
item::{BreadcrumbText, FollowEvent, ProjectItemKind},
|
||||
searchable::SearchOptions,
|
||||
OpenVisible, Pane, WorkspaceSettings,
|
||||
};
|
||||
use workspace::{
|
||||
item::{Dedup, ItemSettings, SerializableItem, TabContentParams},
|
||||
OpenOptions,
|
||||
};
|
||||
use ui::{IconDecorationKind, prelude::*};
|
||||
use util::{ResultExt, TryFutureExt, paths::PathExt};
|
||||
use workspace::{
|
||||
ItemId, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId,
|
||||
item::{FollowableItem, Item, ItemEvent, ProjectItem},
|
||||
searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle},
|
||||
ItemId, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId,
|
||||
};
|
||||
use workspace::{
|
||||
OpenOptions,
|
||||
item::{Dedup, ItemSettings, SerializableItem, TabContentParams},
|
||||
};
|
||||
use workspace::{
|
||||
OpenVisible, Pane, WorkspaceSettings,
|
||||
item::{BreadcrumbText, FollowEvent, ProjectItemKind},
|
||||
searchable::SearchOptions,
|
||||
};
|
||||
|
||||
pub const MAX_TAB_TITLE_LEN: usize = 24;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use anyhow::{anyhow, Context as _, Result};
|
||||
use anyhow::{Context as _, Result, anyhow};
|
||||
use collections::HashMap;
|
||||
use gpui::{Context, Entity, Window};
|
||||
use multi_buffer::{MultiBuffer, ToOffset};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::actions::FormatSelections;
|
||||
use crate::CopyAndTrim;
|
||||
use crate::actions::FormatSelections;
|
||||
use crate::{
|
||||
actions::Format, selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut,
|
||||
DisplayPoint, DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDeclaration,
|
||||
GoToDefinition, GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFileManager,
|
||||
SelectMode, ToDisplayPoint, ToggleCodeActions,
|
||||
Copy, CopyPermalinkToLine, Cut, DisplayPoint, DisplaySnapshot, Editor, EditorMode,
|
||||
FindAllReferences, GoToDeclaration, GoToDefinition, GoToImplementation, GoToTypeDefinition,
|
||||
Paste, Rename, RevealInFileManager, SelectMode, ToDisplayPoint, ToggleCodeActions,
|
||||
actions::Format, selections_collection::SelectionsCollection,
|
||||
};
|
||||
use gpui::prelude::FluentBuilder;
|
||||
use gpui::{Context, DismissEvent, Entity, Focusable as _, Pixels, Point, Subscription, Window};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//! in editor given a given motion (e.g. it handles converting a "move left" command into coordinates in editor). It is exposed mostly for use by vim crate.
|
||||
|
||||
use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint};
|
||||
use crate::{scroll::ScrollAnchor, CharKind, DisplayRow, EditorStyle, ToOffset, ToPoint};
|
||||
use crate::{CharKind, DisplayRow, EditorStyle, ToOffset, ToPoint, scroll::ScrollAnchor};
|
||||
use gpui::{Pixels, WindowTextSystem};
|
||||
use language::Point;
|
||||
use multi_buffer::{MultiBufferRow, MultiBufferSnapshot};
|
||||
|
@ -766,11 +766,11 @@ pub fn split_display_range_by_lines(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
Buffer, DisplayMap, DisplayRow, ExcerptRange, FoldPlaceholder, InlayId, MultiBuffer,
|
||||
display_map::Inlay,
|
||||
test::{editor_test_context::EditorTestContext, marked_display_snapshot},
|
||||
Buffer, DisplayMap, DisplayRow, ExcerptRange, FoldPlaceholder, InlayId, MultiBuffer,
|
||||
};
|
||||
use gpui::{font, px, AppContext as _};
|
||||
use gpui::{AppContext as _, font, px};
|
||||
use language::Capability;
|
||||
use project::Project;
|
||||
use settings::SettingsStore;
|
||||
|
|
|
@ -9,10 +9,10 @@ use project::Project;
|
|||
use smol::stream::StreamExt;
|
||||
use std::{any::TypeId, ops::Range, rc::Rc, time::Duration};
|
||||
use text::ToOffset;
|
||||
use ui::{prelude::*, ButtonLike, KeyBinding};
|
||||
use ui::{ButtonLike, KeyBinding, prelude::*};
|
||||
use workspace::{
|
||||
searchable::SearchableItemHandle, Item, ItemHandle as _, ToolbarItemEvent, ToolbarItemLocation,
|
||||
ToolbarItemView, Workspace,
|
||||
Item, ItemHandle as _, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace,
|
||||
searchable::SearchableItemHandle,
|
||||
};
|
||||
|
||||
pub struct ProposedChangesEditor {
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{fs, path::Path};
|
|||
|
||||
use anyhow::Context as _;
|
||||
use gpui::{App, AppContext as _, Context, Entity, Window};
|
||||
use language::{proto::serialize_anchor, Capability, Language};
|
||||
use language::{Capability, Language, proto::serialize_anchor};
|
||||
use multi_buffer::MultiBuffer;
|
||||
use project::lsp_store::{
|
||||
lsp_ext_command::{DocsUrls, ExpandMacro, ExpandedMacro},
|
||||
|
@ -12,8 +12,8 @@ use rpc::proto;
|
|||
use text::ToPointUtf16;
|
||||
|
||||
use crate::{
|
||||
element::register_action, lsp_ext::find_specific_language_server_in_selection, Editor,
|
||||
ExpandMacroRecursively, OpenDocs,
|
||||
Editor, ExpandMacroRecursively, OpenDocs, element::register_action,
|
||||
lsp_ext::find_specific_language_server_in_selection,
|
||||
};
|
||||
|
||||
fn is_rust_language(language: &Language) -> bool {
|
||||
|
|
|
@ -4,15 +4,15 @@ pub(crate) mod scroll_amount;
|
|||
|
||||
use crate::editor_settings::ScrollBeyondLastLine;
|
||||
use crate::{
|
||||
Anchor, DisplayPoint, DisplayRow, Editor, EditorEvent, EditorMode, EditorSettings,
|
||||
InlayHintRefreshReason, MultiBufferSnapshot, RowExt, ToPoint,
|
||||
display_map::{DisplaySnapshot, ToDisplayPoint},
|
||||
hover_popover::hide_hover,
|
||||
persistence::DB,
|
||||
Anchor, DisplayPoint, DisplayRow, Editor, EditorEvent, EditorMode, EditorSettings,
|
||||
InlayHintRefreshReason, MultiBufferSnapshot, RowExt, ToPoint,
|
||||
};
|
||||
pub use autoscroll::{Autoscroll, AutoscrollStrategy};
|
||||
use core::fmt::Debug;
|
||||
use gpui::{point, px, App, Axis, Context, Global, Pixels, Task, Window};
|
||||
use gpui::{App, Axis, Context, Global, Pixels, Task, Window, point, px};
|
||||
use language::{Bias, Point};
|
||||
pub use scroll_amount::ScrollAmount;
|
||||
use settings::Settings;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use super::Axis;
|
||||
use crate::{
|
||||
display_map::DisplayRow, Autoscroll, Editor, EditorMode, NextScreen,
|
||||
NextScrollCursorCenterTopBottom, ScrollCursorBottom, ScrollCursorCenter,
|
||||
ScrollCursorCenterTopBottom, ScrollCursorTop, SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT,
|
||||
Autoscroll, Editor, EditorMode, NextScreen, NextScrollCursorCenterTopBottom,
|
||||
SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT, ScrollCursorBottom, ScrollCursorCenter,
|
||||
ScrollCursorCenterTopBottom, ScrollCursorTop, display_map::DisplayRow,
|
||||
};
|
||||
use gpui::{Context, Point, Window};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
display_map::ToDisplayPoint, DisplayRow, Editor, EditorMode, LineWithInvisibles, RowExt,
|
||||
DisplayRow, Editor, EditorMode, LineWithInvisibles, RowExt, display_map::ToDisplayPoint,
|
||||
};
|
||||
use gpui::{px, Bounds, Context, Pixels, Window};
|
||||
use gpui::{Bounds, Context, Pixels, Window, px};
|
||||
use language::Point;
|
||||
use multi_buffer::Anchor;
|
||||
use std::{cmp, f32};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use serde::Deserialize;
|
||||
use ui::{px, Pixels};
|
||||
use ui::{Pixels, px};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ScrollDirection {
|
||||
|
|
|
@ -12,10 +12,10 @@ use language::{Bias, Point, Selection, SelectionGoal, TextDimension};
|
|||
use util::post_inc;
|
||||
|
||||
use crate::{
|
||||
display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint},
|
||||
movement::TextLayoutDetails,
|
||||
Anchor, DisplayPoint, DisplayRow, ExcerptId, MultiBuffer, MultiBufferSnapshot, SelectMode,
|
||||
ToOffset, ToPoint,
|
||||
display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint},
|
||||
movement::TextLayoutDetails,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::actions::ShowSignatureHelp;
|
||||
use crate::{Editor, EditorSettings, ToggleAutoSignatureHelp};
|
||||
use gpui::{
|
||||
combine_highlights, App, Context, HighlightStyle, MouseButton, Size, StyledText, Task,
|
||||
TextStyle, Window,
|
||||
App, Context, HighlightStyle, MouseButton, Size, StyledText, Task, TextStyle, Window,
|
||||
combine_highlights,
|
||||
};
|
||||
use language::BufferSnapshot;
|
||||
use multi_buffer::{Anchor, ToOffset};
|
||||
|
@ -11,8 +11,8 @@ use std::ops::Range;
|
|||
use text::Rope;
|
||||
use theme::ThemeSettings;
|
||||
use ui::{
|
||||
div, relative, ActiveTheme, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels,
|
||||
SharedString, StatefulInteractiveElement, Styled, StyledExt,
|
||||
ActiveTheme, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels, SharedString,
|
||||
StatefulInteractiveElement, Styled, StyledExt, div, relative,
|
||||
};
|
||||
|
||||
// Language-specific settings may define quotes as "brackets", so filter them out separately.
|
||||
|
|
|
@ -4,12 +4,12 @@ pub mod editor_test_context;
|
|||
use std::sync::LazyLock;
|
||||
|
||||
use crate::{
|
||||
display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint},
|
||||
DisplayPoint, Editor, EditorMode, FoldPlaceholder, MultiBuffer,
|
||||
display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint},
|
||||
};
|
||||
use gpui::{
|
||||
font, AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels,
|
||||
Window,
|
||||
AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels, Window,
|
||||
font,
|
||||
};
|
||||
use project::Project;
|
||||
use util::test::{marked_text_offsets, marked_text_ranges};
|
||||
|
|
|
@ -14,7 +14,7 @@ use futures::Future;
|
|||
use gpui::{Context, Entity, Focusable as _, VisualTestContext, Window};
|
||||
use indoc::indoc;
|
||||
use language::{
|
||||
point_to_lsp, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries,
|
||||
FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries, point_to_lsp,
|
||||
};
|
||||
use lsp::{notification, request};
|
||||
use multi_buffer::ToPointUtf16;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use crate::{
|
||||
display_map::ToDisplayPoint, AnchorRangeExt, Autoscroll, DisplayPoint, Editor, MultiBuffer,
|
||||
RowExt,
|
||||
AnchorRangeExt, Autoscroll, DisplayPoint, Editor, MultiBuffer, RowExt,
|
||||
display_map::ToDisplayPoint,
|
||||
};
|
||||
use buffer_diff::DiffHunkStatusKind;
|
||||
use collections::BTreeMap;
|
||||
use futures::Future;
|
||||
|
||||
use gpui::{
|
||||
prelude::*, AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point,
|
||||
VisualTestContext, Window, WindowHandle,
|
||||
AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point,
|
||||
VisualTestContext, Window, WindowHandle, prelude::*,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{Buffer, BufferSnapshot, LanguageRegistry};
|
||||
|
@ -20,8 +20,8 @@ use std::{
|
|||
ops::{Deref, DerefMut, Range},
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc,
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
},
|
||||
};
|
||||
use util::{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue