Skip to content

Visual Studio Code, rebuilt in Rust

Rust

fix(folding): wait for the update delay in an editor another one edited

rokarturd29b22cc66ca
diff --git a/README.md b/README.md
index cba77bf345c..fccadad442c 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,8 @@ Coverage of VS Code 1.147.0, from [port/ledger.md](port/ledger.md) (584 rows). V
```mermaid
pie showData
- "verified" : 408
- "ported" : 22
+ "verified" : 409
+ "ported" : 21
"removed" : 126
"n/a" : 28
```
@@ -24,14 +24,14 @@ pie showData
| built-in extension | 88 | 1 | 6 | 0 | `████████████████████ 99%` |
| MainThread* shape (Rust side) | 59 | 0 | 30 | 0 | `████████████████████ 100%` |
| workbench service | 59 | 6 | 23 | 7 | `██████████████████░░ 91%` |
-| src/vs/editor/contrib | 52 | 2 | 2 | 1 | `███████████████████░ 96%` |
+| src/vs/editor/contrib | 53 | 1 | 2 | 1 | `████████████████████ 98%` |
| workbench part | 10 | 1 | 2 | 0 | `██████████████████░░ 91%` |
| extension host seam | 7 | 0 | 0 | 0 | `████████████████████ 100%` |
| cross-cutting check | 5 | 0 | 0 | 0 | `████████████████████ 100%` |
| src/vs/editor | 0 | 2 | 1 | 1 | `░░░░░░░░░░░░░░░░░░░░ 0%` |
| src/vs/base | 0 | 0 | 2 | 3 | `████████████████████ 100%` |
| port feature | 1 | 0 | 0 | 0 | `████████████████████ 100%` |
-| **all** | **408** | **22** | **126** | **28** | `███████████████████░ 95%` |
+| **all** | **409** | **21** | **126** | **28** | `███████████████████░ 95%` |
<!-- coverage:end -->
`removed` are parts left out by decision: AI features, Microsoft services, telemetry, remote and tunnels ([port/notes.md](port/notes.md)). `n/a` are upstream test infrastructure and the Electron process, IPC and DOM layers the native architecture replaces.
diff --git a/native/crates/app/src/diff_editor/unchanged_regions.rs b/native/crates/app/src/diff_editor/unchanged_regions.rs
index 31962c36994..d21c1874607 100644
--- a/native/crates/app/src/diff_editor/unchanged_regions.rs
+++ b/native/crates/app/src/diff_editor/unchanged_regions.rs
@@ -198,7 +198,7 @@ fn tracked_lines(range: LineRange, model: &TextModel, seen: u32) -> LineRange {
}
// The end column stands for `Number.MAX_SAFE_INTEGER` clamped to the line's end: past every edit on that line.
let (mut start, mut end) = (Position::new(range.start - 1, 0), Position::new(range.end - 2, u32::MAX as usize));
- for &(_, edit_start, edit_end, new_end) in model.edits.iter().filter(|(version, ..)| *version >= seen) {
+ for &(_, edit_start, edit_end, new_end, _) in model.edits.iter().filter(|(version, ..)| *version >= seen) {
start = tracked(start, edit_start, edit_end, new_end, true);
end = tracked(end, edit_start, edit_end, new_end, false);
}
diff --git a/native/crates/app/src/editor.rs b/native/crates/app/src/editor.rs
index a3120e24a1f..74d0fff6fa7 100644
--- a/native/crates/app/src/editor.rs
+++ b/native/crates/app/src/editor.rs
@@ -718,8 +718,9 @@ pub struct TextModel {
pub markers: Vec<marker_decorations::MarkerDecoration>,
/// More markers than `MAX_MARKER_DECORATIONS` (`_isMarkerLimitExceeded`): only that many are decorated.
pub markers_truncated: bool,
- /// Each replace as (version it applied to, start, end, new end), for the model's other editors to follow.
- pub(crate) edits: Vec<(u32, Position, Position, Position)>,
+ /// Each replace as (version it applied to, start, end, new end, start line's length before it), for the model's
+ /// other editors to follow.
+ pub(crate) edits: Vec<(u32, Position, Position, Position, usize)>,
/// The placeholder model of a custom document's webview editor: whether the document is dirty.
pub custom_document_dirty: bool,
pub semantic_tokens: crate::semantic_tokens::ModelSemanticTokens,
@@ -767,6 +768,9 @@ pub struct OpenEditor {
pub syntax_folding: bool,
/// folding.ts `_currentModelHasFoldedImports`: `editor.foldingImportsByDefault` already collapsed the imports.
pub folded_imports: bool,
+ /// folding.ts `onDidChangeModelContent` from another editor of the model: the regions moved with its edits and
+ /// are computed again when the update Delayer runs (`EditorsState::refresh_stale_folding`).
+ pub folding_stale: bool,
/// `editor.foldingMaximumRegions` of the indentation provider, and the limit its last regions were cut to.
pub folding_limit: usize,
pub folding_limited: Option<usize>,
@@ -821,7 +825,7 @@ impl OpenEditor {
let model = model.borrow();
(model.version_id, word_wrap::WordWrap::new(&model.document.lines, model.document.too_large_for_tokenization))
};
- let mut editor = OpenEditor { seen_version, model, preview, sticky: false, model_id, selections: vec![Selection::default()], cursor_changed: false, last_added: 0, leftovers: Vec::new(), past_injections: None, column_select: None, selection_start: None, smart_select: None, cursor_states: Default::default(), highlights: Vec::new(), value_set_replacement: None, selection_anchor: None, folding: FoldingModel::default(), syntax_folding: false, folded_imports: false, sticky_model: Default::default(), folding_limit: folding::MAX_FOLDING_REGIONS_FOR_INDENT, folding_limited: None, sticky_outline: None, scroll: Scroll::default(), max_line_width: 0., view_zones: Vec::new(), snippet_session: None, word_wrap, text_decorations: Vec::new(), injected_text: Vec::new(), cursor_style_override: None, line_numbers_override: None, peek_preview: None };
+ let mut editor = OpenEditor { seen_version, model, preview, sticky: false, model_id, selections: vec![Selection::default()], cursor_changed: false, last_added: 0, leftovers: Vec::new(), past_injections: None, column_select: None, selection_start: None, smart_select: None, cursor_states: Default::default(), highlights: Vec::new(), value_set_replacement: None, selection_anchor: None, folding: FoldingModel::default(), syntax_folding: false, folded_imports: false, folding_stale: false, sticky_model: Default::default(), folding_limit: folding::MAX_FOLDING_REGIONS_FOR_INDENT, folding_limited: None, sticky_outline: None, scroll: Scroll::default(), max_line_width: 0., view_zones: Vec::new(), snippet_session: None, word_wrap, text_decorations: Vec::new(), injected_text: Vec::new(), cursor_style_override: None, line_numbers_override: None, peek_preview: None };
editor.refresh_highlights();
editor.refresh_folding_ranges();
editor
@@ -1534,14 +1538,32 @@ impl EditorGroup {
}
}
- /// Every editor's cursors follow the edits other editors of its model made (render calls it each frame).
- pub fn sync_editors(&mut self) {
+ /// Every editor's cursors follow the edits other editors of its model made (render calls it each frame). Returns
+ /// the model of an editor whose folding regions now wait for the update Delayer.
+ pub fn sync_editors(&mut self) -> Option<(u32, SharedModel)> {
+ let mut stale = None;
+ for editor in self.synced_editors_mut() {
+ let seen = editor.seen_version;
+ editor.sync_with_model();
+ if editor.folding_stale && editor.seen_version != seen {
+ stale = Some((editor.model_id, editor.model.clone()));
+ }
+ }
+ stale
+ }
+
+ /// The update Delayer of the editors `sync_editors` left stale: their indentation regions are computed again.
+ pub fn refresh_stale_folding(&mut self) {
+ for editor in self.synced_editors_mut().filter(|editor| editor.folding_stale) {
+ editor.refresh_folding_ranges();
+ }
+ }
+
+ fn synced_editors_mut(&mut self) -> impl Iterator<Item = &mut OpenEditor> {
let others = self.other_groups.iter_mut().flat_map(|group| &mut group.editors);
let diff_editors = self.diffs.values_mut().flat_map(|diff| [diff.original_editor.as_mut(), diff.modified_editor.as_mut()]).flatten();
let file_editors = self.multi_diffs.values_mut().flat_map(MultiDiffInput::editors_mut);
- for editor in self.editors.iter_mut().chain(others).chain(diff_editors).chain(file_editors) {
- editor.sync_with_model();
- }
+ self.editors.iter_mut().chain(others).chain(diff_editors).chain(file_editors)
}
/// Shows the model at `index` of `models` in a new editor.
diff --git a/native/crates/app/src/editor/edit.rs b/native/crates/app/src/editor/edit.rs
index 2a30164cdb8..47066ff2304 100644
--- a/native/crates/app/src/editor/edit.rs
+++ b/native/crates/app/src/editor/edit.rs
@@ -1106,8 +1106,8 @@ impl OpenEditor {
}
/// Another editor of the shared model changed it: the cursors move with its edits as tracked ranges do
- /// (`_onModelContentChanged`), or clamp to the text when the log no longer reaches back, and the
- /// folding ranges are computed again.
+ /// (`_onModelContentChanged`), or clamp to the text when the log no longer reaches back. The folding regions
+ /// move with the edits and wait for the update Delayer (`folding_stale`); without the log they are computed again.
pub fn sync_with_model(&mut self) {
let model = self.model.borrow();
if self.seen_version == model.version_id {
@@ -1117,7 +1117,8 @@ impl OpenEditor {
let version = model.version_id;
let logged = model.edits.first().is_some_and(|(version, ..)| *version <= seen);
let mut selections = self.selections.clone();
- for &(_, start, end, new_end) in model.edits.iter().filter(|(version, ..)| logged && *version >= seen) {
+ for &(_, start, end, new_end, start_line_len) in model.edits.iter().filter(|(version, ..)| logged && *version >= seen) {
+ self.folding.accept_edit(start, end, new_end, start_line_len);
for selection in &mut selections {
selection.anchor = folding::tracked(selection.anchor, start, end, new_end, false);
selection.head = folding::tracked(selection.head, start, end, new_end, false);
@@ -1146,7 +1147,11 @@ impl OpenEditor {
cursor::normalize(&mut self.selections, &mut self.last_added);
self.leftovers.clear();
self.highlights.clear();
- self.refresh_folding_ranges();
+ if !logged {
+ return self.refresh_folding_ranges();
+ }
+ self.folding_stale = true;
+ self.adjust_selections_to_folds();
}
/// Word highlights stop while the text changes: wordHighlighter.ts ignores non-explicit cursor changes.
@@ -1173,7 +1178,8 @@ impl OpenEditor {
fn replace(&mut self, start: Position, end: Position, text: &str) -> ContentChange {
let mut model = self.model.borrow_mut();
let version = model.version_id;
- model.edits.push((version, start, end, end_of(start, text)));
+ let start_line_len = model.document.lines[start.line].chars().count();
+ model.edits.push((version, start, end, end_of(start, text), start_line_len));
if model.edits.len() > MAX_LOGGED_EDITS {
model.edits.remove(0);
}
@@ -1189,7 +1195,7 @@ impl OpenEditor {
range_length: removed.replace('\n', eol).encode_utf16().count(),
text: text.replace('\n', eol),
};
- self.folding.accept_replace(lines, start, end, text);
+ self.folding.accept_edit(start, end, end_of(start, text), start_line_len);
if let Some(anchor) = self.selection_anchor {
self.selection_anchor = Some(anchor_select::anchor_after_edit(anchor, lines, start, end, text));
}
diff --git a/native/crates/app/src/editor/folding.rs b/native/crates/app/src/editor/folding.rs
index 5da4bfde1b6..7740dbe9fce 100644
--- a/native/crates/app/src/editor/folding.rs
+++ b/native/crates/app/src/editor/folding.rs
@@ -5,7 +5,6 @@
use std::ops::Range;
use super::cursor::{Position, Selection};
-use super::edit::end_of;
use super::indent_level;
pub const MAX_FOLDING_REGIONS: usize = 0xFFFF;
@@ -751,13 +750,14 @@ impl FoldingModel {
changed
}
- /// Moves each region's lines with an edit of `start..end` into `text` in `lines` (the lines before it), as
- /// the decoration the region keeps does: collapsed and manual ones grow when typing at their edges.
- pub fn accept_replace(&mut self, lines: &[String], start: Position, end: Position, text: &str) {
+ /// Moves each region's lines with an edit of `start..end` into text ending at `new_end`, as the decoration the
+ /// region keeps does: collapsed and manual ones grow when typing at their edges. `start_line_len` is the length
+ /// of the start line before the edit, the one column that decides where a decoration at a line's end goes.
+ pub fn accept_edit(&mut self, start: Position, end: Position, new_end: Position, start_line_len: usize) {
if self.regions.len() == 0 {
return;
}
- let new_end = end_of(start, text);
+ let line_end = |line: usize| Position::new(line, if line == start.line { start_line_len } else if line == end.line { end.column } else { 0 });
let mut hidden_until = 0;
let mut ranges = self.regions.ranges.clone();
for range in ranges.iter_mut() {
@@ -767,10 +767,8 @@ impl FoldingModel {
}
// `AlwaysGrowsWhenTypingAtEdges` sticks the start to the char before, `NeverGrows...` the end.
let grows = !is_hidden && (range.collapsed || range.source != FoldSource::Provider);
- let decoration_start = Position::new(range.start - 1, lines[range.start - 1].chars().count());
- let decoration_end = Position::new(range.end - 1, lines[range.end - 1].chars().count());
- range.start = tracked(decoration_start, start, end, new_end, grows).line + 1;
- range.end = tracked(decoration_end, start, end, new_end, !grows).line + 1;
+ range.start = tracked(line_end(range.start - 1), start, end, new_end, grows).line + 1;
+ range.end = tracked(line_end(range.end - 1), start, end, new_end, !grows).line + 1;
}
self.regions = FoldingRegions::new(ranges);
// The view model's hidden areas are decorations too: they move with the edit as the regions do.
diff --git a/native/crates/app/src/editor/folding/tests.rs b/native/crates/app/src/editor/folding/tests.rs
index 92a3060b99c..daf57436a0c 100644
--- a/native/crates/app/src/editor/folding/tests.rs
+++ b/native/crates/app/src/editor/folding/tests.rs
@@ -2,6 +2,7 @@
//! indentRangeProvider and indentFold.
use super::*;
+use crate::editor::edit::end_of;
fn lines(text: &[&str]) -> Vec<String> {
text.iter().map(|line| line.to_string()).collect()
@@ -171,7 +172,7 @@ fn collapse() {
/// Applies an edit to `text` and moves the model's regions with it, as the text model's decorations do.
fn edit(model: &mut FoldingModel, text: &mut Vec<String>, start: Position, end: Position, inserted: &str) {
- model.accept_replace(text, start, end, inserted);
+ model.accept_edit(start, end, end_of(start, inserted), text[start.line].chars().count());
let mut joined = text.join("\n");
let offset = |position: Position| text[..position.line].iter().map(|line| line.len() + 1).sum::<usize>() + text[position.line].char_indices().nth(position.column).map_or(text[position.line].len(), |(index, _)| index);
joined.replace_range(offset(start)..offset(end), inserted);
diff --git a/native/crates/app/src/editor/folding_controller.rs b/native/crates/app/src/editor/folding_controller.rs
index 4b3b231925b..15ce58dfbcc 100644
--- a/native/crates/app/src/editor/folding_controller.rs
+++ b/native/crates/app/src/editor/folding_controller.rs
@@ -12,6 +12,7 @@ impl OpenEditor {
/// cursors leave the lines it hides. While extension providers fold the model their regions stay, moved by
/// the edits, until the workbench applies their next answer (`apply_syntax_folding`).
pub fn refresh_folding_ranges(&mut self) {
+ self.folding_stale = false;
// folding.ts `onModelChanged`: a model too large for tokenization gets no folding model.
if self.document().too_large_for_tokenization {
return;
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rs
index 81330f74cfc..27abecf81b0 100644
--- a/native/crates/app/src/workbench.rs
+++ b/native/crates/app/src/workbench.rs
@@ -623,7 +623,7 @@ impl Render for Workbench {
let window_border = self.theme.color("window.activeBorder");
// The reference lays the grid out at the full window size and shifts it inside the 1px window border.
let inset = if window_border.is_some() { 1. } else { 0. };
- self.editors.sync_editors();
+ self.sync_editors(cx);
self.auxiliary_windows.main_window = Some(window.window_handle());
self.close_auxiliary_windows_of_closed_parts(cx);
let editor = self.in_part(editor_groups::MAIN_PART, |workbench| workbench.editor_groups_part(window, cx));
diff --git a/native/crates/app/src/workbench/auxiliary_windows.rs b/native/crates/app/src/workbench/auxiliary_windows.rs
index 85361d2b3be..c4e8cd97bc1 100644
--- a/native/crates/app/src/workbench/auxiliary_windows.rs
+++ b/native/crates/app/src/workbench/auxiliary_windows.rs
@@ -441,7 +441,7 @@ impl Workbench {
let Some(state) = self.auxiliary_windows.windows.iter().find(|state| state.part == part) else { return div().into_any_element() };
state.bounds.set(window.bounds());
let Some(group) = self.part_active_group(part) else { return div().into_any_element() };
- self.editors.sync_editors();
+ self.sync_editors(cx);
let viewport = window.viewport_size();
let title = self.with_group(group, |workbench| workbench.window_title());
window.set_window_title(&title);
diff --git a/native/crates/app/src/workbench/folding_providers.rs b/native/crates/app/src/workbench/folding_providers.rs
index 4b5831be117..7788715cadf 100644
--- a/native/crates/app/src/workbench/folding_providers.rs
+++ b/native/crates/app/src/workbench/folding_providers.rs
@@ -26,6 +26,8 @@ pub(super) struct FoldingProviders {
generation: u64,
/// The model id and version of the active editor last triggered for.
seen: Option<(u32, u32)>,
+ /// Each update Delayer trigger of the editors whose model another editor edited: an older one does nothing.
+ stale_generation: u64,
/// folding.ts `updateDebounceInfo`: `for(foldingRangeProvider, 'Folding', { min: 200 })`, max `min ** 2`.
debounce: FeatureDebounce<200, 40_000>,
}
@@ -82,12 +84,32 @@ impl Workbench {
}
}
+ /// The editors follow the edits other editors of their model made; `triggerFoldingModelChanged` of those whose
+ /// regions moved: they are computed again after the model's update delay, a later edit restarting it.
+ pub(super) fn sync_editors(&mut self, cx: &mut Context<Self>) {
+ let Some((model_id, model)) = self.editors.sync_editors() else { return };
+ let key = self.folding_debounce_key(model_id, &model.borrow().document);
+ let delay = self.folding_providers.debounce.get(&key);
+ self.folding_providers.stale_generation += 1;
+ let generation = self.folding_providers.stale_generation;
+ cx.spawn(async move |workbench, cx| {
+ cx.background_executor().timer(delay).await;
+ let _ = workbench.update(cx, |workbench, cx| {
+ if generation == workbench.folding_providers.stale_generation {
+ workbench.editors.refresh_stale_folding();
+ workbench.folding_regions_changed(cx);
+ }
+ });
+ })
+ .detach();
+ }
+
/// `triggerFoldingModelChanged` of the active editor: its regions are computed again after the update delay, the
/// `updateScheduler` Delayer's `defaultDelay` learned from how long the updates took.
pub(crate) fn trigger_folding_model_changed(&mut self, cx: &mut Context<Self>) {
let Some(editor) = self.editors.active() else { return };
let model_id = editor.model_id;
- let key = self.folding_debounce_key(model_id);
+ let key = self.folding_debounce_key(model_id, &editor.document());
let delay = self.folding_providers.debounce.get(&key);
self.folding_providers.generation += 1;
let generation = self.folding_providers.generation;
@@ -151,14 +173,13 @@ impl Workbench {
/// `updateDebounceInfo.update` with the time from the update's start until its regions were applied.
fn folding_updated(&mut self, model_id: u32, elapsed: Duration) {
- let key = self.folding_debounce_key(model_id);
+ let editor = self.editors.active().expect("the active editor is the one folding");
+ let key = self.folding_debounce_key(model_id, &editor.document());
self.folding_providers.debounce.update(&key, elapsed);
}
/// `FeatureDebounceInformation._key`: the model with the folding range providers registered for it.
- fn folding_debounce_key(&self, model_id: u32) -> String {
- let editor = self.editors.active().expect("the active editor is the one folding");
- let document = editor.document();
+ fn folding_debounce_key(&self, model_id: u32, document: &crate::editor::TextDocument) -> String {
let handles = self.language_features.ordered("$registerFoldingRangeProvider", &Candidate { uri: &document.uri(), language: &document.language_id });
format!("{model_id}{:?}", handles.iter().map(|registration| registration.handle).collect::<Vec<_>>())
}
diff --git a/native/crates/app/src/workbench/folding_providers/tests.rs b/native/crates/app/src/workbench/folding_providers/tests.rs
index 0f9b196ef55..7cadd9fe23d 100644
--- a/native/crates/app/src/workbench/folding_providers/tests.rs
+++ b/native/crates/app/src/workbench/folding_providers/tests.rs
@@ -114,6 +114,39 @@ fn an_edit_folds_by_indentation_again_after_the_update_delay(cx: &mut TestAppCon
std::fs::remove_dir_all(dir).unwrap();
}
+/// folding.ts `onDidChangeModelContent` in the other editor of a split: its regions move with the edit and are computed
+/// again by its own update Delayer, not on the frame that shows the edit.
+#[gpui::test]
+fn the_other_editor_of_a_split_folds_again_after_its_update_delay(cx: &mut TestAppContext) {
+ let (workbench, cx, _receiver, dir) = workbench_with("split", cx);
+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.action.splitEditor", vec![], window, cx)));
+ cx.run_until_parked();
+ let left_regions = |workbench: &gpui::Entity<Workbench>, cx: &mut VisualTestContext| {
+ workbench.read_with(cx, |workbench, _| {
+ let left = workbench.groups_in_grid_order()[0];
+ workbench.editors.group_tabs(left).0[0].folding.regions.ranges().iter().map(|range| (range.start, range.end)).collect::<Vec<_>>()
+ })
+ };
+ assert_eq!(left_regions(&workbench, cx), [(4, 6)]);
+ workbench.update(cx, |workbench, cx| {
+ let editor = workbench.editors.active_mut().unwrap();
+ editor.move_to(crate::editor::Position::new(1, 0), false);
+ editor.type_text(" ").unwrap();
+ editor.move_to(crate::editor::Position::new(0, 0), false);
+ editor.type_text("\n").unwrap();
+ cx.notify();
+ });
+ cx.run_until_parked();
+ assert_eq!(left_regions(&workbench, cx), [(5, 7)], "the regions move with the edits, the new indentation waits");
+ cx.executor().advance_clock(Duration::from_millis(299));
+ cx.run_until_parked();
+ assert_eq!(left_regions(&workbench, cx), [(5, 7)], "not before the update delay");
+ cx.executor().advance_clock(Duration::from_millis(1));
+ cx.run_until_parked();
+ assert_eq!(left_regions(&workbench, cx), [(2, 3), (5, 7)]);
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
/// folding.ts `_executeFoldingRangeProvider`: a provider's ranges with their kind, the indentation ranges without one.
#[gpui::test]
fn execute_folding_range_provider_answers_the_ranges(cx: &mut TestAppContext) {
diff --git a/native/crates/app/src/workbench/inline_completions.rs b/native/crates/app/src/workbench/inline_completions.rs
index 353a7ee12de..d246360df1d 100644
--- a/native/crates/app/src/workbench/inline_completions.rs
+++ b/native/crates/app/src/workbench/inline_completions.rs
@@ -223,7 +223,7 @@ impl Workbench {
self.inline_completions.items.clear();
self.inline_completions.suggest_widget_items.clear();
}
- for &(_, start, end, new_end) in model.edits.iter().filter(|(version, ..)| *version >= seen) {
+ for &(_, start, end, new_end, _) in model.edits.iter().filter(|(version, ..)| *version >= seen) {
for item in self.inline_completions.items.iter_mut().chain(&mut self.inline_completions.suggest_widget_items) {
item.edit = rebased(&item.edit, start, end, new_end);
}
diff --git a/native/crates/app/src/workbench/suggest_controller.rs b/native/crates/app/src/workbench/suggest_controller.rs
index c0d34565957..9ec7305eb96 100644
--- a/native/crates/app/src/workbench/suggest_controller.rs
+++ b/native/crates/app/src/workbench/suggest_controller.rs
@@ -851,7 +851,7 @@ impl Workbench {
if model.edits.first().is_none_or(|(first, ..)| *first > version) {
return;
}
- let earliest = model.edits.iter().filter(|(edit_version, ..)| *edit_version >= version).map(|&(_, _, end, _)| end).min();
+ let earliest = model.edits.iter().filter(|(edit_version, ..)| *edit_version >= version).map(|&(_, _, end, ..)| end).min();
drop(model);
if earliest.is_some_and(|earliest| edits.iter().any(|(start, ..)| earliest < *start)) {
return;
diff --git a/port/ledger.md b/port/ledger.md
index 17707745808..a286f490772 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -306,7 +306,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| editor/contrib/editorState | src/vs/editor/contrib | M8 | verified | | `EditorStateCancellationTokenSource` (Value and Position) on explicit formatting with the editor (format.rs `edit_state`), rename's location resolve and input (rename.rs) and Go to Definition and the other symbol navigations (goto_symbol.rs `run_symbol_navigation`), `TextModelCancellationTokenSource` on formatting without the editor and code actions; keybindingCancellation.ts: `editor.cancelOperation` (Escape while `cancellableOperation`) cancels the active editor's latest pending one (workbench/editor_state.rs): cargo test -p app cancel_operation goto_symbol rename format (55) |
| editor/contrib/find | src/vs/editor/contrib | M8 | verified | | multi-line find and replace inputs (Ctrl+Enter, "\r\n" shown as "\n", growth to `flexibleMaxHeight` 118): cargo test -p app the_find_input; search, replace pattern, find state, find model with decorations and the controller's actions (editor/find/): cargo test -p app editor::find (the seed keeps the model EOL: a_multiline_seed_takes_the_model_eol), upstream find, findModel (with `_largeReplaceAll`), findController and replacePattern tests; find widget (workbench/find_widget.rs): cargo test -p app the_find_widget; match, current match, find scope and range highlight decorations (find_line_decorations); find context keys and keybindings, Find with Arguments, Go to Match, palette entries (cargo test -p app the_find_widget, editor_actions_show); find and replace history, persisted query options (cargo test -p app history the_find_widget); minimap and overview ruler find markers (cargo test -p app the_find_widget merged_match_lines); a controller and widget per code editor, open and drawn in every group and diff side, histories shared (workbench/code_editors.rs `bind_find_widget`; cargo test -p app each_group_keeps_its_own_find_widget_and_shares_the_history the_original_side_takes_the_focus_selection_and_find); pixel-check window find (port/results/pixels.md) (port/notes.md milestone 8) `editor.wordSeparators` for whole words and the seed word: cargo test -p app the_word_separators |
| editor/contrib/floatingMenu | src/vs/editor/contrib | M8 | verified | | `FloatingEditorToolbar` (workbench/floating_menu.rs): the primary actions of `MenuId.EditorContent` at the bottom right, run with the model URI, `.single-button` for one action, the toolbar with the first action primary for more; Define Keybinding over the user keybindings.json and the `editor/content` items of extensions with `contribEditorContentMenu` (git's merge and commit message buttons): cargo test -p app floating_menu editor_content; single button styles moved unchanged from the `define-file-widget.png` pair (port/results/keybindings-editor.md) |
-| editor/contrib/folding | src/vs/editor/contrib | M8 | ported | [3 S] edit.rs:1149: an editor whose model another editor edited computes its indentation ranges on the next sync, where folding.ts waits for its own update Delayer | folding model, ranges, hidden ranges, indent, marker and syntax range providers, gutter controls, fold/unfold keys with the Cmd+K chords and every folding command by id, per-file state in the editor view state (editor/folding.rs, editor/folding_controller.rs, editor/view_state.rs): cargo test -p app editor::folding (foldingModel, foldingRanges, hiddenRangeModel, indentRangeProvider, syntaxFold tests) folding_and_cursor_keys_run_through_the_keybindings view_state, pixel-check folded |
+| editor/contrib/folding | src/vs/editor/contrib | M8 | verified | | folding model, ranges, hidden ranges, indent, marker and syntax range providers, gutter controls, fold/unfold keys with the Cmd+K chords and every folding command by id, per-file state in the editor view state, the other editor of a model following its edits until its update Delayer runs (editor/folding.rs, editor/folding_controller.rs, editor/view_state.rs): cargo test -p app editor::folding (foldingModel, foldingRanges, hiddenRangeModel, indentRangeProvider, syntaxFold tests) folding_and_cursor_keys_run_through_the_keybindings view_state the_other_editor_of_a_split_folds_again_after_its_update_delay, pixel-check folded |
| editor/contrib/fontZoom | src/vs/editor/contrib | M8 | verified | | `editor/zoom.rs` (EditorZoom, the mouseWheelZoom gesture), `editor.action.fontZoomIn/Out/Reset`, font size and line height scaled in `EditorMetrics` and `Viewport.line_height`: cargo test -p app zoom; ui-pair notes.txt at levels 1, 2 and -1 |
| editor/contrib/format | src/vs/editor/contrib | M13 | verified | | Format Document/Selection/Modified Lines, `_executeFormat*Provider`, format on type (trigger characters, `editor.formatOnType`), Format on Save with `editor.formatOnSaveMode`, edits made minimal by stringDiff (workbench/format.rs, diff string_diff.rs): cargo test -p app format:: (16), cargo test -p diff string_diff; ui-pair Shift+Option+F on a.ts matches the reference (port/notes.md milestone 13) |
| editor/contrib/gotoError | src/vs/editor/contrib | M13 | verified | | workbench/marker_navigation.rs (gotoError.ts, markerNavigationService.ts, gotoErrorWidget.ts): cargo test -p app marker_navigation (the message's 6px scrollbar: a_long_message_scrolls_with_its_6px_scrollbar); Go menu Next/Previous Problem (menus.rs); ui-pair e.ts F8: the widget as in the reference, which has no resize sash either (port/results/language-features.md Go to Next Problem) |