Skip to content

Visual Studio Code, rebuilt in Rust

Rust

docs(port): language detection verified, reference source run detects nothing

rokartur05fb5be65450
diff --git a/README.md b/README.md
index c3d05a1d6e4..444c4a68a95 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,8 @@ Coverage of VS Code 1.147.0, from [port/ledger.md](port/ledger.md) (586 rows). V
```mermaid
pie showData
- "verified" : 413
- "ported" : 19
+ "verified" : 414
+ "ported" : 18
"removed" : 126
"n/a" : 28
```
@@ -23,7 +23,7 @@ pie showData
| src/vs/platform | 69 | 0 | 30 | 13 | `████████████████████ 100%` |
| built-in extension | 87 | 2 | 6 | 0 | `████████████████████ 98%` |
| MainThread* shape (Rust side) | 59 | 0 | 30 | 0 | `████████████████████ 100%` |
-| workbench service | 62 | 3 | 23 | 7 | `███████████████████░ 95%` |
+| workbench service | 63 | 2 | 23 | 7 | `███████████████████░ 97%` |
| src/vs/editor/contrib | 53 | 1 | 2 | 1 | `████████████████████ 98%` |
| workbench part | 9 | 2 | 2 | 0 | `████████████████░░░░ 82%` |
| extension host seam | 7 | 0 | 0 | 0 | `████████████████████ 100%` |
@@ -31,7 +31,7 @@ pie showData
| src/vs/editor | 0 | 2 | 1 | 1 | `░░░░░░░░░░░░░░░░░░░░ 0%` |
| src/vs/base | 0 | 0 | 2 | 3 | `████████████████████ 100%` |
| port feature | 1 | 0 | 0 | 0 | `████████████████████ 100%` |
-| **all** | **413** | **19** | **126** | **28** | `███████████████████░ 96%` |
+| **all** | **414** | **18** | **126** | **28** | `███████████████████░ 96%` |
<!-- coverage:end -->
`removed` are parts left out by decision: AI features, Microsoft services, telemetry, remote and tunnels ([port/notes.md](port/notes.md)). `n/a` are upstream test infrastructure and the Electron process, IPC and DOM layers the native architecture replaces.
diff --git a/port/ledger.md b/port/ledger.md
index 30e5d093a30..c8a701d5d5c 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -405,7 +405,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| workbench/services/keybinding | workbench service | M9 | verified | | Registered commands with `args` metadata are not unbound (the reference's `commandsWithArgs`): keybindings_editor::tests::registered_commands_with_args_metadata_are_not_unbound; keyboard.rs: default-macos.json, contributes.keybindings, keybindings.json reload on a file watcher change after 50 ms (keyboard::tests::an_outside_edit_of_keybindings_json_applies), the troubleshooting log's `keyCode` as `EVENT_KEY_CODE_MAP` inverted (output_view tests), chords with the status bar message, scan code dispatch on the layout's keyboard mapper (`_resolveKeybindingItems`, `keyboard.dispatch`, `keyboard.mapAltGrToCtrlAlt`); cargo test -p app keybindings user_keybindings keyboard_mapper define_keybinding; pixel-check chord; Studio run with the mapper (port/results/keybindings-layout.md); keyboard.rs: default-macos.json, contributes.keybindings, keybindings.json reload, chords with the status bar message; cargo test -p app keybindings user_keybindings; pixel-check chord |
| workbench/services/label | workbench service | M12 | verified | | file scheme getUriLabel in quick_input.rs path_label and path_label_without_prefix (label.test.ts file scheme, multi-root and explicit separator cases: cargo test -p app path_labels copied_path_labels), tildify (search_view.rs), workspace labels (cargo test -p config labels_a_workspace_file_by_its_name); formatters and URI homes only come from remote resolvers (MainThreadLabelService removed); verified at port-m12b-verify: cargo test -p app path_labels 2/2 |
| workbench/services/language | workbench service | M7 | verified | | getAssociationByPath with the full glob dialect (languages::tests::file_patterns_take_the_whole_glob_dialect) plus firstLine detection (languages.rs); cargo test -p app languages::tests |
-| workbench/services/languageDetection | workbench service | M13 | ported | [3 S] workbench/language_detection.rs: 4 s after typing a Python snippet into a new untitled editor (Cmd+N in a ui-pair run, hc) the port's language entry shows Python, the reference's still Plain Text, also after 12 s; not yet known whether the reference build lacks the detection model or the port detects where upstream does not | language_detection.rs (languageDetectionWebWorker.ts `detectLanguagesImpl`, `adjustLanguageConfidence`, the 10000 char sample) and workbench/language_detection.rs (`LanguageDetectionWorkerClient`: the file name guess first, then @vscode/vscode-languagedetection 1.0.23 with its model in a Bun worker from the app's node_modules, model ids mapped as `getLanguageId`; `autoDetectLanguage` of textEditorModel.ts for untitled models and extensionless plain text files, 600 ms throttle, skipped after an explicit language and with `workbench.editor.languageDetection` off): cargo test -p app language_detection (the worker test runs the real model). The history biases only feed the regexp model, which 1.147.0 does not ship (`vscode-regexp-languagedetection` is not a dependency), so neither side has it; no telemetry |
+| workbench/services/languageDetection | workbench service | M13 | verified | | language_detection.rs (languageDetectionWebWorker.ts `detectLanguagesImpl`, `adjustLanguageConfidence`, the 10000 char sample) and workbench/language_detection.rs (`LanguageDetectionWorkerClient`: the file name guess first, then @vscode/vscode-languagedetection 1.0.23 with its model in a Bun worker from the app's node_modules, model ids mapped as `getLanguageId`; `autoDetectLanguage` of textEditorModel.ts for untitled models and extensionless plain text files, 600 ms throttle, skipped after an explicit language and with `workbench.editor.languageDetection` off): cargo test -p app language_detection (the worker test runs the real model). The history biases only feed the regexp model, which 1.147.0 does not ship (`vscode-regexp-languagedetection` is not a dependency), so neither side has it; no telemetry. The reference checkout's worker detects nothing (Detect Language from Content: "Unable to detect editor language" on a typed Python snippet) while its own model in node gives py 0.33, which `detectLanguagesImpl` yields; the port shows Python (port/notes.md milestone 13 finding) |
| workbench/services/languageStatus | workbench service | M13 | verified | | `$setLanguageStatus` / `$removeLanguageStatus`, statuses matched by selector, ordered by severity, source, id (workbench/language_status.rs): cargo test -p app language_status |
| workbench/services/layout | workbench service | M11 | ported | [3 S] terminal_view.rs:1235: with Tab Focus Mode on, Tab in the terminal goes to the shell, where terminalInstance.ts:1204 leaves it to the browser's Tab order (port/notes.md Toggle Tab Key Moves Focus) <br> [3 S] action_bar.rs:45: an action bar item focused by Tab shows no hover, where the reference shows the command center's and Customize Layout's tooltips on focus, and the activity bar item's focus outline has square corners where the reference's are rounded (ui-pair Tab steps, port/notes.md Toggle Tab Key Moves Focus) <br> [3 L] workbench.rs:591: the Workbench is one GPUI view, so every scroll frame of any list renders and lays out every part again, where upstream's DOM updates only the scrolled list; the side bar, the editor area, the panel, the status bar, the activity bar and the title bar are cached part views (part_view.rs: a list scroll notifies only the view it was painted in, an editor scroll only the editor area's, a size measured while drawing redraws its view after the frame; the status bar gave no measurable change), the secondary side bar still renders with the Workbench; the Explorer's rows are absolutely placed 22px boxes as listView.ts's (workbench.rs Explorer rows; ~70% of the Explorer frame was the taffy layout of its rows in flow); the minimap copies unchanged rows from the last frame (minimap.rs `render_lines`) and the menu bar updates 200 ms after a frame as menubarControl.ts `menuUpdater` does; a folder with a sub-second mtime is cached 100 ms after its last change, not 2 s (explorer.rs `entries`: the Editor's first 1.5 s of frames re-read the fixture's 800-file root on each `key_context` call, port/notes.md Scroll frame costs, the Editor's slow start); `scroll_frame_time` median / p95 (two interleaved runs, the Studio shared): Explorer 2.9 / 3.2 and 2.9 / 3.6 ms (rows in flow: 10.9 / 18.6 and 11.0 / 21.4), Editor 6.9 / 7.7 and 6.9 / 7.5 ms, Settings 1.1 / 1.4 and 1.0 / 1.4 ms, Extensions 1.7 / 2.0 and 1.7 / 1.9 ms, every surface under the 8 ms gate headless (NoopTextSystem). GUI (release app on the Studio host desktop, the same folder, a scratch CGEvent probe posting 30px continuous scroll events at about 100 Hz, main thread sampled 5 s): scrolling the Editor keeps the main thread 91% in `Window::draw` (idle 5%): `text_editor_part` 38%, the Workbench root rendering again each frame 10% (headless only the editor area draws), CoreText `shape_text` 9%, taffy `compute_layout` 13%, `key_context` 14%; the Explorer, Extensions and Settings runs did not reach their lists (no screenshot over ssh to aim the probe), so they are not measured. Each `key_context` call (two per editor frame: floating_menu.rs:72 and the editor title actions, 12% of the frame) clones every `config.*` key (3%, keyboard.rs:409) and lists every Explorer row for the focused row's keys (explorer_actions.rs:311, 3%). GUI (Studio at load 33 to 57, 60 Hz display, 690 trackpad events in 7 s): main thread in `Window::draw` 86% scrolling the Explorer (800 files), 89% the Extensions @builtin list (port/notes.md Scroll frame costs) | layout.ts as a split-view tree (workbench/layout.rs): panel position (bottom, top, left, right) and alignment, primary side bar left or right, maximized panel with `panelMaximizationSupportedWhen`, hidden parts, persisted sizes and positions; zen mode (zen_mode.rs) with its settings and restore; centered layout (centered_layout.rs) with its sashes and stored margins; View > Appearance entries and the Panel Position and Align Panel submenus (cargo test -p app -- layout part_grid centered_layout zen_mode); layoutActions.ts Customize Layout quick pick (workbench/customize_layout.rs) with live items, Restore Defaults and Close, Toggle Activity Bar Visibility, Align Quick Input Top/Center (cargo test -p app -- customize_layout toggling_the_activity_bar; ui-pair m11/manage-menu.json, port/results/manage-menu.md; missing until then though the title bar showed its button); ui-pair layout-positions.json and layout-zen.json against the reference (port/results/layout.md). The pairs run with `zenMode.fullScreen` off. Maximize Secondary Side Bar (`workbench.action.maximizeAuxiliaryBar`, `restoreAuxiliaryBar`, `toggleMaximizedAuxiliaryBar`, the title's toggle) hides the other parts and restores them (workbench/panel.rs; cargo test -p app -- maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back). Zen mode enforces `zenMode.showTabs` on the main editor part until it ends (layout.ts `toggleZenMode` `enforcePartOptions`; workbench/zen_mode.rs `editor_show_tabs`; cargo test -p app -- show_tabs_picks_the_title_control_and_zen_mode_enforces_its_own); navigationActions.ts `workbench.action.focusNextPart`/`focusPreviousPart` (F6, Shift+F6) walk editor, panel, auxiliary bar, status bar, activity bar and side bar past the hidden ones with layout.ts `focusPart` (the pane container's first expanded view; workbench/part_navigation.rs; cargo test -p app f6_walks_the_visible_parts); in an editor window F6 goes between its editor and its own status bar, whose entry focus is kept per window (workbench/auxiliary_windows.rs `auxiliary_status_bar`, workbench/status_entries.rs; cargo test -p app f6_in_an_editor_window_reaches_its_own_status_bar) |
| workbench/services/lifecycle | workbench service | M11 | verified | | `describeEditors` names the upstream input's `typeId` and differing `editorId`, and `workbench.floatingWindowNotRestorable` blocks while the process explorer, the port's one window that is no editor part, is open (upstream's is an editor in an auxiliary window): cargo test -p app blockers_name_the_editor_kind_and_the_window_that_does_not_come_back; workbench/lifecycle.rs: ShutdownReason, onBeforeShutdown vetoes on quit, close button, closeWindow, reload and load (`window.confirmBeforeClose`, backup tracker auto save, hot exit, showSaveConfirm); cargo test -p app lifecycle; no phases or onWillShutdown joiners; workbench/unattended_restart.rs: `canRestartUnattended` with its blocker aggregation and change log, and the participants `workbench.starting` (2.5 s after restore), dialog, quick input, transient workspace, modal editor, editors not restored or not restorable, `debug.sessionActive`, `tasks.running`, the backup tracker's `workingCopy.*` and `cli.waitingForEditorClose`, terminalUnattendedRestart.ts with childProcessMonitor.ts `hasChildProcesses` (terminal/pty.rs, background jobs included: cargo test -p app a_background_job_is_a_child_process_of_the_shell), testingUnattendedRestart.ts, `testing.continuousRun`, webviewUnattendedRestart.ts and notebookUnattendedRestart.ts: cargo test -p app unattended_restart (unattendedRestart.test.ts, terminalUnattendedRestart.test.ts, testingUnattendedRestart.test.ts); update/unattended_restart.rs: unattendedRestartScheduler.ts's decisions (keep awake from the lock, restart once locked a minute, retry every minute, veto, a newer update postponing, battery and thermal pressure, resume restarting the clock, the update not installed last time) over injected time: cargo test -p app update::unattended_restart (13 of unattendedRestartScheduler.test.ts's cases, without the telemetry outcomes the port does not send); workbench/unattended_restart.rs `UnattendedRestart`: the scheduler's host on macOS (power events, window blur, update state, timers, the `prevent-app-suspension` blocker, `quitAndInstall` from a window), `getWindowBlockers` (`window.launchArguments` and `window.launchedFromCli` from the command line that opened the window, a second instance's `VSCODE_CLI` sent with its arguments), `hasArgumentsLostOnRelaunch`, `app.launchedFromCli`, `app.dialogOpen` (dialog.rs `has_open_dialogs`: the NSAlert sheets and the open and save panels) and the failed update remembered across the restart: cargo test -p app unattended_restart (a_locked_screen_keeps_the_machine_awake, windows_that_do_not_come_back_as_they_are_block, launch_arguments_the_relaunch_drops_block, a_restart_that_came_back_on_the_same_commit_failed_to_install); windows_state.rs `setNextExactRestore`/`takeExactRestore` (minimized windows, hidden app): cargo test -p app windows_state; verified: cargo test -p app backup_tracker lifecycle (workingCopyBackupTracker.test.ts); ui-pair hot-exit.json `dirty`, `restored` vs the reference (port/results/windows.md, milestone 11 verification) |
diff --git a/port/notes.md b/port/notes.md
index 8ad937e6b6f..4abbb131e74 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -573,7 +573,7 @@ Scope (roadmap section 13): diagnostics, hover, completion, go to definition and
2. Done: injected text, inlay hints, color decorators and pickers (entries above).
3. Done: inline completions from extensions (entry above). Left: `workbench/contrib/inlayHints` (Start/Stop Reading Line With Hint, inlayHintsAccessibilty.ts, over the AccessKit live region).
4. Done: Problems (`workbench/contrib/markers`). MarkersFileDecorations (`decorations.rs` `MARKERS_PROVIDER`, a synchronous provider whose data `set` fills; `DecorationData.weight`, 100 x severity, sorts it before extension data at 10). The filter box (`workbench/view_filter.rs`, viewFilter.ts `FilterWidget`, shared with the Output view: the "Showing N of M" badge while focused, the More Filters menu checked when a filter is off its default) with `markers_filter.rs` (markersFilterOptions.ts: `@source:` filters, include and `!` exclude globs, `files.exclude` per folder for Hide Excluded Files, fuzzy text on file names, messages, source and code with highlights, negation as markersTreeViewer.ts `Filter`); Show Errors/Warnings/Infos, Show Active File Only, Hide Excluded Files; Clear Filters; Cmd+F, Cmd+Down, Escape on the filter; the state in the `workbench.panel.markers` workspace memento. Related information rows under their marker with a twistie, multi-line messages with the per-row chevron and Show message in multiple/single lines. View as Table / View as Tree (`workbench/problems_table.rs`, markersTable.ts columns and sort; `problems.defaultViewMode`). Quick fixes (`workbench/problems_quick_fix.rs`): a hovered row asks its marker's quick fixes after 300 ms, the light bulb replaces the severity icon, a click lists them, running one opens the file and applies. shortcuts in the code: no row focus (no Cmd+. or Enter on rows), no column sashes, fixes only for open models. Tests: `cargo test -p app markers_filter problems_view problems_table`.
- 5. Done: language detection (`language_detection.rs`, `workbench/language_detection.rs`): @vscode/vscode-languagedetection in a Bun worker (`bun --eval` of `language_detection/worker.mjs`, JSON lines on stdin and stdout) loaded from the app's node_modules (`port/tools/package-app` copies it); the auto-detect of untitled and extensionless plain text models, the status light bulb, `editor.detectLanguage` and Auto Detect. The regexp model is not in 1.147.0's dependencies, so the history biases have nothing to feed. shortcut in the code: only edits of the active editor trigger the detection.
+ 5. Done: language detection (`language_detection.rs`, `workbench/language_detection.rs`): @vscode/vscode-languagedetection in a Bun worker (`bun --eval` of `language_detection/worker.mjs`, JSON lines on stdin and stdout) loaded from the app's node_modules (`port/tools/package-app` copies it); the auto-detect of untitled and extensionless plain text models, the status light bulb, `editor.detectLanguage` and Auto Detect. The regexp model is not in 1.147.0's dependencies, so the history biases have nothing to feed. shortcut in the code: only edits of the active editor trigger the detection. Finding: the reference checkout (unbuilt, run from source) detects nothing. A typed Python snippet stays Plain Text after 14 s, and Detect Language from Content (Shift+Alt+D) answers "Unable to detect editor language", though its `node_modules/@vscode/vscode-languagedetection` has the model and that model in node gives `py` 0.33 over `hs` 0.07, which `detectLanguagesImpl` yields (0.38 after the bucket 1 correction, 0.31 ahead). So the worker of the source run fails to load the model; `vscode-regexp-languagedetection` is also missing there, as in 1.147.0's dependencies. The port follows the code, not that run.
6. Done: snippet actions (`workbench/snippet_actions.rs`: Insert Snippet, Surround With, Fill File with Snippet, Configure Snippets, the snippet code actions), Tab completion (`workbench/tab_completion.rs`), Emmet Expand Abbreviation (`workbench/emmet.rs`), code actions on save (`workbench/code_actions/on_save.rs`, `editor.codeActionsOnSave` schema per provided source kind), Read Line with Inlay Hints (`workbench/inlay_hints_accessibility.rs`), `$tokensAtPosition`, the Outline title actions (`workbench/outline_actions.rs`: Collapse/Expand All, Follow Cursor, Filter on Type as stored state only, Sort By; `outline/state`), the outline rebuilt when a symbol provider registers. Comments (`workbench/comments.rs`, `workbench/comments_view.rs`, `workbench/editor_view/comment_glyph.rs`): controllers and threads from `MainThreadComments`, the Comments panel (hideIfEmpty) and the gutter glyph. The comment thread widget (`workbench/comment_thread_widget.rs`): a zone per expanded thread in every editor of its resource, resized from the comment count (body lines taken as 18px, `shortcut:`), the glyph toggles it, replies run the `comments/commentThread/context` items with the `CommentThreadReply` argument (`$mid` 9, the thread as `$mid` 7), Cmd+Enter runs the first; the reply is a single-line input box in the editor frame. The Comments panel gained the filter box (Show Resolved/Unresolved, Sort By, stored in `memento/commentsViewState`), Collapse/Expand All, row selection and the unresolved badge. `_executeFoldingRangeProvider` (`workbench/folding_providers.rs`) made the `vscode API - languages` api-tests pass (7 of 7). Extension selection range providers (`workbench/selection_ranges.rs`) are asked once per Expand from a new selection; their ranges replace the bracket ones (`providers.length === 1`). Left: comment edit mode, reactions and comment menus, commenting ranges, Filter on Type in the outline tree (explorer_find.rs generalised), dropOrPasteInto, inlineProgress, the language feature extension rows.
## Milestone 11: workbench layout and chrome (in progress)