Visual Studio Code, rebuilt in Rust
Rust
perf(editor): compute folding ranges after the update delay
rokarturec0a9d6e62a4
diff --git a/native/crates/app/src/editor/edit.rs b/native/crates/app/src/editor/edit.rsindex ca11842447a..2a30164cdb8 100644--- a/native/crates/app/src/editor/edit.rs+++ b/native/crates/app/src/editor/edit.rs@@ -1165,7 +1165,8 @@ impl OpenEditor {drop(model);let version = self.text_model().version_id;self.seen_version = version;- self.refresh_folding_ranges();+ // folding.ts computes the regions again in its update Delayer (workbench `trigger_folding_model_changed`).+ self.adjust_selections_to_folds();}/// Replaces `start..end` with `text` in the lines and describes it in the text before it.diff --git a/native/crates/app/src/editor/folding.rs b/native/crates/app/src/editor/folding.rsindex 97fbcc5c381..5da4bfde1b6 100644--- a/native/crates/app/src/editor/folding.rs+++ b/native/crates/app/src/editor/folding.rs@@ -773,6 +773,8 @@ impl FoldingModel {range.end = tracked(decoration_end, 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.+ self.update_hidden();}}diff --git a/native/crates/app/src/editor/folding_controller.rs b/native/crates/app/src/editor/folding_controller.rsindex 0ab01261c88..4b3b231925b 100644--- a/native/crates/app/src/editor/folding_controller.rs+++ b/native/crates/app/src/editor/folding_controller.rs@@ -58,7 +58,7 @@ impl OpenEditor {/// `onHiddenRangesChanges`: a selection end on a hidden line moves to its fold line through `setSelections`,/// so the word highlights follow and Cursor Undo can bring the cursor back.- fn adjust_selections_to_folds(&mut self) {+ pub(super) fn adjust_selections_to_folds(&mut self) {let mut selections = self.selections.clone();if self.folding.adjust_selections(&self.document().lines, &mut selections) {self.set_selections(selections);diff --git a/native/crates/app/src/workbench/folding_providers.rs b/native/crates/app/src/workbench/folding_providers.rsindex 00d3a5b9d83..4b5831be117 100644--- a/native/crates/app/src/workbench/folding_providers.rs+++ b/native/crates/app/src/workbench/folding_providers.rs@@ -2,7 +2,7 @@//! folds by the extension `FoldingRangeProvider`s registered for it (`editor.defaultFoldingRangeProvider` picks//! one extension), else by its indentation and markers.-use std::time::Duration;+use std::time::{Duration, Instant};use config::configuration::Overrides;use gpui::{AppContext, Context};@@ -11,13 +11,12 @@ use serde_json::{Value, json};use super::Workbench;use crate::commands::Outcome;use crate::editor::folding::{FoldingRegions, MAX_FOLDING_REGIONS, SyntaxRange, compute_ranges_limited, sanitize_ranges};+use crate::language_feature_debounce::FeatureDebounce;use crate::language_features::Candidate;#[cfg(test)]mod tests;-/// The `min` of folding.ts `updateDebounceInfo`: the update waits this long after the last trigger.-const UPDATE_DELAY: Duration = Duration::from_millis(200);/// `MAX_FOLDING_REGIONS_FOR_INDENT_DEFAULT`, the `editor.foldingMaximumRegions` default.const DEFAULT_MAXIMUM_REGIONS: usize = 5000;@@ -27,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)>,+ /// folding.ts `updateDebounceInfo`: `for(foldingRangeProvider, 'Folding', { min: 200 })`, max `min ** 2`.+ debounce: FeatureDebounce<200, 40_000>,}impl Workbench {@@ -81,13 +82,17 @@ impl Workbench {}}- /// `triggerFoldingModelChanged` of the active editor: its regions are computed again after the update delay.+ /// `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(model_id) = self.editors.active().map(|editor| editor.model_id) else { return };+ let Some(editor) = self.editors.active() else { return };+ let model_id = editor.model_id;+ let key = self.folding_debounce_key(model_id);+ let delay = self.folding_providers.debounce.get(&key);self.folding_providers.generation += 1;let generation = self.folding_providers.generation;cx.spawn(async move |workbench, cx| {- cx.background_executor().timer(UPDATE_DELAY).await;+ cx.background_executor().timer(delay).await;let _ = workbench.update(cx, |workbench, cx| workbench.compute_folding_ranges(generation, model_id, cx));}).detach();@@ -100,18 +105,18 @@ impl Workbench {return;}let Some(editor) = self.editors.active().filter(|editor| editor.model_id == model_id) else { return };+ let started = cx.background_executor().now();let handles = self.folding_range_providers(&editor.document().uri(), &editor.document().language_id);let (uri, version, line_count) = (editor.document().uri(), editor.text_model().version_id, editor.document().lines.len());let document = editor.document();let limit = self.folding_limit(&Overrides { resource: Some(&document.path), override_identifier: Some(&document.language_id) });drop(document);let editor = self.editors.active_mut().expect("found above");- let limit_changed = std::mem::replace(&mut editor.folding_limit, limit) != limit;+ editor.folding_limit = limit;if handles.is_empty() {- if editor.syntax_folding || limit_changed {- editor.apply_syntax_folding(None, false);- self.folding_regions_changed(cx);- }+ editor.apply_syntax_folding(None, false);+ self.folding_regions_changed(cx);+ self.folding_updated(model_id, cx.background_executor().now() - started);return;}let calls: Vec<_> = handles.iter().map(|handle| self.host.call_cancellable("ExtHostLanguageFeatures", "$provideFoldingRanges", vec![json!(handle), uri.clone(), json!({})])).collect();@@ -124,14 +129,14 @@ impl Workbench {return;}}- let _ = workbench.update(cx, |workbench, cx| workbench.apply_folding_answers(model_id, version, line_count, answers, cx));+ let _ = workbench.update(cx, |workbench, cx| workbench.apply_folding_answers(model_id, version, line_count, answers, started, cx));}).detach();}/// `collectSyntaxRanges`: the ranges of every provider that answered with an array, valid for the model's/// lines, ranked by the provider's order; none answering an array falls back to the indentation provider.- fn apply_folding_answers(&mut self, model_id: u32, version: u32, line_count: usize, answers: Vec<Value>, cx: &mut Context<Self>) {+ fn apply_folding_answers(&mut self, model_id: u32, version: u32, line_count: usize, answers: Vec<Value>, started: Instant, cx: &mut Context<Self>) {let Some(editor) = self.editors.active().filter(|editor| editor.model_id == model_id && editor.text_model().version_id == version) else { return };let document = editor.document();let overrides = Overrides { resource: Some(&document.path), override_identifier: Some(&document.language_id) };@@ -141,6 +146,21 @@ impl Workbench {drop(document);self.editors.active_mut().expect("found above").apply_syntax_folding(regions, fold_imports);self.folding_regions_changed(cx);+ self.folding_updated(model_id, cx.background_executor().now() - started);+ }++ /// `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);+ 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();+ 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<_>>())}/// `FoldingController.getFoldingRangeProviders` with `DefaultFoldingRangeProvider._selectFoldingRangeProvider`:diff --git a/native/crates/app/src/workbench/folding_providers/tests.rs b/native/crates/app/src/workbench/folding_providers/tests.rsindex c3bca915fc0..0f9b196ef55 100644--- a/native/crates/app/src/workbench/folding_providers/tests.rs+++ b/native/crates/app/src/workbench/folding_providers/tests.rs@@ -35,9 +35,9 @@ fn request(workbench: &gpui::Entity<Workbench>, cx: &mut VisualTestContext, methdrop(workbench.update_in(cx, |workbench, window, cx| workbench.handle_host_request(request, window, cx)));}-/// Waits out the update delay and answers the `$provideFoldingRanges` calls it sends, by provider handle.+/// Waits out the update delay (`min * 1.5` before an update took a measured time) and answers the `$provideFoldingRanges` calls it sends, by provider handle.fn answer(receiver: &Receiver<HostMessage>, cx: &mut VisualTestContext, answers: &[(u64, Value)]) -> Vec<u64> {- cx.executor().advance_clock(Duration::from_millis(200));+ cx.executor().advance_clock(Duration::from_millis(300));cx.run_until_parked();let mut asked = Vec::new();for message in receiver.try_iter() {@@ -83,6 +83,37 @@ fn extension_providers_fold_the_model_and_indentation_is_the_fallback(cx: &mut Tstd::fs::remove_dir_all(dir).unwrap();}+/// folding.ts `updateScheduler`: typing leaves the indentation regions as they were until the update delay, 300 ms+/// (`min * 1.5`) first, then the 200 ms `min` its learned average is clamped to.+#[gpui::test]+fn an_edit_folds_by_indentation_again_after_the_update_delay(cx: &mut TestAppContext) {+ let (workbench, cx, _receiver, dir) = workbench_with("delay", cx);+ let type_indent = |workbench: &gpui::Entity<Workbench>, cx: &mut VisualTestContext, line: usize| {+ workbench.update(cx, |workbench, cx| {+ let editor = workbench.editors.active_mut().unwrap();+ editor.move_to(crate::editor::Position::new(line, 0), false);+ editor.type_text(" ").unwrap();+ cx.notify();+ });+ cx.run_until_parked();+ };+ type_indent(&workbench, cx, 1);+ cx.executor().advance_clock(Duration::from_millis(299));+ cx.run_until_parked();+ assert_eq!(regions(&workbench, cx), [(4, 6, false)], "not before the first delay");+ cx.executor().advance_clock(Duration::from_millis(1));+ cx.run_until_parked();+ assert_eq!(regions(&workbench, cx), [(1, 2, false), (4, 6, false)]);+ type_indent(&workbench, cx, 3);+ cx.executor().advance_clock(Duration::from_millis(199));+ cx.run_until_parked();+ assert_eq!(regions(&workbench, cx), [(1, 2, false), (4, 6, false)]);+ cx.executor().advance_clock(Duration::from_millis(1));+ cx.run_until_parked();+ assert_eq!(regions(&workbench, cx), [(1, 2, false), (3, 6, false)]);+ 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/port/ledger.md b/port/ledger.mdindex db166dd2c86..04484eb19af 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -285,8 +285,8 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| platform/windows | src/vs/platform | M11 | verified | | windows_state.rs (windowsStateHandler.ts, windowsMainService.ts `doGetPathsFromLastSession`): `windowsState` in `User/globalStorage/storage.json` saved on quit (the last window closed, else the active one; all windows when two or more), restored on a start without paths and on every start with `preserve` (`window.restoreWindows` none, one, folders, all), each window in its display and bounds when that display is still there, fullscreen only with `window.restoreFullscreen`; empty windows reopen on their backup folder; a reload keeps the window's place; a new window takes the stored place of its workspace, folder or empty window, the first one the last active window's, else `window.newWindowDimensions` (default and offset cascade 30 points off the open windows, inherit, maximized, fullscreen). The default size stays 1024x768, the reference capture size of port/tools/ref-screenshot, where upstream takes 1200x800 or 1440x900. `cargo test -p app windows_state`; verified: ui-pair hot-exit.json `restored` vs the reference (port/results/windows.md, milestone 11 verification): the window restored on its folder after quit || platform/workspace | src/vs/platform | M12 | verified | | virtual workspaces (non-file folders): milestone 25; config/src/workspace.rs: folders, getFolder, toWorkspaceFolders, workspace label; cargo test -p config workspace (workspace.test.ts cases); api-workspace 4/4; verified: api-tests MOCHA_GREP="vscode API - (workspace|file system|env|types|tasks)" at 44a309311e1: every workspace, workspace-fs, workspace events, workspace-watcher and file system test passes, api-workspace 4/0/0 (port/results/api-tests.md "M12 verification"), api-workspace 4/4 || platform/workspaces | src/vs/platform | M12 | verified | | getWorkspaceIdentifier and getSingleFolderWorkspaceIdentifier (session.rs, workspaces.test.ts stable id case, cargo test -p exthost); recently opened list (recently_opened.rs, workspacesHistoryMainService: `history.recentlyOpenedPathsList` in shared storage, 500 per kind, cargo test -p app recently_opened); untitled workspaces under `<user data>/Workspaces/<id>/workspace.json` (config/src/workspace.rs isUntitledWorkspace, workbench/workspace_editing.rs createUntitledWorkspace, deleteUntitledWorkspace, Save Workspace As with rewritten relative paths): cargo test -p config workspace:: 5/5, cargo test -p app workspace_editing; ui-pair port/fixtures/ui-pair/m12/workspace-folders.json (Remove Folder from Workspace enters Untitled (Workspace)), verified at port-m12b-verify; getWorkspaceIdentifier and getSingleFolderWorkspaceIdentifier (session.rs, workspaces.test.ts stable id case, cargo test -p exthost); no untitled workspaces or recent list; getWorkspaceIdentifier and getSingleFolderWorkspaceIdentifier (session.rs, workspaces.test.ts stable id case, cargo test -p exthost); recently opened list (recently_opened.rs, workspacesHistoryMainService: `history.recentlyOpenedPathsList` in shared storage, 500 per kind, cargo test -p app recently_opened); no untitled workspaces; getWorkspaceIdentifier and getSingleFolderWorkspaceIdentifier (session.rs, workspaces.test.ts stable id case, cargo test -p exthost); no untitled workspaces or recent list |-| editor/browser | src/vs/editor | M8 | ported | [3 S] word_wrap.rs:136: a view line starting inside an inlay hint in a smaller font or with the padding box draws the hint's rest at an even share of its drawn width, upstream splits the spans <br> [3 L] syntax.rs:318, :355: incremental bracket tree. Gate: cargo test --release -p app -- --ignored typing_latency_on_a_large_file (one typed char then the tokens of 60 visible lines and the bracket match, 52k-line TS file of textModel.ts repeated, median per edit under 16 ms). Before the token store (80b459587ac): 5.6 s at line 100, 2.8 s at line 25000, 0.5 s at line 49000. With the token store and each line's brackets kept: 16.5 ms, 17.1 ms, 17.7 ms, of which pairing the 78k brackets again 6.5 ms and the indentation folding ranges 7.6 ms (editor/contrib/folding) <br> [3 S] syntax.rs:135: no `tokenizeHeuristically`, the viewport is tokenized from the first untrusted line <br> [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests (8); folding (editor/folding.rs): cargo test -p app editor::folding (49); minimap with slider, decorations, section headers, settings and the scrollbar context menu (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap (11), section_headers (18), editor_menus (8); sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`): cargo test -p app selection_corners (1); `editor.renderWhitespace` (editor/whitespace.rs): cargo test -p app whitespace (39); control characters and bidi format characters as `[U+XXXX]` (workbench/control_characters.rs): cargo test -p app control_characters (4); glyph margin and line number presses (workbench/gutter_mouse.rs): cargo test -p app gutter_presses (1); word wrap with view lines, Toggle Word Wrap and the wrap indicator (editor/word_wrap.rs): cargo test -p app word_wrap (21), ui-pair /tmp/m8wrap wrap.ts; `editor.smoothScrolling` (editor/smooth_scroll.rs, workbench/smooth_scrolling.rs): cargo test -p app smooth_scroll (11, the scrollable.test.ts cases); diff editor widget (port/notes.md milestone 14): cargo test -p app diff_editor (22), diff_gutter (2); all run at the milestone 20 sweep; scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests; folding (editor/folding.rs): cargo test -p app editor::folding; minimap with slider, decorations and section headers (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap, cargo test -p app section_headers; sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`, selections.ts): cargo test -p app selection_corners, ui-pair corners match; `editor.renderWhitespace` marks drawn as svg circles and arrows (editor/whitespace.rs, viewParts/whitespace): cargo test -p app whitespace, ui-pair notes.txt; control characters as Control Pictures (`editor.renderControlCharacters`, workbench/control_characters.rs): cargo test -p app control_characters; glyph margin and line number presses select lines, drags extend them, Alt adds a line cursor (mouseHandler.ts `startedOnLineNumbers`, workbench/gutter_mouse.rs): cargo test -p app gutter_presses; no smooth scrolling, no word wrap (`editor.wordWrap`, viewModelLines with line breaks), bidi format characters not drawn as `[U+XXXX]` (port/notes.md milestone 8); diff editor widget (side by side, inline, view zones, gutter toolbar, overview ruler, title actions; port/notes.md milestone 14): cargo test -p app diff_editor diff_gutter; Switch Side (`diffEditor.switchSide`, the selection mapped through the diff) and Focus Primary, Secondary and Other Side, in the diff and the multi diff editor: cargo test -p app switch_side; bracket pair guides (`editor.guides.bracketPairs`, `bracketPairsHorizontal`, `highlightActiveBracketPair`; guidesTextModelPart.ts) in every code editor, on a wrapped line only on the view lines `getViewLinesBracketGuides` keeps (viewModelLines.ts): cargo test -p app bracket_pair_guide; indent guides on a wrapped line repeated on its view lines only with a wrapping indent (`getViewLinesIndentGuides`, viewModelLines.ts), none past the wrapping column (`_maxIndentLeft`, indentGuides.ts): cargo test -p app wrapping_indent_repeats without_a_wrapping_indent; scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests; folding (editor/folding.rs): cargo test -p app editor::folding; minimap with slider, decorations and section headers (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap, cargo test -p app section_headers; sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`, selections.ts): cargo test -p app selection_corners, ui-pair corners match; no `renderWhitespace` yet; no smooth scrolling (port/notes.md milestone 8); scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests; folding (editor/folding.rs): cargo test -p app editor::folding; minimap with slider, decorations and section headers (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap, cargo test -p app section_headers; sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`, selections.ts): cargo test -p app selection_corners, ui-pair corners match; `editor.renderWhitespace` marks drawn as svg circles and arrows (editor/whitespace.rs, viewParts/whitespace): cargo test -p app whitespace, ui-pair notes.txt; control characters as Control Pictures (`editor.renderControlCharacters`, workbench/control_characters.rs): cargo test -p app control_characters; glyph margin and line number presses select lines, drags extend them, Alt adds a line cursor (mouseHandler.ts `startedOnLineNumbers`, workbench/gutter_mouse.rs): cargo test -p app gutter_presses; word wrap with view lines, Toggle Word Wrap and the wrap indicator (editor/word_wrap.rs: cargo test -p app word_wrap; ui-pair /tmp/m8wrap wrap.ts: breaks, End, Down and Alt+Z match the reference); bidi format characters as `[U+XXXX]` (cargo test -p app control_characters); minimap settings and the scrollbar context menu (cargo test -p app minimap editor_menus); `editor.smoothScrolling` over 125 ms for cursor, find and API reveals and mouse wheel notches (editor/smooth_scroll.rs, workbench/smooth_scrolling.rs: cargo test -p app smooth_scroll, the scrollable.test.ts cases); diff editor widget (side by side, inline, view zones, gutter toolbar, overview ruler, title actions; port/notes.md milestone 14): cargo test -p app diff_editor diff_gutter; each side its own editor (the original's cursor and active line number, inline only its line numbers wide), char changes filled past the line break (`shouldFillLineOnLineBreak`) but not in the inline deleted lines, the sides' overview ruler without the minimap background, a press with no move before it shows the scrollbars: cargo test -p app file_compare char_ranges a_click_without_a_move, ui-pair m12/compare.json; mouse selection: four clicks select all, a double click the word (`WordOperations.word`) or the inside of brackets and strings (`editor.doubleClickSelectsBlock`), double and triple click drags go on by words and lines, their Alt forms on the cursor added last, a drag past the text scrolls each frame (dragScrolling.ts) (editor/mouse_selection.rs, workbench/drag_scrolling.rs): cargo test -p app mouse_selection text_clicks_select a_selecting_drag_below (6), in the vertical scrollbar without the minimap, below the horizontal scrollbar's top and in a comment reply editor: cargo test -p app a_drag_into_the_vertical the_bottom_edge_hit a_drag_below_a_comment; the IME input handler sees the selection's lines, a caret inside marked text places the cursor and character bounds follow the text (nativeEditContext.ts): cargo test -p app text_input::; decoration type outlines outside the range and borders inside it, the CSS cascade of their shorthands and longhands, `before`/`after` content text as injected text (workbench/editor_view/text_decorations.rs): cargo test -p app outline_and_border_follow_the_css_cascade a_decoration_outline_is_drawn_outside_its_range decoration_types_set_and_remove_editor_decorations, ui-pair of a merge conflict file: the header's "(Incoming Change)" text matches the reference |-| editor/common | src/vs/editor | M8 | ported | [3 L] syntax.rs:318, :355: incremental bracket tree. Gate: cargo test --release -p app -- --ignored typing_latency_on_a_large_file (one typed char then the tokens of 60 visible lines and the bracket match, 52k-line TS file of textModel.ts repeated, median per edit under 16 ms). Before the token store (80b459587ac): 5.6 s at line 100, 2.8 s at line 25000, 0.5 s at line 49000. With the token store and each line's brackets kept: 16.5 ms, 17.1 ms, 17.7 ms, of which pairing the 78k brackets again 6.5 ms and the indentation folding ranges 7.6 ms (editor/contrib/folding) <br> [3 S] syntax.rs:135: no `tokenizeHeuristically`, the viewport is tokenized from the first untrusted line <br> [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | the model and cursor layer under every editor (app/src/editor, decorations.rs, link_computer.rs, syntax.rs, the diff crate): cursors (CursorCollection normalize, per-cursor edits, loser edits, paste distribution, column selection), core moves and deletes over grapheme clusters, typing with auto-closing, word operations, the edit stack with its stops and the alternative version id dirty state, onEnter and indentation rules (`languages/autoIndent.ts`, `enterAction.ts`, EnterOperation, electric characters, TabOperation, ShiftCommand miss-aligned lines), indentation guessing, model decorations with injected text, bracket matching and bracket pair colorization, the link computer, view lines with word wrap: cargo test -p app editor:: decorations:: link_computer syntax:: (781 passed, 13 ignored: the upstream `test.skip` cases of indentation.test.ts); the diff algorithms of editor/common/diff: cargo test -p diff (15 passed). `getWordAtPosition` inside the token language with its `wordPattern`: cargo test -p app the_word_at_a_column (model.test.ts 'Get word at position', 'getWordAtPosition at embedded language boundaries', 'issue #61296'). Swapped by design: the piece tree text buffer is a vector of lines (no observable difference; large files go through workbench/large_file.rs). Gap (editor audit): pushEOL not on the undo stack (edit.rs). Full-width chars take two visible columns for tab stops and cursor moves and draw at the font's full-width advance: cargo test -p app full_width_chars_take moving_down_keeps. Language configuration regexes read a class hyphen next to `\w`, `\d` or `\s` as JavaScript does (css `[\w-?]`, folding.rs `marker_regex`): cargo test -p app a_hyphen_next_to_a_class_escape_is_literal. |+| editor/browser | src/vs/editor | M8 | ported | [3 S] word_wrap.rs:136: a view line starting inside an inlay hint in a smaller font or with the padding box draws the hint's rest at an even share of its drawn width, upstream splits the spans <br> [3 L] syntax.rs:318, :355: incremental bracket tree. Gate: cargo test --release -p app -- --ignored typing_latency_on_a_large_file (one typed char then the tokens of 60 visible lines and the bracket match, 52k-line TS file of textModel.ts repeated, median per edit under 16 ms). Before the token store (80b459587ac): 5.6 s at line 100, 2.8 s at line 25000, 0.5 s at line 49000. With the token store, each line's brackets kept and the folding update Delayer: 9.3 ms, 9.9 ms, 10.3 ms, of which pairing the 78k brackets again 6.5 ms <br> [3 S] syntax.rs:135: no `tokenizeHeuristically`, the viewport is tokenized from the first untrusted line <br> [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests (8); folding (editor/folding.rs): cargo test -p app editor::folding (49); minimap with slider, decorations, section headers, settings and the scrollbar context menu (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap (11), section_headers (18), editor_menus (8); sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`): cargo test -p app selection_corners (1); `editor.renderWhitespace` (editor/whitespace.rs): cargo test -p app whitespace (39); control characters and bidi format characters as `[U+XXXX]` (workbench/control_characters.rs): cargo test -p app control_characters (4); glyph margin and line number presses (workbench/gutter_mouse.rs): cargo test -p app gutter_presses (1); word wrap with view lines, Toggle Word Wrap and the wrap indicator (editor/word_wrap.rs): cargo test -p app word_wrap (21), ui-pair /tmp/m8wrap wrap.ts; `editor.smoothScrolling` (editor/smooth_scroll.rs, workbench/smooth_scrolling.rs): cargo test -p app smooth_scroll (11, the scrollable.test.ts cases); diff editor widget (port/notes.md milestone 14): cargo test -p app diff_editor (22), diff_gutter (2); all run at the milestone 20 sweep; scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests; folding (editor/folding.rs): cargo test -p app editor::folding; minimap with slider, decorations and section headers (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap, cargo test -p app section_headers; sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`, selections.ts): cargo test -p app selection_corners, ui-pair corners match; `editor.renderWhitespace` marks drawn as svg circles and arrows (editor/whitespace.rs, viewParts/whitespace): cargo test -p app whitespace, ui-pair notes.txt; control characters as Control Pictures (`editor.renderControlCharacters`, workbench/control_characters.rs): cargo test -p app control_characters; glyph margin and line number presses select lines, drags extend them, Alt adds a line cursor (mouseHandler.ts `startedOnLineNumbers`, workbench/gutter_mouse.rs): cargo test -p app gutter_presses; no smooth scrolling, no word wrap (`editor.wordWrap`, viewModelLines with line breaks), bidi format characters not drawn as `[U+XXXX]` (port/notes.md milestone 8); diff editor widget (side by side, inline, view zones, gutter toolbar, overview ruler, title actions; port/notes.md milestone 14): cargo test -p app diff_editor diff_gutter; Switch Side (`diffEditor.switchSide`, the selection mapped through the diff) and Focus Primary, Secondary and Other Side, in the diff and the multi diff editor: cargo test -p app switch_side; bracket pair guides (`editor.guides.bracketPairs`, `bracketPairsHorizontal`, `highlightActiveBracketPair`; guidesTextModelPart.ts) in every code editor, on a wrapped line only on the view lines `getViewLinesBracketGuides` keeps (viewModelLines.ts): cargo test -p app bracket_pair_guide; indent guides on a wrapped line repeated on its view lines only with a wrapping indent (`getViewLinesIndentGuides`, viewModelLines.ts), none past the wrapping column (`_maxIndentLeft`, indentGuides.ts): cargo test -p app wrapping_indent_repeats without_a_wrapping_indent; scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests; folding (editor/folding.rs): cargo test -p app editor::folding; minimap with slider, decorations and section headers (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap, cargo test -p app section_headers; sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`, selections.ts): cargo test -p app selection_corners, ui-pair corners match; no `renderWhitespace` yet; no smooth scrolling (port/notes.md milestone 8); scrolling: wheel, scrollbars with drag, track press and fade, scroll shadow, reveal on cursor moves and from the API, per-editor scroll position (editor/view.rs, workbench/editor_view.rs): cargo test -p app editor::view::tests; folding (editor/folding.rs): cargo test -p app editor::folding; minimap with slider, decorations and section headers (editor/minimap.rs, editor/section_headers.rs, workbench/minimap_view.rs): cargo test -p app minimap, cargo test -p app section_headers; sticky scroll (editor/contrib/stickyScroll row); rounded selections (`editor.roundedSelection`, selections.ts): cargo test -p app selection_corners, ui-pair corners match; `editor.renderWhitespace` marks drawn as svg circles and arrows (editor/whitespace.rs, viewParts/whitespace): cargo test -p app whitespace, ui-pair notes.txt; control characters as Control Pictures (`editor.renderControlCharacters`, workbench/control_characters.rs): cargo test -p app control_characters; glyph margin and line number presses select lines, drags extend them, Alt adds a line cursor (mouseHandler.ts `startedOnLineNumbers`, workbench/gutter_mouse.rs): cargo test -p app gutter_presses; word wrap with view lines, Toggle Word Wrap and the wrap indicator (editor/word_wrap.rs: cargo test -p app word_wrap; ui-pair /tmp/m8wrap wrap.ts: breaks, End, Down and Alt+Z match the reference); bidi format characters as `[U+XXXX]` (cargo test -p app control_characters); minimap settings and the scrollbar context menu (cargo test -p app minimap editor_menus); `editor.smoothScrolling` over 125 ms for cursor, find and API reveals and mouse wheel notches (editor/smooth_scroll.rs, workbench/smooth_scrolling.rs: cargo test -p app smooth_scroll, the scrollable.test.ts cases); diff editor widget (side by side, inline, view zones, gutter toolbar, overview ruler, title actions; port/notes.md milestone 14): cargo test -p app diff_editor diff_gutter; each side its own editor (the original's cursor and active line number, inline only its line numbers wide), char changes filled past the line break (`shouldFillLineOnLineBreak`) but not in the inline deleted lines, the sides' overview ruler without the minimap background, a press with no move before it shows the scrollbars: cargo test -p app file_compare char_ranges a_click_without_a_move, ui-pair m12/compare.json; mouse selection: four clicks select all, a double click the word (`WordOperations.word`) or the inside of brackets and strings (`editor.doubleClickSelectsBlock`), double and triple click drags go on by words and lines, their Alt forms on the cursor added last, a drag past the text scrolls each frame (dragScrolling.ts) (editor/mouse_selection.rs, workbench/drag_scrolling.rs): cargo test -p app mouse_selection text_clicks_select a_selecting_drag_below (6), in the vertical scrollbar without the minimap, below the horizontal scrollbar's top and in a comment reply editor: cargo test -p app a_drag_into_the_vertical the_bottom_edge_hit a_drag_below_a_comment; the IME input handler sees the selection's lines, a caret inside marked text places the cursor and character bounds follow the text (nativeEditContext.ts): cargo test -p app text_input::; decoration type outlines outside the range and borders inside it, the CSS cascade of their shorthands and longhands, `before`/`after` content text as injected text (workbench/editor_view/text_decorations.rs): cargo test -p app outline_and_border_follow_the_css_cascade a_decoration_outline_is_drawn_outside_its_range decoration_types_set_and_remove_editor_decorations, ui-pair of a merge conflict file: the header's "(Incoming Change)" text matches the reference |+| editor/common | src/vs/editor | M8 | ported | [3 L] syntax.rs:318, :355: incremental bracket tree. Gate: cargo test --release -p app -- --ignored typing_latency_on_a_large_file (one typed char then the tokens of 60 visible lines and the bracket match, 52k-line TS file of textModel.ts repeated, median per edit under 16 ms). Before the token store (80b459587ac): 5.6 s at line 100, 2.8 s at line 25000, 0.5 s at line 49000. With the token store, each line's brackets kept and the folding update Delayer: 9.3 ms, 9.9 ms, 10.3 ms, of which pairing the 78k brackets again 6.5 ms <br> [3 S] syntax.rs:135: no `tokenizeHeuristically`, the viewport is tokenized from the first untrusted line <br> [scheduling L] minimap.rs:87; minimap_view.rs:432; unicode_highlight.rs:63; indentation.rs:43; comment.rs:45; smart_select.rs:292: sticky minimap sampling, worker section headers and unicode highlights, tokenizeIfCheap, the 30 ms smart select yield. Accepted as "Scheduling differences" only with a measured same result and typing on a 50k-line TS file under 16 ms per edit; otherwise class 3. Audit inputs at 5e5b1b0a915. | the model and cursor layer under every editor (app/src/editor, decorations.rs, link_computer.rs, syntax.rs, the diff crate): cursors (CursorCollection normalize, per-cursor edits, loser edits, paste distribution, column selection), core moves and deletes over grapheme clusters, typing with auto-closing, word operations, the edit stack with its stops and the alternative version id dirty state, onEnter and indentation rules (`languages/autoIndent.ts`, `enterAction.ts`, EnterOperation, electric characters, TabOperation, ShiftCommand miss-aligned lines), indentation guessing, model decorations with injected text, bracket matching and bracket pair colorization, the link computer, view lines with word wrap: cargo test -p app editor:: decorations:: link_computer syntax:: (781 passed, 13 ignored: the upstream `test.skip` cases of indentation.test.ts); the diff algorithms of editor/common/diff: cargo test -p diff (15 passed). `getWordAtPosition` inside the token language with its `wordPattern`: cargo test -p app the_word_at_a_column (model.test.ts 'Get word at position', 'getWordAtPosition at embedded language boundaries', 'issue #61296'). Swapped by design: the piece tree text buffer is a vector of lines (no observable difference; large files go through workbench/large_file.rs). Gap (editor audit): pushEOL not on the undo stack (edit.rs). Full-width chars take two visible columns for tab stops and cursor moves and draw at the font's full-width advance: cargo test -p app full_width_chars_take moving_down_keeps. Language configuration regexes read a class hyphen next to `\w`, `\d` or `\s` as JavaScript does (css `[\w-?]`, folding.rs `marker_regex`): cargo test -p app a_hyphen_next_to_a_class_escape_is_literal. || editor/standalone | src/vs/editor | | removed | | Artur: internal infrastructure or developer tool with no 1:1 counterpart in the native port || editor/test | src/vs/editor | M6 | n/a | | upstream test infrastructure; the port tests with cargo test and port/tools || editor/contrib/anchorSelect | src/vs/editor/contrib | M8 | verified | | `editor/anchor_select.rs`: the four commands with their keys and `selectionAnchorSet`, the anchor moved by edits as a `NeverGrowsWhenTypingAtEdges` marker, the bar under the word highlights: cargo test -p app anchor; ui-pair notes.txt through the Command Palette; no hover message until editor hovers |@@ -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 M] folding_controller.rs:23: folding.ts computes the ranges in a Delayer (`updateDebounceInfo`, min 200 ms) after an edit; the port per edit, 7.6 ms of the 17 ms per edit in typing_latency_on_a_large_file | 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 | 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/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) |diff --git a/port/notes.md b/port/notes.mdindex d9ab3f81613..fa536b9c6f8 100644--- a/port/notes.md+++ b/port/notes.md@@ -447,6 +447,7 @@ Done when (first item): api-tests `vscode API - editors` passes as in the refere- Keys: Cmd+Alt+[ fold, Cmd+Alt+] unfold, and the Cmd+K chords (Cmd+K Cmd+0 fold all, Cmd+K Cmd+J unfold all, Cmd+K Cmd+[ / ] recursively, Cmd+K Cmd+1..7 levels) through the M9 chord dispatch (`cargo test -p app folding_and_cursor_keys_run_through_the_keybindings`).- Editor view state (`editor/view_state.rs`; editorWithViewState.ts, `EditorMemento`, `TextFileEditor`): a file editor that leaves the group (closed, replaced by a preview, Save As) keeps its cursors (`saveCursorState`), scroll (`firstPosition` and `firstPositionDeltaTop`) and folds (the folding contribution's `collapsedRegions` mementos with their line checksums, `foldedImports`) per file URI for group 0, the newest 100; the next editor of that file takes them back unless `workbench.editor.restoreViewState` is off. On quit the open editors' states are added and the cache is written to workspace storage as `memento/workbench.editors.files.textFileEditor` (`textEditorViewState`, `LRUCache.toJSON` pairs, oldest first). The port does not reopen the editors at startup, so the state comes back when a file is opened again. Test: `cargo test -p app view_state`.- Extension folding (`workbench/folding_providers.rs`, `syntaxRangeProvider.ts`, `$registerFoldingRangeProvider` through `language_features.rs`): a model whose language has providers folds by their ranges (`sanitizeRanges`, `editor.foldingMaximumRegions`), `editor.defaultFoldingRangeProvider` keeps only that extension's, a provider event or a settings change asks again, none answering an array falls back to indentation; `editor.foldingImportsByDefault` collapses the first `imports` regions once per model. The setting's enum is built from the running extensions when the registry is (`_updateConfigValues`): All, then the extensions with `main` or `browser`, Programming Languages first, each group by name.+- Folding update delay (`trigger_folding_model_changed`, folding.ts `updateScheduler`): an edit only moves the regions and hidden lines with it (`accept_replace`); the indentation or provider ranges are computed again after the `updateDebounceInfo` delay, 300 ms (`min * 1.5`) first, then the average update time of the model clamped to 200 ms..40 s. On the 52k-line TypeScript file this took 7.6 ms off each typed char.- The scroll position truncates to whole pixels like the editor's `Scrollable` (`forceIntegerValues`), so a centered reveal in an odd height does not land on a half pixel.- Mouse cursors follow the reference CSS: text over `.view-lines` (`monaco-mouse-cursor-text`), default over line numbers, glyph margin, overview ruler, scrollbar sliders and the scroll shadow; pointer over folding icons, the `⋯` placeholder (`folding.css`), the title with tabs, close buttons and breadcrumbs (`editortabscontrol.css`, `breadcrumbsWidget.css`) and the editor actions (`actionbar.css`, the container default).- An edit sends the host new `visibleRanges` when the visible lines changed (`editor_edited` in `workbench/text_input.rs`), so unfolding by an edit reaches the host without a scroll.