Skip to content

Visual Studio Code, rebuilt in Rust

Rust

perf(editor): tokenize a far viewport from a guessed start state

rokartur4e78c3ea572d
diff --git a/native/crates/app/src/syntax.rs b/native/crates/app/src/syntax.rs
index 399e2a16091..e2f7fbb4720 100644
--- a/native/crates/app/src/syntax.rs
+++ b/native/crates/app/src/syntax.rs
@@ -107,6 +107,9 @@ struct TokenStore {
/// tokens change.
brackets: Vec<Option<Vec<LineBracket>>>,
plain_brackets: Vec<Option<Vec<LineBracket>>>,
+ /// abstractSyntaxTokenBackend.ts `AttachedViewHandler._computedLineRanges`: the lines in view last tokenized, and
+ /// whether their tokens were guessed.
+ viewport: Option<(usize, usize, bool)>,
}
impl TokenStore {
@@ -118,6 +121,7 @@ impl TokenStore {
self.invalid.add_range(0..line_count);
self.brackets = vec![None; line_count];
self.plain_brackets = vec![None; line_count];
+ self.viewport = None;
}
/// `setEndState`: an end state that changed makes the next line's end state untrusted.
@@ -138,14 +142,12 @@ impl Tokenization {
/// The token styles of line `index` over its tab-expanded text, brackets in their pair colors
/// (`editor.bracketPairColorization.enabled` defaults on); none without a grammar.
- // shortcut: tokenizes from the first untrusted line down to this one, where upstream's `tokenizeViewport` guesses a
- // start state above the viewport (`tokenizeHeuristically`); upgrade when scrolling far before the background is done stalls.
pub fn highlights(&self, theme: &Theme, languages: &Languages, lines: &[String], index: usize, tab_size: usize) -> Vec<(Range<usize>, HighlightStyle)> {
if self.grammar.is_none() {
return Vec::new();
}
let brackets = self.brackets(theme, languages, lines);
- self.tokenize_to(lines, index);
+ self.tokenize_for_view(lines, index);
let tokenized = self.lines.borrow();
let highlights = token_highlights(&theme.tokens, &lines[index], &tokenized.tokens[index], tab_size);
let expanded_offset = expanded_offsets(&lines[index], tab_size);
@@ -184,7 +186,7 @@ impl Tokenization {
if self.grammar.is_none() {
return default_run;
}
- self.tokenize_to(lines, index);
+ self.tokenize_for_view(lines, index);
let tokenized = self.lines.borrow();
let tokens = &tokenized.tokens[index];
if tokens.is_empty() {
@@ -201,7 +203,7 @@ impl Tokenization {
return starts;
}
let brackets = self.brackets(theme, languages, lines);
- self.tokenize_to(lines, index);
+ self.tokenize_for_view(lines, index);
let tokenized = self.lines.borrow();
let mut previous = None;
let mut start = 0;
@@ -360,6 +362,7 @@ impl Tokenization {
if store.tokens.is_empty() {
return;
}
+ store.viewport = None;
store.tokens.splice(start + 1..=end, (1..new_line_count).map(|_| Vec::new()));
store.end_states.splice(start..end, (1..new_line_count).map(|_| None));
store.invalid.add_range_and_resize(start..end + 1, new_line_count);
@@ -426,6 +429,54 @@ impl Tokenization {
DocumentBrackets::from_lines(&found, document_end)
}
+ /// tokenizerSyntaxTokenBackend.ts `refreshRange` for lines `first..=last` in view, once per range
+ /// (`AttachedViewHandler.update`).
+ pub fn tokenize_viewport(&self, lines: &[String], first: usize, last: usize) {
+ if self.grammar.is_none() || lines.is_empty() {
+ return;
+ }
+ let last = last.min(lines.len() - 1);
+ if self.synced(lines).viewport.is_some_and(|(computed_first, computed_last, _)| (computed_first, computed_last) == (first, last)) {
+ return;
+ }
+ let guessed = self.tokenize_heuristically(lines, first, last);
+ self.lines.borrow_mut().viewport = Some((first, last, guessed));
+ }
+
+ /// textModelTokens.ts `tokenizeHeuristically`: lines in view past the first untrusted one get tokens from a
+ /// guessed start state, and the background tokenizes them again (`requestTokens`); true then.
+ fn tokenize_heuristically(&self, lines: &[String], first: usize, last: usize) -> bool {
+ let first_invalid = self.synced(lines).invalid.min().unwrap_or(usize::MAX);
+ if last <= first_invalid {
+ return false;
+ }
+ if first <= first_invalid {
+ self.tokenize_to(lines, last);
+ return false;
+ }
+ let grammar = self.grammar.as_ref().expect("checked by the caller");
+ let mut store = self.synced(lines);
+ let mut state = guess_start_state(grammar, &store, lines, first);
+ for line in first..=last {
+ let (tokens, end_state) = tokenize_text(grammar, lines, line, state.as_ref());
+ store.tokens[line] = tokens;
+ store.brackets[line] = None;
+ store.plain_brackets[line] = None;
+ state = Some(end_state);
+ }
+ store.invalid.add_range(first..last + 1);
+ true
+ }
+
+ /// The view's reads: tokenizerSyntaxTokenBackend.ts `getLineTokens` takes the tokens as they are while the lines
+ /// in view hold guessed ones, else the lines up to `index` are tokenized.
+ fn tokenize_for_view(&self, lines: &[String], index: usize) {
+ if self.synced(lines).viewport.is_some_and(|(_, _, guessed)| guessed) {
+ return;
+ }
+ self.tokenize_to(lines, index);
+ }
+
/// `updateTokensUntilLine`: tokenizes each line with an untrusted end state up to line `index`.
fn tokenize_to(&self, lines: &[String], index: usize) {
let mut store = self.synced(lines);
@@ -485,22 +536,11 @@ impl Tokenization {
fn tokenize_line(&self, store: &mut TokenStore, lines: &[String], line: usize) {
let grammar = self.grammar.as_ref().expect("tokenized with a grammar");
- let text = &lines[line];
let previous = match line {
0 => None,
_ => Some(store.end_states[line - 1].as_ref().expect("a line before the first untrusted one has its end state")),
};
- let result = if text.encode_utf16().count() > MAX_TOKENIZATION_LINE_LENGTH {
- None
- } else {
- // A grammar regex Oniguruma cannot run leaves the line without tokens, as nullTokenize does upstream.
- grammar.tokenize_line(text, previous).map_err(|error| eprintln!("tokenizing line {}: {error}", line + 1)).ok()
- };
- let (tokens, state) = match (result, previous) {
- (Some(entry), _) => entry,
- (None, Some(state)) => (Vec::new(), state.clone()),
- (None, None) => (Vec::new(), grammar.tokenize_line("", None).expect("an empty line tokenizes").1),
- };
+ let (tokens, state) = tokenize_text(grammar, lines, line, previous);
store.tokens[line] = tokens;
store.brackets[line] = None;
store.plain_brackets[line] = None;
@@ -508,6 +548,55 @@ impl Tokenization {
}
}
+/// `safeTokenize` of line `line` after `previous` (none at the grammar's start): a line longer than
+/// `MAX_TOKENIZATION_LINE_LENGTH` gets no tokens and passes the state through.
+fn tokenize_text(grammar: &Grammar, lines: &[String], line: usize, previous: Option<&State>) -> (Vec<Token>, State) {
+ let text = &lines[line];
+ let result = if text.encode_utf16().count() > MAX_TOKENIZATION_LINE_LENGTH {
+ None
+ } else {
+ // A grammar regex Oniguruma cannot run leaves the line without tokens, as nullTokenize does upstream.
+ grammar.tokenize_line(text, previous).map_err(|error| eprintln!("tokenizing line {}: {error}", line + 1)).ok()
+ };
+ match (result, previous) {
+ (Some(entry), _) => entry,
+ (None, Some(state)) => (Vec::new(), state.clone()),
+ (None, None) => (Vec::new(), grammar.tokenize_line("", None).expect("an empty line tokenizes").1),
+ }
+}
+
+/// textModelTokens.ts `guessStartState` with `findLikelyRelevantLines`: the lines above `line` each less indented
+/// than the one below, up to one whose start state is known, tokenized from that state; none is the grammar's start.
+fn guess_start_state(grammar: &Grammar, store: &TokenStore, lines: &[String], line: usize) -> Option<State> {
+ // `getLineFirstNonWhitespaceColumn`: 1-based, 0 for a line of spaces and tabs only.
+ let first_non_whitespace_column = |text: &str| text.find(|char| char != ' ' && char != '\t').map_or(0, |index| index + 1);
+ let mut column = first_non_whitespace_column(&lines[line]);
+ let mut relevant = Vec::new();
+ let mut initial_state = None;
+ for above in (0..line).rev() {
+ if column <= 1 {
+ break;
+ }
+ let above_column = first_non_whitespace_column(&lines[above]);
+ if above_column == 0 || above_column >= column {
+ continue;
+ }
+ relevant.push(above);
+ column = above_column;
+ // `getStartState`: line 0 starts in the grammar's start state, another after the end state above it.
+ let start_state = if above == 0 { Some(None) } else { store.end_states[above - 1].as_ref().map(Some) };
+ if let Some(start_state) = start_state {
+ initial_state = start_state.cloned();
+ break;
+ }
+ }
+ let mut state = initial_state;
+ for &relevant_line in relevant.iter().rev() {
+ state = Some(tokenize_text(grammar, lines, relevant_line, state.as_ref()).1);
+ }
+ state
+}
+
/// The non-transparent `editorBracketHighlight.foreground1..6`, the colors levels cycle through.
fn bracket_colors(theme: &Theme) -> Vec<Hsla> {
(1..=6).filter_map(|n| theme.color(&format!("editorBracketHighlight.foreground{n}"))).filter(|color| color.a > 0.).map(Into::into).collect()
@@ -659,6 +748,26 @@ mod tests {
assert_eq!(tokens.line_tokens(&lines, 2).iter().find(|(_, token_type, _)| *token_type == textmate::StandardTokenType::Comment), None);
}
+ /// textModelTokens.ts `tokenizeHeuristically`: lines in view far below the tokenized ones get their tokens from a
+ /// state guessed from the less indented lines above, without the lines between; the background tokenizes them again.
+ #[test]
+ fn lines_in_view_past_the_tokenized_ones_are_tokenized_from_a_guessed_state() {
+ let extensions = exthost::scan::scan_builtin_extensions(&Path::new(env!("VSCODE_SRC")).join("extensions")).unwrap();
+ let languages = Languages::new(&extensions);
+ let lines: Vec<String> = (0..5000).flat_map(|index| [format!("class C{index} {{"), " run() {".into(), " return `a${b}`;".into(), " }".into(), "}".into()]).collect();
+ let scopes = |tokens: &Tokenization, line: usize| tokens.lines.borrow().tokens[line].iter().map(|token| token.scopes.names().join(" ")).collect::<Vec<_>>();
+ let accurate = Tokenization::new(languages.grammars.grammar("typescript"));
+ accurate.tokenize_to(&lines, 20_060);
+ let mut tokens = Tokenization::new(languages.grammars.grammar("typescript"));
+ tokens.tokenize_viewport(&lines, 20_002, 20_060);
+ assert_eq!(tokens.lines.borrow().invalid.min(), Some(0), "the lines above the view are left to the background");
+ assert_eq!(scopes(&tokens, 20_002), scopes(&accurate, 20_002), "the guessed state is the class's method body");
+ assert!(tokens.highlights(&load_theme(&extensions, "Dark Modern").unwrap(), &languages, &lines, 100, 4).is_empty(), "the view reads the tokens as they are");
+ while tokens.tokenize_in_background(&lines, std::time::Duration::from_secs(1)) {}
+ assert_eq!(tokens.lines.borrow().invalid.min(), None);
+ assert_eq!(scopes(&tokens, 20_060), scopes(&accurate, 20_060));
+ }
+
/// Each line's brackets are found again after an edit to it, and after a retokenizing that changed its tokens.
#[test]
fn a_line_s_brackets_are_read_again_when_its_text_or_tokens_change() {
@@ -699,6 +808,7 @@ mod tests {
let editor = group.active_mut().unwrap();
let frame = |editor: &crate::editor::OpenEditor, line: usize, column: usize| {
let lines = &editor.document().lines;
+ editor.document().tokens.tokenize_viewport(lines, line.saturating_sub(30), line + 29);
for index in line.saturating_sub(30)..(line + 30).min(lines.len()) {
editor.document().tokens.highlights(&theme, &languages, lines, index, 4);
}
diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rs
index 359be5845f7..eb3b225426e 100644
--- a/native/crates/app/src/workbench/editor_view.rs
+++ b/native/crates/app/src/workbench/editor_view.rs
@@ -1662,6 +1662,9 @@ impl Workbench {
pixel_ratio: window.scale_factor(),
};
let cursor_look = if focused { self.focused_cursor_look(editor, layout, window, cx) } else { None };
+ if !range.is_empty() {
+ editor.document().tokens.tokenize_viewport(&editor.document().lines, editor.segment(range.start).line, editor.segment(range.end - 1).line);
+ }
let scroll_left = editor.scroll.left;
let selections = &editor.selections;
let tab_size = editor.document().indentation.tab_size;
diff --git a/port/ledger.md b/port/ledger.md
index da8d1615a26..17707745808 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, 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 M] syntax.rs:135: no `tokenizeHeuristically`, the viewport is tokenized from the first untrusted line: Cmd+Down in a 57k-line TS file while the background tokenizer is at line 13.7k blocks 5.0 s (43,911 lines) <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 M] syntax.rs:135: no `tokenizeHeuristically`, the viewport is tokenized from the first untrusted line: Cmd+Down in a 57k-line TS file while the background tokenizer is at line 13.7k blocks 5.0 s (43,911 lines) <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> [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> [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 lines in view past the tokenized ones tokenized from a guessed start state (`tokenizeHeuristically`: cargo test -p app lines_in_view_past_the_tokenized_ones), 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 |