diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 425ef145c24e..9c873c097b1f 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -25,7 +25,7 @@ use vfs::AbsPathBuf; use crate::{ caps::completion_item_edit_resolve, diagnostics::DiagnosticsMapConfig, - line_endings::OffsetEncoding, lsp_ext::supports_utf8, + line_index::OffsetEncoding, lsp_ext::supports_utf8, }; config_data! { diff --git a/crates/rust-analyzer/src/from_proto.rs b/crates/rust-analyzer/src/from_proto.rs index 4f3ae8cc3a93..5b02b2598d39 100644 --- a/crates/rust-analyzer/src/from_proto.rs +++ b/crates/rust-analyzer/src/from_proto.rs @@ -9,7 +9,7 @@ use vfs::AbsPathBuf; use crate::{ from_json, global_state::GlobalStateSnapshot, - line_endings::{LineIndex, OffsetEncoding}, + line_index::{LineIndex, OffsetEncoding}, lsp_ext, Result, }; diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 85c87645c0c1..52c2497137f5 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -22,7 +22,7 @@ use crate::{ diagnostics::{CheckFixes, DiagnosticCollection}, document::DocumentData, from_proto, - line_endings::{LineEndings, LineIndex}, + line_index::{LineEndings, LineIndex}, main_loop::Task, op_queue::OpQueue, reload::SourceRootConfig, diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index d8b00e9c5824..4f6f250d6c6a 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -36,8 +36,7 @@ use crate::{ diff::diff, from_proto, global_state::{GlobalState, GlobalStateSnapshot}, - line_endings::LineEndings, - line_endings::LineIndex, + line_index::{LineEndings, LineIndex}, lsp_ext::{self, InlayHint, InlayHintsParams}, lsp_utils::all_edits_are_disjoint, to_proto, LspError, Result, diff --git a/crates/rust-analyzer/src/lib.rs b/crates/rust-analyzer/src/lib.rs index 2207b9a87544..8b874239c778 100644 --- a/crates/rust-analyzer/src/lib.rs +++ b/crates/rust-analyzer/src/lib.rs @@ -29,7 +29,7 @@ mod from_proto; mod semantic_tokens; mod markdown; mod diagnostics; -mod line_endings; +mod line_index; mod request_metrics; mod lsp_utils; mod thread_pool; diff --git a/crates/rust-analyzer/src/line_endings.rs b/crates/rust-analyzer/src/line_index.rs similarity index 94% rename from crates/rust-analyzer/src/line_endings.rs rename to crates/rust-analyzer/src/line_index.rs index dd8901152882..c116414da01d 100644 --- a/crates/rust-analyzer/src/line_endings.rs +++ b/crates/rust-analyzer/src/line_index.rs @@ -1,3 +1,6 @@ +//! Enhances `ide::LineIndex` with additional info required to convert offsets +//! into lsp positions. +//! //! We maintain invariant that all internal strings use `\n` as line separator. //! This module does line ending conversion and detection (so that we can //! convert back to `\r\n` on the way out). diff --git a/crates/rust-analyzer/src/lsp_utils.rs b/crates/rust-analyzer/src/lsp_utils.rs index 6b8e347b9f7f..84f78b5b842c 100644 --- a/crates/rust-analyzer/src/lsp_utils.rs +++ b/crates/rust-analyzer/src/lsp_utils.rs @@ -7,7 +7,7 @@ use lsp_server::Notification; use crate::{ from_proto, global_state::GlobalState, - line_endings::{LineEndings, LineIndex, OffsetEncoding}, + line_index::{LineEndings, LineIndex, OffsetEncoding}, }; pub(crate) fn is_canceled(e: &(dyn Error + 'static)) -> bool { diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index 368d916e71a7..6aff65575dcd 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -17,7 +17,7 @@ use serde_json::to_value; use crate::{ cargo_target_spec::CargoTargetSpec, global_state::GlobalStateSnapshot, - line_endings::{LineEndings, LineIndex, OffsetEncoding}, + line_index::{LineEndings, LineIndex, OffsetEncoding}, lsp_ext, semantic_tokens, Result, };