Skip to content

Visual Studio Code, rebuilt in Rust

Rust

docs(port): accept the editor's measured scheduling differences

rokartur35197fb5e32b
diff --git a/native/crates/app/src/editor/smart_select.rs b/native/crates/app/src/editor/smart_select.rs
index 6f8463cfbab..255f553a984 100644
--- a/native/crates/app/src/editor/smart_select.rs
+++ b/native/crates/app/src/editor/smart_select.rs
@@ -289,7 +289,7 @@ fn char_brackets<'a>(lines: &[String], brackets: &'a [PairBracket]) -> Vec<CharB
/// `BracketSelectionRangeProvider`: right of `position` the closing brackets nothing opens there, then left
/// of it the opening brackets they close, each pair inside and out, inner pairs first.
-/// shortcut: runs to the document's ends in one go, where upstream yields every 30 ms and stops after 2 rounds.
+/// Runs to the document's ends in one go, without upstream's 30 ms yield: port/notes.md "Scheduling differences".
fn bracket_ranges(lines: &[String], brackets: &[CharBracket], position: Position) -> Vec<Span> {
let mut closings: HashMap<&str, VecDeque<Span>> = HashMap::new();
let mut counts: HashMap<&str, usize> = HashMap::new();
diff --git a/native/crates/app/src/workbench/unicode_highlight.rs b/native/crates/app/src/workbench/unicode_highlight.rs
index 83a71e38539..bb201b3f2de 100644
--- a/native/crates/app/src/workbench/unicode_highlight.rs
+++ b/native/crates/app/src/workbench/unicode_highlight.rs
@@ -59,9 +59,8 @@ impl Workbench {
(options.non_basic_ascii || options.ambiguous_characters || options.invisible_characters).then_some(options)
}
- /// `DocumentUnicodeHighlighter`: the highlights over the whole model, with the options they were found with.
- // shortcut: found again on the UI thread for each new model version, where upstream asks the editor worker 250ms
- // after the last edit and moves the old marks with the text meanwhile; upgrade when large files lag on typing.
+ /// `DocumentUnicodeHighlighter`: the highlights over the whole model, with the options they were found with. Found
+ /// again for each model version, on the UI thread rather than in the worker: port/notes.md "Scheduling differences".
pub(super) fn unicode_highlights(&self, editor: &OpenEditor) -> Option<(UnicodeHighlighterOptions, Rc<UnicodeHighlights>)> {
let options = self.unicode_highlighter_options(editor)?;
let key = (editor.model_id, editor.text_model().version_id);
diff --git a/port/ledger.md b/port/ledger.md
index 2ea2f8019ec..7bcecdf063c 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -340,7 +340,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| 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 | | session.rs, recently_opened.rs, config/src/workspace.rs, workbench/workspace_editing.rs: cargo test -p exthost (workspaces.test.ts stable id case); cargo test -p config workspace:: 5/5; cargo test -p app recently_opened workspace_editing; ui-pair port/fixtures/ui-pair/m12/workspace-folders.json (Remove Folder from Workspace enters Untitled (Workspace)) |
| editor/browser | src/vs/editor | M8 | ported | [3 S] minimap_view.rs:179: with word wrap or folds the sticky minimap sampling is not moved through edits, where upstream follows the view line events of wrapped and folded lines. | editor/view.rs, editor/folding.rs, editor/minimap.rs, editor/word_wrap.rs, editor/smooth_scroll.rs, editor/mouse_selection.rs, workbench/editor_view.rs, workbench/gutter_mouse.rs, workbench/editor_view/text_decorations.rs: cargo test -p app editor::view::tests editor::folding minimap section_headers editor_menus selection_corners whitespace control_characters gutter_presses word_wrap smooth_scroll diff_editor diff_gutter switch_side bracket_pair_guide wrapping_indent_repeats without_a_wrapping_indent file_compare char_ranges a_click_without_a_move mouse_selection text_clicks_select a_selecting_drag_below a_drag_into_the_vertical the_bottom_edge_hit a_drag_below_a_comment text_input:: outline_and_border_follow_the_css_cascade a_decoration_outline_is_drawn_outside_its_range decoration_types_set_and_remove_editor_decorations wrapping_a_padded_inlay_hint_skips_its_padding_box a_selection_over_changes_shows_the_selection_toolbar; ui-pair m12/compare.json, port/fixtures/ui-pair/menus/diff-gutter-selection.json, port/fixtures/ui-pair/m8/inlay-hint-wrap.json (port/notes.md milestones 8 and 14) |
-| editor/common | src/vs/editor | M8 | ported | [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. | app/src/editor, decorations.rs, link_computer.rs, syntax.rs, brackets/tree.rs, the diff crate: cargo test -p app editor:: decorations:: link_computer syntax:: auto_closing brackets lines_in_view_past_the_tokenized_ones the_word_at_a_column full_width_chars_take moving_down_keeps a_hyphen_next_to_a_class_escape_is_literal (13 ignored: upstream's `test.skip` cases); cargo test -p diff; typing on the 52k-line TS file under 2.3 ms median per edit: cargo test --release -p app -- --ignored typing_latency_on_a_large_file. By design: the piece tree text buffer is a vector of lines (large files through workbench/large_file.rs) |
+| editor/common | src/vs/editor | M8 | verified | | app/src/editor, decorations.rs, link_computer.rs, syntax.rs, brackets/tree.rs, the diff crate: cargo test -p app editor:: decorations:: link_computer syntax:: auto_closing brackets lines_in_view_past_the_tokenized_ones the_word_at_a_column full_width_chars_take moving_down_keeps a_hyphen_next_to_a_class_escape_is_literal (13 ignored: upstream's `test.skip` cases); cargo test -p diff; typing on the 52k-line TS file under 16 ms per edit with the section headers and unicode highlights, trim and comment on it just opened under 16 ms, its bracket selection scan under 30 ms (port/notes.md "Scheduling differences"): cargo gc test --release -p app -- --ignored typing_latency_on_a_large_file. By design: the piece tree text buffer is a vector of lines (large files through workbench/large_file.rs) |
| 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 |
@@ -389,7 +389,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| editor/contrib/rename | src/vs/editor/contrib | M13 | verified | | F2 with `$resolveRenameLocation`, rename input, `$provideRenameEdits` with provider fallback, `_executeDocumentRenameProvider`, `_executePrepareRename` (workbench/rename.rs): cargo test -p app rename:: (7); ui-pair F2, type, Enter on a.ts matches the reference input and the renamed text and caret. `acceptRenameInputWithPreview` (Cmd+Enter, `editor.rename.enablePreview`) and edits that need confirmation go through the Refactor Preview; the workspace edit's text, file and cell edits run in order in one undo group (`BulkEdit.perform`): cargo test -p app cmd_enter_previews_the_edit_and_apply_runs_its_file_and_text_edits; ui-pair F2 on src/main.ts: the `Enter to Rename, ⌘Enter to Preview` label and the 210x50.2 box match the reference (287 px differ at 10% fuzz in a 700x140 crop, anti-aliasing) |
| editor/contrib/sectionHeaders | src/vs/editor/contrib | M8 | verified | | `findSectionHeaders` with the upstream tests (editor/section_headers.rs): cargo test -p app section_headers; minimap labels with the `editor.minimap` showRegionSectionHeaders, showMarkSectionHeaders, markSectionHeaderRegex, sectionHeaderFontSize and sectionHeaderLetterSpacing settings (workbench/minimap_view.rs); found on the UI thread per model version, not in the editor worker (port/notes.md milestone 8) |
| editor/contrib/semanticTokens | src/vs/editor/contrib | M13 | verified | | semantic_tokens.rs, workbench/semantic_tokens.rs: cargo test -p app semantic_tokens workbench::semantic_tokens a_language_change_drops_the_tokens_and_asks_again a_setting_change_that_keeps_coloring_on_keeps_the_tokens a_model_shown_again_keeps_its_tokens (tokenStyleResolving, semanticTokensDto, semanticTokensProviderStyling tests); ui-pair f.ts: the readonly `value` is #4FC1FF in both (port/results/language-features.md Semantic tokens and language status) |
-| editor/contrib/smartSelect | src/vs/editor/contrib | M8 | verified | [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. | Expand and Shrink Selection (Ctrl+Shift+Right/Left, Selection menu, palette, `editor.smartSelect.*`) over the word and bracket providers: cargo test -p app smart_select (19, all 14 smartSelect.test.ts cases, #73850 on the whitespace step alone; `getWordAtText` with its 15-char windows and 1000-char cut: the_pattern_word_at); extension `SelectionRangeProvider`s replace the bracket ranges and `_executeSelectionRangeProvider` (workbench/selection_ranges.rs): cargo test -p app selection_ranges (2) |
+| editor/contrib/smartSelect | src/vs/editor/contrib | M8 | verified | | Expand and Shrink Selection (Ctrl+Shift+Right/Left, Selection menu, palette, `editor.smartSelect.*`) over the word and bracket providers: cargo test -p app smart_select (19, all 14 smartSelect.test.ts cases, #73850 on the whitespace step alone; `getWordAtText` with its 15-char windows and 1000-char cut: the_pattern_word_at); extension `SelectionRangeProvider`s replace the bracket ranges and `_executeSelectionRangeProvider` (workbench/selection_ranges.rs): cargo test -p app selection_ranges (2) |
| editor/contrib/snippet | src/vs/editor/contrib | M13 | verified | | editor/snippet_session.rs and workbench/snippet_controller.rs (snippetSession.ts, snippetController2.ts): placeholders per cursor, Tab/Shift+Tab/Escape, choices in the suggest widget, `inSnippetMode`/`hasNextTabstop`/`hasPrevTabstop`/`inSnippetChoice`, placeholder decorations: placeholder and variable transforms with every `FormatString` form (editor/snippet/transform.rs, snippetParser.test.ts cases), `SnippetSession.merge` of a snippet inserted in a running session: cargo test -p app -- snippet (92 passed with tab_completion suggest); api-tests `vscode API - editor` insertSnippet cases pass (port/results/api-tests.md M13) |
| editor/contrib/stickyScroll | src/vs/editor/contrib | M8 | verified | | editor/sticky_scroll.rs, workbench/sticky_outline.rs, workbench/editor_view/sticky_scroll_view.rs: cargo test -p app sticky cmd_over_a_sticky_span_with_definitions_underlines_it go_to_definition_with_location_asks_at_the_span_and_keeps_the_cursor (stickyScroll.test.ts outline cases); pixel-check folded |
| editor/contrib/structuralDiff | src/vs/editor/contrib | M13 | removed | | `_executeStructuralDiffProvider` serves the proposed `structuralDiff` API, which only extension/copilot enables (product.json enables it for no other extension); Copilot is removed by the no-AI decision (port/notes.md Copilot Chat) |
@@ -397,7 +397,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| editor/contrib/symbolIcons | src/vs/editor/contrib | M13 | verified | | symbol_icons.rs: kind icons and `symbolIcon.*` colors; ui-pair suggest rows match the reference; symbol_icons.rs: `SymbolKinds.toIcon`, codicon aliases to their SVG, the `symbolIcon.*Foreground` registry defaults (cargo test -p app symbol_icons); ui-pair against the reference: port/results/navigation.md; `symbol-customcolor` draws symbol-color's glyph (0xeb5c), not add (cargo test -p app codicons::tests::every_icon_id_draws_the_svg_of_its_code_point) |
| editor/contrib/toggleTabFocusMode | src/vs/editor/contrib | M8 | verified | | `editor.action.toggleTabFocusMode` (Ctrl+Shift+M) in `workbench/editor_status.rs`, `editorTabMovesFocus`, the prominent "Tab Moves Focus" status item, Tab and Shift+Tab between the editor and the status bar: cargo test -p app tab_focus; ui-pair notes.txt |
| editor/contrib/tokenization | src/vs/editor/contrib | M7 | verified | | Developer: Force Retokenize (`editor.action.forceRetokenize`): resets the model tokens and tokenizes every line, logging the time (cargo test -p app syntax::tests::force_retokenize_tokenizes_every_line_again) |
-| editor/contrib/unicodeHighlighter | src/vs/editor/contrib | M8 | verified | [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. | editor/unicode_highlighter.rs (unicodeTextModelHighlighter.ts, strings.ts confusables and invisibles), workbench/unicode_highlight.rs (marks, banner past 1000), the three Disable actions: cargo test -p app unicode_highlighter, cargo test -p app theme::; ui-pair marks and banner match; hover reason (ordinal 5, one part per reason) and the Adjust settings exclude options (editor.action.unicodeHighlight.showExcludeOptions): cargo test -p app unicode_highlight content_hover; ui-pair /tmp/m8uni uni.ts: the reason hover below line 1 with the same text, wrapped on two lines as the reference (the port's widget 36 px wider, editor/contrib/hover row); `inUntrustedWorkspace` follows workspace trust (`resolveOptions`): cargo test -p app non_basic_ascii_defaults |
+| editor/contrib/unicodeHighlighter | src/vs/editor/contrib | M8 | verified | | editor/unicode_highlighter.rs (unicodeTextModelHighlighter.ts, strings.ts confusables and invisibles), workbench/unicode_highlight.rs (marks, banner past 1000), the three Disable actions: cargo test -p app unicode_highlighter, cargo test -p app theme::; ui-pair marks and banner match; hover reason (ordinal 5, one part per reason) and the Adjust settings exclude options (editor.action.unicodeHighlight.showExcludeOptions): cargo test -p app unicode_highlight content_hover; ui-pair /tmp/m8uni uni.ts: the reason hover below line 1 with the same text, wrapped on two lines as the reference (the port's widget 36 px wider, editor/contrib/hover row); `inUntrustedWorkspace` follows workspace trust (`resolveOptions`): cargo test -p app non_basic_ascii_defaults |
| editor/contrib/unusualLineTerminators | src/vs/editor/contrib | M8 | verified | | editor/unusual_line_terminators.rs (textModel.ts removeUnusualLineTerminators), workbench/unusual_line_terminators.rs (prompt, auto, off, Ignore per resource, no check after undo): cargo test -p app unusual_line_terminators; ui-pair prompt and removal |
| editor/contrib/wordHighlighter | src/vs/editor/contrib | M13 | verified | | textual provider on cursor move with the language's `wordPattern`, stops on editor widget blur (cargo test -p app editor::tests word highlight, the_word_highlight_takes_the_language_word_pattern, the_word_highlight_stops, the_banner_action); DocumentHighlightProviders (workbench/document_highlights.rs): first answer in score order, `editor.occurrencesHighlightFromAllProviders` merge, Text/Read/Write colors and overview ruler lanes, `_executeDocumentHighlights` (cargo test -p app document_highlights: wordHighlighter.test.ts provider cases); ui-pair against the reference: port/results/navigation.md; the focus a quick input gives back runs the query 50 ms later (`runDelayer`) even when the picked command shows another quick input (cargo test -p app the_word_highlight_stops; ui-pair m12/compare.json `compare-with-picker`). |
| editor/contrib/wordOperations | src/vs/editor/contrib | M5 | verified | | editor/word_operations.rs ports cursorWordOperations.ts (WordOperations, WordPartOperations, `editor.wordSeparators`, `editor.wordSegmenterLocales` through ICU word segments, the auto-closing pair delete) with the 16 move, 8 delete and Delete Word commands: cargo test -p app word_operations (43 passed: every wordOperations.test.ts and wordPartOperations.test.ts case) |
diff --git a/port/notes.md b/port/notes.md
index 50b5f3e5962..c15ebc78cf4 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -1006,3 +1006,10 @@ GPUI or Rust std limits Artur accepted as differences from 1.147.0; one line eac
- GPUI's line wrapper counts a trailing space before a break where Chrome hangs it: the editor placeholder's 450px max width is 454px (editor_placeholder.rs), so a 450 to 454px line without a space there stays unwrapped.
- GPUI has no CPU glyph raster: minimap scales 2 and 3 stretch the prebaked scale 2 table where upstream downsamples the bold 16px editor font (minimap.rs `CharRenderer::create`).
- No focusable synthetic accessibility nodes: Read Line with Inlay Hints announces through the live region, not a focused aria element (inlay_hints_accessibility.rs).
+
+## Scheduling differences
+
+Work the port does at another time than 1.147.0, accepted with a measured same result and typing on a 50k-line TS file under 16 ms per edit. The check, on the Studio in release: `cargo gc test --release -p app -- --ignored typing_latency_on_a_large_file --nocapture` (52156 lines of textModel.ts; each edit is one typed char, the tokens of 60 lines in view, the bracket match, the section headers and the unicode highlights). Measured on worktree-m8-scheduling: median 10.98, 11.62 and 12.45 ms per edit at lines 100, 25000 and 49000, max 13.74 ms.
+- Section headers (sectionHeaders.ts) and unicode highlights (unicodeHighlighter.ts `DocumentUnicodeHighlighter`) are found on the UI thread for each model version (minimap_view.rs `minimap_section_labels`, unicode_highlight.rs `unicode_highlights`), where upstream asks the editor worker 250 ms after the last edit and moves the old decorations with the text meanwhile. Same result once upstream's 250 ms pass: the same finders run on the same text, and the section headers read the tokens the lines have (`getLineTokens`, `stored_token_type_at`), found again at most once a second while new tokens arrive (`onDidChangeModelTokens`). Both run inside each edit of the typing check.
+- Smart select's bracket ranges (bracketSelections.ts) scan to the document's ends in one go (smart_select.rs `bracket_ranges`), where upstream yields after `_maxDuration` (30 ms) and stops the right scan after 2 rounds. The scan takes 8.13 to 8.35 ms on the 52k-line file, so upstream's scan ends in its first round with the same ranges; upstream's smartSelect.test.ts raises `_maxDuration` to 5 s for that full scan. The typing check gates the scan under 30 ms.
+- Ported instead (they changed the result): the minimap's sticky sampling (`MinimapSampling::compute` with the last state, `on_lines_deleted`, `on_lines_inserted`, replayed from the model's edit log while view lines are model lines; with word wrap or folds the state is not moved through the edits, an open class 3 gap on the editor/browser row), and `tokenizeIfCheap` and `hasAccurateTokensForLine` in the comment commands and trim trailing whitespace (the action and the save participant). Trim on a file just opened took 6.8 s and comment at line 49000 5.3 s, tokenizing the file; now 3.87 and 14.14 ms, gated under 16 ms by the typing check.