Skip to content

Commit b74d954

Browse files
feigeCodeclaude
andcommitted
input: collection-owned tracked range decorations
Range decorations become an independently owned collection instead of a global annotation list, and gutter markers and inline widgets are split out of this change. - Add `RangeDecorationCollection` with `set` / `append` / `clear` / `dispose` / `get_ranges`. Each collection owns only its own entries, so separate extensions cannot overwrite one another, and dropping a handle does not clear it. Public decoration IDs are gone; the handle owns lifetime. - Share UTF-8 normalization and edit tracking between text and geometric decorations through a `TrackedDecoration` abstraction. - Clip and project ranges through the shaped lines, so soft wraps, continuation indents, CRLF and folds no longer make a partly visible range disappear. - Add an interval index queried once per visible, non-folded buffer span; edits update affected entries linearly without re-sorting. - Remove gutter markers, gutter lane reservation, inline widgets, the `InputEvent::GutterMarkerMouseDown` variant and the `Editor` gutter renderer projection, plus their story/shell exhaustive-match arms. - Update the English and Chinese docs and the Editor story. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 32030ed commit b74d954

11 files changed

Lines changed: 1099 additions & 183 deletions

File tree

‎crates/base/src/input/base/element.rs‎

Lines changed: 466 additions & 124 deletions
Large diffs are not rendered by default.

‎crates/base/src/input/base/kind.rs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ use ropey::Rope;
2929
use super::decorations::DecorationCollections;
3030
use super::lsp::{ContextMenuContent, HoverDefinition, InlineCompletion};
3131
use crate::input::{
32-
HighlightStyleResolver, InputEdit, InputHighlighter, SyntaxContext, TextDecoration,
32+
HighlightStyleResolver, InputEdit, InputHighlighter, RangeDecoration, SyntaxContext,
33+
TextDecoration,
3334
};
3435
use crate::input::{HoverPopoverState, Lsp};
3536
use gpui::Task;
@@ -82,6 +83,11 @@ pub trait InputExtras: Default + 'static {
8283
Vec::new()
8384
}
8485

86+
/// Geometric decorations intersecting visible, non-folded buffer spans.
87+
fn range_decorations(&self, _ranges: &[std::ops::Range<usize>]) -> Vec<&RangeDecoration> {
88+
Vec::new()
89+
}
90+
8591
/// Semantic-token styles for a visible range, when an LSP supplies them.
8692
fn semantic_token_styles(
8793
&self,
@@ -336,6 +342,7 @@ impl InputModeKind for TextareaMode {
336342
pub struct EditorExtras {
337343
pub(crate) lsp: Lsp,
338344
pub(crate) decorations: DecorationCollections,
345+
pub(crate) range_decorations: DecorationCollections<RangeDecoration>,
339346
pub(crate) inline_completion: InlineCompletion,
340347
pub(crate) context_menu_content: ContextMenuContent,
341348
pub(crate) hover_popover: Option<HoverPopoverState>,
@@ -348,6 +355,7 @@ impl Default for EditorExtras {
348355
Self {
349356
lsp: Lsp::default(),
350357
decorations: DecorationCollections::default(),
358+
range_decorations: DecorationCollections::default(),
351359
inline_completion: InlineCompletion::default(),
352360
context_menu_content: ContextMenuContent::default(),
353361
hover_popover: None,

0 commit comments

Comments
 (0)