Re-export basic text types from text and language crates

Max Brunsfeld created

Also avoid production dependencies on fs and rope in collab

Change summary

Cargo.lock                                        |  9 ---------
crates/collab/Cargo.toml                          |  6 ++----
crates/collab/src/integration_tests.rs            |  3 +--
crates/diagnostics/Cargo.toml                     |  1 -
crates/diagnostics/src/diagnostics.rs             |  7 +++----
crates/editor/Cargo.toml                          |  1 -
crates/editor/src/display_map.rs                  |  3 +--
crates/editor/src/display_map/block_map.rs        |  3 +--
crates/editor/src/display_map/fold_map.rs         |  3 +--
crates/editor/src/display_map/tab_map.rs          |  8 +++-----
crates/editor/src/display_map/wrap_map.rs         |  3 +--
crates/editor/src/editor.rs                       |  5 ++---
crates/editor/src/editor_tests.rs                 |  3 +--
crates/editor/src/element.rs                      |  3 +--
crates/editor/src/items.rs                        |  3 +--
crates/editor/src/movement.rs                     |  4 +---
crates/editor/src/multi_buffer.rs                 |  8 ++++----
crates/editor/src/multi_buffer/anchor.rs          |  2 +-
crates/editor/src/selections_collection.rs        |  3 +--
crates/git/Cargo.toml                             |  1 -
crates/git/src/diff.rs                            |  4 +---
crates/go_to_line/Cargo.toml                      |  1 -
crates/go_to_line/src/go_to_line.rs               |  3 +--
crates/language/Cargo.toml                        |  1 -
crates/language/src/buffer.rs                     |  3 +--
crates/language/src/buffer_tests.rs               |  1 -
crates/language/src/diagnostic_set.rs             |  3 +--
crates/language/src/language.rs                   |  1 -
crates/language/src/syntax_map.rs                 |  5 ++---
crates/project/Cargo.toml                         |  1 -
crates/project/src/lsp_command.rs                 |  3 +--
crates/project/src/project.rs                     |  3 +--
crates/project/src/project_tests.rs               |  3 +--
crates/project/src/worktree.rs                    |  3 +--
crates/rope/src/rope.rs                           | 13 +++++++------
crates/settings/Cargo.toml                        |  1 -
crates/text/src/anchor.rs                         |  4 +---
crates/text/src/selection.rs                      |  5 +----
crates/text/src/text.rs                           |  5 +++--
crates/vim/Cargo.toml                             |  1 -
crates/vim/src/normal.rs                          |  3 +--
crates/vim/src/test/neovim_backed_test_context.rs |  4 ++--
crates/vim/src/test/neovim_connection.rs          |  3 +--
43 files changed, 51 insertions(+), 102 deletions(-)

Detailed changes

Cargo.lock 🔗

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

crates/collab/Cargo.toml 🔗

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

crates/collab/src/integration_tests.rs 🔗

@@ -25,7 +25,7 @@ use gpui::{
 };
 use 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 parking_lot::Mutex;
@@ -34,7 +34,6 @@ use project::{
     ProjectStore, WorktreeId,
 };
 use rand::prelude::*;
-use rope::point::Point;
 use rpc::PeerId;
 use serde_json::json;
 use settings::{Formatter, Settings};

crates/diagnostics/Cargo.toml 🔗

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

crates/diagnostics/src/diagnostics.rs 🔗

@@ -14,10 +14,10 @@ use gpui::{
     ViewHandle, WeakViewHandle,
 };
 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 rope::point::Point;
 use serde_json::json;
 use settings::Settings;
 use smallvec::SmallVec;
@@ -738,8 +738,7 @@ mod tests {
         DisplayPoint,
     };
     use gpui::TestAppContext;
-    use language::{Diagnostic, DiagnosticEntry, DiagnosticSeverity};
-    use rope::point_utf16::PointUtf16;
+    use language::{Diagnostic, DiagnosticEntry, DiagnosticSeverity, PointUtf16};
     use serde_json::json;
     use unindent::Unindent as _;
     use workspace::AppState;

crates/editor/Cargo.toml 🔗

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

crates/editor/src/display_map.rs 🔗

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

crates/editor/src/display_map/block_map.rs 🔗

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

crates/editor/src/display_map/fold_map.rs 🔗

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

crates/editor/src/display_map/tab_map.rs 🔗

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

crates/editor/src/display_map/wrap_map.rs 🔗

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

crates/editor/src/editor.rs 🔗

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

crates/editor/src/editor_tests.rs 🔗

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

crates/editor/src/element.rs 🔗

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

crates/editor/src/items.rs 🔗

@@ -9,9 +9,8 @@ use gpui::{
     elements::*, geometry::vector::vec2f, AppContext, Entity, ModelHandle, MutableAppContext,
     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 rope::point::Point;
 use rpc::proto::{self, update_view};
 use settings::Settings;
 use smallvec::SmallVec;

crates/editor/src/movement.rs 🔗

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

crates/editor/src/multi_buffer.rs 🔗

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

crates/editor/src/multi_buffer/anchor.rs 🔗

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

crates/editor/src/selections_collection.rs 🔗

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

crates/git/Cargo.toml 🔗

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

crates/git/src/diff.rs 🔗

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

crates/go_to_line/Cargo.toml 🔗

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

crates/go_to_line/src/go_to_line.rs 🔗

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

crates/language/Cargo.toml 🔗

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

crates/language/src/buffer.rs 🔗

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

crates/language/src/buffer_tests.rs 🔗

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

crates/language/src/diagnostic_set.rs 🔗

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

crates/language/src/language.rs 🔗

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

crates/language/src/syntax_map.rs 🔗

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

crates/project/Cargo.toml 🔗

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

crates/project/src/lsp_command.rs 🔗

@@ -8,11 +8,10 @@ use gpui::{AppContext, AsyncAppContext, ModelHandle};
 use language::{
     point_from_lsp, point_to_lsp,
     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 pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
-use rope::point_utf16::PointUtf16;
 use std::{cmp::Reverse, ops::Range, path::Path, sync::Arc};
 
 #[async_trait(?Send)]

crates/project/src/project.rs 🔗

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

crates/project/src/project_tests.rs 🔗

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

crates/project/src/worktree.rs 🔗

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

crates/rope/src/rope.rs 🔗

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

crates/settings/Cargo.toml 🔗

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

crates/text/src/anchor.rs 🔗

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

crates/text/src/selection.rs 🔗

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

crates/text/src/text.rs 🔗

@@ -19,9 +19,10 @@ use locator::Locator;
 use operation_queue::OperationQueue;
 pub use patch::Patch;
 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::*;
+
 use std::{
     cmp::{self, Ordering, Reverse},
     future::Future,

crates/vim/Cargo.toml 🔗

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

crates/vim/src/normal.rs 🔗

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

crates/vim/src/test/neovim_backed_test_context.rs 🔗

@@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut};
 
 use collections::{HashMap, HashSet};
 use gpui::ContextHandle;
-use language::OffsetRangeExt;
+use language::{OffsetRangeExt, Point};
 use util::test::marked_text_offsets;
 
 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 {
         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();
         self.neovim.set_state(selection, &text).await;
 

crates/vim/src/test/neovim_connection.rs 🔗

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