Re-export basic text types from text and language crates

Also avoid production dependencies on fs and rope in collab
This commit is contained in:
Max Brunsfeld 2022-10-12 15:48:19 -07:00
parent fedec68d39
commit 6cdf4e98fc
43 changed files with 51 additions and 102 deletions

9
Cargo.lock generated
View File

@ -1084,7 +1084,6 @@ dependencies = [
"prometheus", "prometheus",
"rand 0.8.5", "rand 0.8.5",
"reqwest", "reqwest",
"rope",
"rpc", "rpc",
"scrypt", "scrypt",
"serde", "serde",
@ -1576,7 +1575,6 @@ dependencies = [
"language", "language",
"postage", "postage",
"project", "project",
"rope",
"serde_json", "serde_json",
"settings", "settings",
"smallvec", "smallvec",
@ -1730,7 +1728,6 @@ dependencies = [
"postage", "postage",
"project", "project",
"rand 0.8.5", "rand 0.8.5",
"rope",
"rpc", "rpc",
"serde", "serde",
"settings", "settings",
@ -2294,7 +2291,6 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"parking_lot 0.11.2", "parking_lot 0.11.2",
"rope",
"smol", "smol",
"sum_tree", "sum_tree",
"text", "text",
@ -2342,7 +2338,6 @@ dependencies = [
"gpui", "gpui",
"menu", "menu",
"postage", "postage",
"rope",
"settings", "settings",
"text", "text",
"workspace", "workspace",
@ -2943,7 +2938,6 @@ dependencies = [
"postage", "postage",
"rand 0.8.5", "rand 0.8.5",
"regex", "regex",
"rope",
"rpc", "rpc",
"serde", "serde",
"serde_json", "serde_json",
@ -4123,7 +4117,6 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"regex", "regex",
"rocksdb", "rocksdb",
"rope",
"rpc", "rpc",
"serde", "serde",
"serde_json", "serde_json",
@ -5148,7 +5141,6 @@ dependencies = [
"gpui", "gpui",
"json_comments", "json_comments",
"postage", "postage",
"rope",
"schemars", "schemars",
"serde", "serde",
"serde_json", "serde_json",
@ -6639,7 +6631,6 @@ dependencies = [
"nvim-rs", "nvim-rs",
"parking_lot 0.11.2", "parking_lot 0.11.2",
"project", "project",
"rope",
"search", "search",
"serde", "serde",
"serde_json", "serde_json",

View File

@ -16,8 +16,6 @@ required-features = ["seed-support"]
collections = { path = "../collections" } collections = { path = "../collections" }
rpc = { path = "../rpc" } rpc = { path = "../rpc" }
util = { path = "../util" } util = { path = "../util" }
fs = { path = "../fs" }
rope = { path = "../rope" }
anyhow = "1.0.40" anyhow = "1.0.40"
async-trait = "0.1.50" async-trait = "0.1.50"
async-tungstenite = "0.16" async-tungstenite = "0.16"
@ -27,7 +25,6 @@ base64 = "0.13"
clap = { version = "3.1", features = ["derive"], optional = true } clap = { version = "3.1", features = ["derive"], optional = true }
envy = "0.4.2" envy = "0.4.2"
futures = "0.3" futures = "0.3"
git = { path = "../git" }
hyper = "0.14" hyper = "0.14"
lazy_static = "1.4" lazy_static = "1.4"
lipsum = { version = "0.8", optional = true } lipsum = { version = "0.8", optional = true }
@ -61,6 +58,8 @@ call = { path = "../call", features = ["test-support"] }
client = { path = "../client", features = ["test-support"] } client = { path = "../client", features = ["test-support"] }
editor = { path = "../editor", features = ["test-support"] } editor = { path = "../editor", features = ["test-support"] }
language = { path = "../language", features = ["test-support"] } language = { path = "../language", features = ["test-support"] }
fs = { path = "../fs", features = ["test-support"] }
git = { path = "../git", features = ["test-support"] }
log = { version = "0.4.16", features = ["kv_unstable_serde"] } log = { version = "0.4.16", features = ["kv_unstable_serde"] }
lsp = { path = "../lsp", features = ["test-support"] } lsp = { path = "../lsp", features = ["test-support"] }
project = { path = "../project", features = ["test-support"] } project = { path = "../project", features = ["test-support"] }
@ -68,7 +67,6 @@ rpc = { path = "../rpc", features = ["test-support"] }
settings = { path = "../settings", features = ["test-support"] } settings = { path = "../settings", features = ["test-support"] }
theme = { path = "../theme" } theme = { path = "../theme" }
workspace = { path = "../workspace", features = ["test-support"] } workspace = { path = "../workspace", features = ["test-support"] }
git = { path = "../git", features = ["test-support"] }
ctor = "0.1" ctor = "0.1"
env_logger = "0.9" env_logger = "0.9"
util = { path = "../util" } util = { path = "../util" }

View File

@ -25,7 +25,7 @@ use gpui::{
}; };
use language::{ use language::{
range_to_lsp, tree_sitter_rust, Diagnostic, DiagnosticEntry, FakeLspAdapter, Language, range_to_lsp, tree_sitter_rust, Diagnostic, DiagnosticEntry, FakeLspAdapter, Language,
LanguageConfig, LanguageRegistry, OffsetRangeExt, Rope, LanguageConfig, LanguageRegistry, OffsetRangeExt, Rope, Point,
}; };
use lsp::{self, FakeLanguageServer}; use lsp::{self, FakeLanguageServer};
use parking_lot::Mutex; use parking_lot::Mutex;
@ -34,7 +34,6 @@ use project::{
ProjectStore, WorktreeId, ProjectStore, WorktreeId,
}; };
use rand::prelude::*; use rand::prelude::*;
use rope::point::Point;
use rpc::PeerId; use rpc::PeerId;
use serde_json::json; use serde_json::json;
use settings::{Formatter, Settings}; use settings::{Formatter, Settings};

View File

@ -15,7 +15,6 @@ editor = { path = "../editor" }
language = { path = "../language" } language = { path = "../language" }
gpui = { path = "../gpui" } gpui = { path = "../gpui" }
project = { path = "../project" } project = { path = "../project" }
rope = { path = "../rope" }
settings = { path = "../settings" } settings = { path = "../settings" }
theme = { path = "../theme" } theme = { path = "../theme" }
util = { path = "../util" } util = { path = "../util" }

View File

@ -14,10 +14,10 @@ use gpui::{
ViewHandle, WeakViewHandle, ViewHandle, WeakViewHandle,
}; };
use language::{ use language::{
Anchor, Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Selection, SelectionGoal, Anchor, Bias, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection,
SelectionGoal,
}; };
use project::{DiagnosticSummary, Project, ProjectPath}; use project::{DiagnosticSummary, Project, ProjectPath};
use rope::point::Point;
use serde_json::json; use serde_json::json;
use settings::Settings; use settings::Settings;
use smallvec::SmallVec; use smallvec::SmallVec;
@ -738,8 +738,7 @@ mod tests {
DisplayPoint, DisplayPoint,
}; };
use gpui::TestAppContext; use gpui::TestAppContext;
use language::{Diagnostic, DiagnosticEntry, DiagnosticSeverity}; use language::{Diagnostic, DiagnosticEntry, DiagnosticSeverity, PointUtf16};
use rope::point_utf16::PointUtf16;
use serde_json::json; use serde_json::json;
use unindent::Unindent as _; use unindent::Unindent as _;
use workspace::AppState; use workspace::AppState;

View File

@ -30,7 +30,6 @@ gpui = { path = "../gpui" }
language = { path = "../language" } language = { path = "../language" }
lsp = { path = "../lsp" } lsp = { path = "../lsp" }
project = { path = "../project" } project = { path = "../project" }
rope = { path = "../rope" }
rpc = { path = "../rpc" } rpc = { path = "../rpc" }
settings = { path = "../settings" } settings = { path = "../settings" }
snippet = { path = "../snippet" } snippet = { path = "../snippet" }

View File

@ -11,8 +11,7 @@ use gpui::{
fonts::{FontId, HighlightStyle}, fonts::{FontId, HighlightStyle},
Entity, ModelContext, ModelHandle, Entity, ModelContext, ModelHandle,
}; };
use language::Subscription as BufferSubscription; use language::{OffsetUtf16, Point, Subscription as BufferSubscription};
use rope::{offset_utf16::OffsetUtf16, point::Point};
use settings::Settings; use settings::Settings;
use std::{any::TypeId, fmt::Debug, num::NonZeroU32, ops::Range, sync::Arc}; use std::{any::TypeId, fmt::Debug, num::NonZeroU32, ops::Range, sync::Arc};
use sum_tree::{Bias, TreeMap}; use sum_tree::{Bias, TreeMap};

View File

@ -5,9 +5,8 @@ use super::{
use crate::{Anchor, ExcerptRange, ToPoint as _}; use crate::{Anchor, ExcerptRange, ToPoint as _};
use collections::{Bound, HashMap, HashSet}; use collections::{Bound, HashMap, HashSet};
use gpui::{ElementBox, RenderContext}; use gpui::{ElementBox, RenderContext};
use language::{BufferSnapshot, Chunk, Patch}; use language::{BufferSnapshot, Chunk, Patch, Point};
use parking_lot::Mutex; use parking_lot::Mutex;
use rope::point::Point;
use std::{ use std::{
cell::RefCell, cell::RefCell,
cmp::{self, Ordering}, cmp::{self, Ordering},

View File

@ -5,9 +5,8 @@ use crate::{
}; };
use collections::BTreeMap; use collections::BTreeMap;
use gpui::fonts::HighlightStyle; use gpui::fonts::HighlightStyle;
use language::{Chunk, Edit, TextSummary}; use language::{Chunk, Edit, Point, TextSummary};
use parking_lot::Mutex; use parking_lot::Mutex;
use rope::point::Point;
use std::{ use std::{
any::TypeId, any::TypeId,
cmp::{self, Ordering}, cmp::{self, Ordering},

View File

@ -3,10 +3,8 @@ use super::{
TextHighlights, TextHighlights,
}; };
use crate::MultiBufferSnapshot; use crate::MultiBufferSnapshot;
use language::Chunk; use language::{Chunk, Point};
use parking_lot::Mutex; use parking_lot::Mutex;
use rope;
use rope::point::Point;
use std::{cmp, mem, num::NonZeroU32, ops::Range}; use std::{cmp, mem, num::NonZeroU32, ops::Range};
use sum_tree::Bias; use sum_tree::Bias;
@ -372,7 +370,7 @@ pub struct TextSummary {
impl<'a> From<&'a str> for TextSummary { impl<'a> From<&'a str> for TextSummary {
fn from(text: &'a str) -> Self { fn from(text: &'a str) -> Self {
let sum = rope::TextSummary::from(text); let sum = text::TextSummary::from(text);
TextSummary { TextSummary {
lines: sum.lines, lines: sum.lines,
@ -524,7 +522,7 @@ mod tests {
log::info!("FoldMap text: {:?}", folds_snapshot.text()); log::info!("FoldMap text: {:?}", folds_snapshot.text());
let (_, tabs_snapshot) = TabMap::new(folds_snapshot.clone(), tab_size); let (_, tabs_snapshot) = TabMap::new(folds_snapshot.clone(), tab_size);
let text = rope::Rope::from(tabs_snapshot.text().as_str()); let text = text::Rope::from(tabs_snapshot.text().as_str());
log::info!( log::info!(
"TabMap text (tab size: {}): {:?}", "TabMap text (tab size: {}): {:?}",
tab_size, tab_size,

View File

@ -8,9 +8,8 @@ use gpui::{
fonts::FontId, text_layout::LineWrapper, Entity, ModelContext, ModelHandle, MutableAppContext, fonts::FontId, text_layout::LineWrapper, Entity, ModelContext, ModelHandle, MutableAppContext,
Task, Task,
}; };
use language::Chunk; use language::{Chunk, Point};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use rope::point::Point;
use smol::future::yield_now; use smol::future::yield_now;
use std::{cmp, collections::VecDeque, mem, ops::Range, time::Duration}; use std::{cmp, collections::VecDeque, mem, ops::Range, time::Duration};
use sum_tree::{Bias, Cursor, SumTree}; use sum_tree::{Bias, Cursor, SumTree};

View File

@ -43,8 +43,8 @@ pub use items::MAX_TAB_TITLE_LEN;
pub use language::{char_kind, CharKind}; pub use language::{char_kind, CharKind};
use language::{ use language::{
AutoindentMode, BracketPair, Buffer, CodeAction, CodeLabel, Completion, Diagnostic, AutoindentMode, BracketPair, Buffer, CodeAction, CodeLabel, Completion, Diagnostic,
DiagnosticSeverity, IndentKind, IndentSize, Language, OffsetRangeExt, Selection, SelectionGoal, DiagnosticSeverity, IndentKind, IndentSize, Language, OffsetRangeExt, OffsetUtf16, Point,
TransactionId, Selection, SelectionGoal, TransactionId,
}; };
use link_go_to_definition::{hide_link_definition, LinkGoToDefinitionState}; use link_go_to_definition::{hide_link_definition, LinkGoToDefinitionState};
pub use multi_buffer::{ pub use multi_buffer::{
@ -54,7 +54,6 @@ pub use multi_buffer::{
use multi_buffer::{MultiBufferChunks, ToOffsetUtf16}; use multi_buffer::{MultiBufferChunks, ToOffsetUtf16};
use ordered_float::OrderedFloat; use ordered_float::OrderedFloat;
use project::{FormatTrigger, LocationLink, Project, ProjectPath, ProjectTransaction}; use project::{FormatTrigger, LocationLink, Project, ProjectPath, ProjectTransaction};
use rope::{offset_utf16::OffsetUtf16, point::Point};
use selections_collection::{resolve_multiple, MutableSelectionsCollection, SelectionsCollection}; use selections_collection::{resolve_multiple, MutableSelectionsCollection, SelectionsCollection};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings::Settings; use settings::Settings;

View File

@ -13,9 +13,8 @@ use gpui::{
geometry::rect::RectF, geometry::rect::RectF,
platform::{WindowBounds, WindowOptions}, platform::{WindowBounds, WindowOptions},
}; };
use language::{FakeLspAdapter, LanguageConfig, LanguageRegistry}; use language::{FakeLspAdapter, LanguageConfig, LanguageRegistry, Point};
use project::FakeFs; use project::FakeFs;
use rope::point::Point;
use settings::EditorSettings; use settings::EditorSettings;
use util::{ use util::{
assert_set_eq, assert_set_eq,

View File

@ -35,9 +35,8 @@ use gpui::{
WeakViewHandle, WeakViewHandle,
}; };
use json::json; use json::json;
use language::{Bias, DiagnosticSeverity, Selection}; use language::{Bias, DiagnosticSeverity, OffsetUtf16, Selection};
use project::ProjectPath; use project::ProjectPath;
use rope::offset_utf16::OffsetUtf16;
use settings::{GitGutter, Settings}; use settings::{GitGutter, Settings};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{ use std::{

View File

@ -9,9 +9,8 @@ use gpui::{
elements::*, geometry::vector::vec2f, AppContext, Entity, ModelHandle, MutableAppContext, elements::*, geometry::vector::vec2f, AppContext, Entity, ModelHandle, MutableAppContext,
RenderContext, Subscription, Task, View, ViewContext, ViewHandle, RenderContext, Subscription, Task, View, ViewContext, ViewHandle,
}; };
use language::{Bias, Buffer, File as _, OffsetRangeExt, SelectionGoal}; use language::{Bias, Buffer, File as _, OffsetRangeExt, Point, SelectionGoal};
use project::{File, FormatTrigger, Project, ProjectEntryId, ProjectPath}; use project::{File, FormatTrigger, Project, ProjectEntryId, ProjectPath};
use rope::point::Point;
use rpc::proto::{self, update_view}; use rpc::proto::{self, update_view};
use settings::Settings; use settings::Settings;
use smallvec::SmallVec; use smallvec::SmallVec;

View File

@ -1,7 +1,6 @@
use rope::point::Point;
use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint}; use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint};
use crate::{char_kind, CharKind, ToPoint}; use crate::{char_kind, CharKind, ToPoint};
use language::Point;
use std::ops::Range; use std::ops::Range;
pub fn left(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint { pub fn left(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint {
@ -337,7 +336,6 @@ pub fn surrounding_word(map: &DisplaySnapshot, position: DisplayPoint) -> Range<
mod tests { mod tests {
use super::*; use super::*;
use crate::{test::marked_display_snapshot, Buffer, DisplayMap, ExcerptRange, MultiBuffer}; use crate::{test::marked_display_snapshot, Buffer, DisplayMap, ExcerptRange, MultiBuffer};
use rope::point::Point;
use settings::Settings; use settings::Settings;
#[gpui::test] #[gpui::test]

View File

@ -9,10 +9,10 @@ use gpui::{AppContext, Entity, ModelContext, ModelHandle, Task};
pub use language::Completion; pub use language::Completion;
use language::{ use language::{
char_kind, AutoindentMode, Buffer, BufferChunks, BufferSnapshot, CharKind, Chunk, char_kind, AutoindentMode, Buffer, BufferChunks, BufferSnapshot, CharKind, Chunk,
DiagnosticEntry, Event, File, IndentSize, Language, OffsetRangeExt, Outline, OutlineItem, DiagnosticEntry, Event, File, IndentSize, Language, OffsetRangeExt, OffsetUtf16, Outline,
Selection, ToOffset as _, ToOffsetUtf16 as _, ToPoint as _, ToPointUtf16 as _, TransactionId, OutlineItem, Point, PointUtf16, Selection, TextDimension, ToOffset as _, ToOffsetUtf16 as _,
ToPoint as _, ToPointUtf16 as _, TransactionId,
}; };
use rope::{offset_utf16::OffsetUtf16, point::Point, point_utf16::PointUtf16, TextDimension};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{ use std::{
borrow::Cow, borrow::Cow,
@ -168,7 +168,7 @@ struct ExcerptChunks<'a> {
} }
struct ExcerptBytes<'a> { struct ExcerptBytes<'a> {
content_bytes: rope::Bytes<'a>, content_bytes: text::Bytes<'a>,
footer_height: usize, footer_height: usize,
} }

View File

@ -1,5 +1,5 @@
use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToOffsetUtf16, ToPoint}; use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToOffsetUtf16, ToPoint};
use rope::{offset_utf16::OffsetUtf16, point::Point, TextDimension}; use language::{OffsetUtf16, Point, TextDimension};
use std::{ use std::{
cmp::Ordering, cmp::Ordering,
ops::{Range, Sub}, ops::{Range, Sub},

View File

@ -8,8 +8,7 @@ use std::{
use collections::HashMap; use collections::HashMap;
use gpui::{AppContext, ModelHandle, MutableAppContext}; use gpui::{AppContext, ModelHandle, MutableAppContext};
use itertools::Itertools; use itertools::Itertools;
use language::{Bias, Selection, SelectionGoal, ToPoint}; use language::{Bias, Point, Selection, SelectionGoal, TextDimension, ToPoint};
use rope::{point::Point, TextDimension};
use util::post_inc; use util::post_inc;
use crate::{ use crate::{

View File

@ -9,7 +9,6 @@ path = "src/git.rs"
[dependencies] [dependencies]
anyhow = "1.0.38" anyhow = "1.0.38"
clock = { path = "../clock" } clock = { path = "../clock" }
rope = { path = "../rope" }
lazy_static = "1.4.0" lazy_static = "1.4.0"
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
text = { path = "../text" } text = { path = "../text" }

View File

@ -1,8 +1,6 @@
use std::ops::Range; use std::ops::Range;
use rope::point::Point;
use sum_tree::SumTree; use sum_tree::SumTree;
use text::{Anchor, BufferSnapshot, OffsetRangeExt}; use text::{Anchor, BufferSnapshot, OffsetRangeExt, Point};
pub use git2 as libgit; pub use git2 as libgit;
use libgit::{DiffLineType as GitDiffLineType, DiffOptions as GitOptions, Patch as GitPatch}; use libgit::{DiffLineType as GitDiffLineType, DiffOptions as GitOptions, Patch as GitPatch};

View File

@ -13,6 +13,5 @@ gpui = { path = "../gpui" }
menu = { path = "../menu" } menu = { path = "../menu" }
settings = { path = "../settings" } settings = { path = "../settings" }
text = { path = "../text" } text = { path = "../text" }
rope = { path = "../rope" }
workspace = { path = "../workspace" } workspace = { path = "../workspace" }
postage = { version = "0.4", features = ["futures-traits"] } postage = { version = "0.4", features = ["futures-traits"] }

View File

@ -4,9 +4,8 @@ use gpui::{
MutableAppContext, RenderContext, View, ViewContext, ViewHandle, MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
}; };
use menu::{Cancel, Confirm}; use menu::{Cancel, Confirm};
use rope::point::Point;
use settings::Settings; use settings::Settings;
use text::Bias; use text::{Bias, Point};
use workspace::Workspace; use workspace::Workspace;
actions!(go_to_line, [Toggle]); actions!(go_to_line, [Toggle]);

View File

@ -29,7 +29,6 @@ fs = { path = "../fs" }
git = { path = "../git" } git = { path = "../git" }
gpui = { path = "../gpui" } gpui = { path = "../gpui" }
lsp = { path = "../lsp" } lsp = { path = "../lsp" }
rope = { path = "../rope" }
rpc = { path = "../rpc" } rpc = { path = "../rpc" }
settings = { path = "../settings" } settings = { path = "../settings" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }

View File

@ -17,7 +17,6 @@ use fs::LineEnding;
use futures::FutureExt as _; use futures::FutureExt as _;
use gpui::{fonts::HighlightStyle, AppContext, Entity, ModelContext, MutableAppContext, Task}; use gpui::{fonts::HighlightStyle, AppContext, Entity, ModelContext, MutableAppContext, Task};
use parking_lot::Mutex; use parking_lot::Mutex;
use rope::point::Point;
use settings::Settings; use settings::Settings;
use similar::{ChangeTag, TextDiff}; use similar::{ChangeTag, TextDiff};
use smol::future::yield_now; use smol::future::yield_now;
@ -283,7 +282,7 @@ struct BufferChunkHighlights<'a> {
pub struct BufferChunks<'a> { pub struct BufferChunks<'a> {
range: Range<usize>, range: Range<usize>,
chunks: rope::Chunks<'a>, chunks: text::Chunks<'a>,
diagnostic_endpoints: Peekable<vec::IntoIter<DiagnosticEndpoint>>, diagnostic_endpoints: Peekable<vec::IntoIter<DiagnosticEndpoint>>,
error_depth: usize, error_depth: usize,
warning_depth: usize, warning_depth: usize,

View File

@ -5,7 +5,6 @@ use fs::LineEnding;
use gpui::{ModelHandle, MutableAppContext}; use gpui::{ModelHandle, MutableAppContext};
use proto::deserialize_operation; use proto::deserialize_operation;
use rand::prelude::*; use rand::prelude::*;
use rope::point::Point;
use settings::Settings; use settings::Settings;
use std::{ use std::{
cell::RefCell, cell::RefCell,

View File

@ -1,13 +1,12 @@
use crate::Diagnostic; use crate::Diagnostic;
use collections::HashMap; use collections::HashMap;
use rope::point_utf16::PointUtf16;
use std::{ use std::{
cmp::{Ordering, Reverse}, cmp::{Ordering, Reverse},
iter, iter,
ops::Range, ops::Range,
}; };
use sum_tree::{self, Bias, SumTree}; use sum_tree::{self, Bias, SumTree};
use text::{Anchor, FromAnchor, ToOffset}; use text::{Anchor, FromAnchor, PointUtf16, ToOffset};
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]
pub struct DiagnosticSet { pub struct DiagnosticSet {

View File

@ -22,7 +22,6 @@ use lazy_static::lazy_static;
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use postage::watch; use postage::watch;
use regex::Regex; use regex::Regex;
use rope::point_utf16::PointUtf16;
use serde::{de, Deserialize, Deserializer}; use serde::{de, Deserialize, Deserializer};
use serde_json::Value; use serde_json::Value;
use std::{ use std::{

View File

@ -1,7 +1,6 @@
use crate::{Grammar, InjectionConfig, Language, LanguageRegistry}; use crate::{Grammar, InjectionConfig, Language, LanguageRegistry};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use parking_lot::Mutex; use parking_lot::Mutex;
use rope::point::Point;
use std::{ use std::{
borrow::Cow, borrow::Cow,
cell::RefCell, cell::RefCell,
@ -11,7 +10,7 @@ use std::{
sync::Arc, sync::Arc,
}; };
use sum_tree::{Bias, SeekTarget, SumTree}; use sum_tree::{Bias, SeekTarget, SumTree};
use text::{Anchor, BufferSnapshot, OffsetRangeExt, Rope, ToOffset, ToPoint}; use text::{Anchor, BufferSnapshot, OffsetRangeExt, Point, Rope, ToOffset, ToPoint};
use tree_sitter::{ use tree_sitter::{
Node, Parser, Query, QueryCapture, QueryCaptures, QueryCursor, QueryMatches, Tree, Node, Parser, Query, QueryCapture, QueryCaptures, QueryCursor, QueryMatches, Tree,
}; };
@ -135,7 +134,7 @@ struct ChangeRegionSet(Vec<ChangedRegion>);
struct TextProvider<'a>(&'a Rope); struct TextProvider<'a>(&'a Rope);
struct ByteChunks<'a>(rope::Chunks<'a>); struct ByteChunks<'a>(text::Chunks<'a>);
struct QueryCursorHandle(Option<QueryCursor>); struct QueryCursorHandle(Option<QueryCursor>);

View File

@ -29,7 +29,6 @@ git = { path = "../git" }
gpui = { path = "../gpui" } gpui = { path = "../gpui" }
language = { path = "../language" } language = { path = "../language" }
lsp = { path = "../lsp" } lsp = { path = "../lsp" }
rope = { path = "../rope" }
rpc = { path = "../rpc" } rpc = { path = "../rpc" }
settings = { path = "../settings" } settings = { path = "../settings" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }

View File

@ -8,11 +8,10 @@ use gpui::{AppContext, AsyncAppContext, ModelHandle};
use language::{ use language::{
point_from_lsp, point_to_lsp, point_from_lsp, point_to_lsp,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
range_from_lsp, Anchor, Bias, Buffer, CachedLspAdapter, ToPointUtf16, range_from_lsp, Anchor, Bias, Buffer, CachedLspAdapter, PointUtf16, ToPointUtf16,
}; };
use lsp::{DocumentHighlightKind, LanguageServer, ServerCapabilities}; use lsp::{DocumentHighlightKind, LanguageServer, ServerCapabilities};
use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag}; use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
use rope::point_utf16::PointUtf16;
use std::{cmp::Reverse, ops::Range, path::Path, sync::Arc}; use std::{cmp::Reverse, ops::Range, path::Path, sync::Arc};
#[async_trait(?Send)] #[async_trait(?Send)]

View File

@ -25,7 +25,7 @@ use language::{
range_from_lsp, range_to_lsp, Anchor, Bias, Buffer, CachedLspAdapter, CharKind, CodeAction, range_from_lsp, range_to_lsp, Anchor, Bias, Buffer, CachedLspAdapter, CharKind, CodeAction,
CodeLabel, Completion, Diagnostic, DiagnosticEntry, DiagnosticSet, Event as BufferEvent, CodeLabel, Completion, Diagnostic, DiagnosticEntry, DiagnosticSet, Event as BufferEvent,
File as _, Language, LanguageRegistry, LanguageServerName, LocalFile, OffsetRangeExt, File as _, Language, LanguageRegistry, LanguageServerName, LocalFile, OffsetRangeExt,
Operation, Patch, TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Operation, Patch, PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction,
}; };
use lsp::{ use lsp::{
DiagnosticSeverity, DiagnosticTag, DocumentHighlightKind, LanguageServer, LanguageString, DiagnosticSeverity, DiagnosticTag, DocumentHighlightKind, LanguageServer, LanguageString,
@ -35,7 +35,6 @@ use lsp_command::*;
use parking_lot::Mutex; use parking_lot::Mutex;
use postage::watch; use postage::watch;
use rand::prelude::*; use rand::prelude::*;
use rope::point_utf16::PointUtf16;
use search::SearchQuery; use search::SearchQuery;
use serde::Serialize; use serde::Serialize;
use settings::{FormatOnSave, Formatter, Settings}; use settings::{FormatOnSave, Formatter, Settings};

View File

@ -5,10 +5,9 @@ use futures::{future, StreamExt};
use gpui::{executor::Deterministic, test::subscribe}; use gpui::{executor::Deterministic, test::subscribe};
use language::{ use language::{
tree_sitter_rust, tree_sitter_typescript, Diagnostic, FakeLspAdapter, LanguageConfig, tree_sitter_rust, tree_sitter_typescript, Diagnostic, FakeLspAdapter, LanguageConfig,
OffsetRangeExt, ToPoint, OffsetRangeExt, Point, ToPoint,
}; };
use lsp::Url; use lsp::Url;
use rope::point::Point;
use serde_json::json; use serde_json::json;
use std::{cell::RefCell, os::unix, rc::Rc, task::Poll}; use std::{cell::RefCell, os::unix, rc::Rc, task::Poll};
use unindent::Unindent as _; use unindent::Unindent as _;

View File

@ -22,14 +22,13 @@ use gpui::{
}; };
use language::{ use language::{
proto::{deserialize_version, serialize_line_ending, serialize_version}, proto::{deserialize_version, serialize_line_ending, serialize_version},
Buffer, DiagnosticEntry, Rope, Buffer, DiagnosticEntry, PointUtf16, Rope,
}; };
use parking_lot::Mutex; use parking_lot::Mutex;
use postage::{ use postage::{
prelude::{Sink as _, Stream as _}, prelude::{Sink as _, Stream as _},
watch, watch,
}; };
use rope::point_utf16::PointUtf16;
use smol::channel::{self, Sender}; use smol::channel::{self, Sender};
use std::{ use std::{

View File

@ -1,16 +1,17 @@
pub mod offset_utf16; mod offset_utf16;
pub mod point; mod point;
pub mod point_utf16; mod point_utf16;
use arrayvec::ArrayString; use arrayvec::ArrayString;
use bromberg_sl2::{DigestString, HashMatrix}; use bromberg_sl2::{DigestString, HashMatrix};
use offset_utf16::OffsetUtf16;
use point::Point;
use point_utf16::PointUtf16;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{cmp, fmt, io, mem, ops::Range, str}; use std::{cmp, fmt, io, mem, ops::Range, str};
use sum_tree::{Bias, Dimension, SumTree}; use sum_tree::{Bias, Dimension, SumTree};
pub use offset_utf16::OffsetUtf16;
pub use point::Point;
pub use point_utf16::PointUtf16;
#[cfg(test)] #[cfg(test)]
const CHUNK_BASE: usize = 6; const CHUNK_BASE: usize = 6;

View File

@ -19,7 +19,6 @@ anyhow = "1.0.38"
futures = "0.3" futures = "0.3"
theme = { path = "../theme" } theme = { path = "../theme" }
util = { path = "../util" } util = { path = "../util" }
rope = { path = "../rope" }
json_comments = "0.2" json_comments = "0.2"
postage = { version = "0.4.1", features = ["futures-traits"] } postage = { version = "0.4.1", features = ["futures-traits"] }
schemars = "0.8" schemars = "0.8"

View File

@ -1,10 +1,8 @@
use crate::{BufferSnapshot, Point, PointUtf16, TextDimension, ToOffset, ToPoint, ToPointUtf16};
use anyhow::Result; use anyhow::Result;
use rope::{point::Point, point_utf16::PointUtf16, TextDimension};
use std::{cmp::Ordering, fmt::Debug, ops::Range}; use std::{cmp::Ordering, fmt::Debug, ops::Range};
use sum_tree::Bias; use sum_tree::Bias;
use crate::{BufferSnapshot, ToOffset, ToPoint, ToPointUtf16};
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, Default)] #[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, Default)]
pub struct Anchor { pub struct Anchor {
pub timestamp: clock::Local, pub timestamp: clock::Local,

View File

@ -1,7 +1,4 @@
use rope::TextDimension; use crate::{Anchor, BufferSnapshot, TextDimension};
use crate::{Anchor, BufferSnapshot};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::ops::Range; use std::ops::Range;

View File

@ -19,9 +19,10 @@ use locator::Locator;
use operation_queue::OperationQueue; use operation_queue::OperationQueue;
pub use patch::Patch; pub use patch::Patch;
use postage::{barrier, oneshot, prelude::*}; use postage::{barrier, oneshot, prelude::*};
use rope::{offset_utf16::OffsetUtf16, point::Point, point_utf16::PointUtf16, TextDimension};
pub use rope::{Chunks, Rope, TextSummary}; pub use rope::*;
pub use selection::*; pub use selection::*;
use std::{ use std::{
cmp::{self, Ordering, Reverse}, cmp::{self, Ordering, Reverse},
future::Future, future::Future,

View File

@ -27,7 +27,6 @@ command_palette = { path = "../command_palette" }
editor = { path = "../editor" } editor = { path = "../editor" }
gpui = { path = "../gpui" } gpui = { path = "../gpui" }
language = { path = "../language" } language = { path = "../language" }
rope = { path = "../rope" }
search = { path = "../search" } search = { path = "../search" }
settings = { path = "../settings" } settings = { path = "../settings" }
workspace = { path = "../workspace" } workspace = { path = "../workspace" }

View File

@ -15,8 +15,7 @@ use editor::{
display_map::ToDisplayPoint, Anchor, Autoscroll, Bias, ClipboardSelection, DisplayPoint, display_map::ToDisplayPoint, Anchor, Autoscroll, Bias, ClipboardSelection, DisplayPoint,
}; };
use gpui::{actions, MutableAppContext, ViewContext}; use gpui::{actions, MutableAppContext, ViewContext};
use language::{AutoindentMode, SelectionGoal}; use language::{AutoindentMode, Point, SelectionGoal};
use rope::point::Point;
use workspace::Workspace; use workspace::Workspace;
use self::{ use self::{

View File

@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut};
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use gpui::ContextHandle; use gpui::ContextHandle;
use language::OffsetRangeExt; use language::{OffsetRangeExt, Point};
use util::test::marked_text_offsets; use util::test::marked_text_offsets;
use super::{neovim_connection::NeovimConnection, NeovimBackedBindingTestContext, VimTestContext}; use super::{neovim_connection::NeovimConnection, NeovimBackedBindingTestContext, VimTestContext};
@ -51,7 +51,7 @@ impl<'a> NeovimBackedTestContext<'a> {
pub async fn set_shared_state(&mut self, marked_text: &str) -> ContextHandle { pub async fn set_shared_state(&mut self, marked_text: &str) -> ContextHandle {
let context_handle = self.set_state(marked_text, Mode::Normal); let context_handle = self.set_state(marked_text, Mode::Normal);
let selection = self.editor(|editor, cx| editor.selections.newest::<rope::point::Point>(cx)); let selection = self.editor(|editor, cx| editor.selections.newest::<Point>(cx));
let text = self.buffer_text(); let text = self.buffer_text();
self.neovim.set_state(selection, &text).await; self.neovim.set_state(selection, &text).await;

View File

@ -9,8 +9,7 @@ use async_trait::async_trait;
#[cfg(feature = "neovim")] #[cfg(feature = "neovim")]
use gpui::keymap::Keystroke; use gpui::keymap::Keystroke;
use language::Selection; use language::{Point, Selection};
use rope::point::Point;
#[cfg(feature = "neovim")] #[cfg(feature = "neovim")]
use lazy_static::lazy_static; use lazy_static::lazy_static;