Skip to content

Visual Studio Code, rebuilt in Rust

Rust

fix(workbench): close the last M27 gaps and the milestone (#74)

Artur Rok3f260b006b57
diff --git a/native/crates/app/src/workbench/accessible_view.rs b/native/crates/app/src/workbench/accessible_view.rs
index 855b3cf4272..2aef6bb2325 100644
--- a/native/crates/app/src/workbench/accessible_view.rs
+++ b/native/crates/app/src/workbench/accessible_view.rs
@@ -376,7 +376,7 @@ impl Workbench {
"Accept suggestion<keybinding:acceptSelectedSuggestion> to accept the currently selected suggestion.",
"Toggle focus between the suggest widget and the editor<keybinding:focusSuggestion> and toggle details focus with<keybinding:toggleSuggestionFocus> to learn more about the suggestion.",
]);
- if self.global_editor_option(&STICKY_SCROLL_ENABLED) {
+ if self.active_editor_option(&STICKY_SCROLL_ENABLED) {
content.push("Focus Sticky Scroll<keybinding:editor.action.focusStickyDebugConsole> to focus the currently nested scopes.");
}
content.push(match self.tab_focus_mode() {
diff --git a/native/crates/app/src/workbench/content_hover.rs b/native/crates/app/src/workbench/content_hover.rs
index 0a0265d5514..3a308f613f3 100644
--- a/native/crates/app/src/workbench/content_hover.rs
+++ b/native/crates/app/src/workbench/content_hover.rs
@@ -284,7 +284,7 @@ impl Workbench {
"on" => true,
"off" => false,
// isTriggerModifierPressed: the modifier `editor.multiCursorModifier` leaves free.
- _ => match self.global_editor_option(&MULTI_CURSOR_MODIFIER) == "alt" {
+ _ => match self.editor_option(editor, &MULTI_CURSOR_MODIFIER) == "alt" {
true => mouse.modifiers.platform,
false => mouse.modifiers.alt,
},
diff --git a/native/crates/app/src/workbench/editor_commands.rs b/native/crates/app/src/workbench/editor_commands.rs
index aa015db9183..6ce6b3e39df 100644
--- a/native/crates/app/src/workbench/editor_commands.rs
+++ b/native/crates/app/src/workbench/editor_commands.rs
@@ -10,7 +10,8 @@ use gpui::{ClipboardItem, Context, Window};
use serde_json::{Value, json};
use super::Workbench;
-use super::model_events::Cursor;
+use super::editor_options::MULTI_CURSOR_MODIFIER;
+use super::model_events::{Cursor, edit_source};
use crate::editor::Reveal;
use crate::commands::Outcome;
use crate::editor::auto_closing::{self, AutoClose};
@@ -291,7 +292,8 @@ impl Workbench {
Outcome::done()
});
self.commands.register("workbench.action.toggleMultiCursorModifier", |workbench, _, _, cx| {
- let next = if workbench.multi_cursor_modifier_is_cmd() { "alt" } else { "ctrlCmd" };
+ // toggleMultiCursorModifier.ts reads `configurationService.getValue('editor')`, no `[lang]` block.
+ let next = if workbench.global_editor_option(&MULTI_CURSOR_MODIFIER) == "ctrlCmd" { "alt" } else { "ctrlCmd" };
workbench.update_setting("editor.multiCursorModifier", json!(next));
cx.notify();
Outcome::done()
@@ -622,7 +624,8 @@ impl Workbench {
fn editor_command_ran(&mut self, change: Option<ContentChanged>, selections_before: Vec<Selection>, cx: &mut Context<Self>) -> Outcome {
let moved = self.editors.active().is_some_and(|editor| editor.selections != selections_before);
self.marked_text = None;
- self.model_content_changed(change, Cursor { moved, source: "keyboard", reveal: Reveal::All }, cx);
+ let source = change.as_ref().map_or("keyboard", |change| edit_source(&change.reason));
+ self.model_content_changed(change, Cursor { moved, source, reveal: Reveal::All }, cx);
Outcome::Ready(Ok(Value::Null))
}
diff --git a/native/crates/app/src/workbench/editor_menus.rs b/native/crates/app/src/workbench/editor_menus.rs
index a2b4974fd9a..3310908edd4 100644
--- a/native/crates/app/src/workbench/editor_menus.rs
+++ b/native/crates/app/src/workbench/editor_menus.rs
@@ -165,7 +165,8 @@ impl Workbench {
/// `ShowContextMenu` (Shift+F10): `MenuId.EditorContext` below the cursor, which stays where it is; not with
/// `editor.contextmenu` off.
pub(super) fn show_editor_context_menu_at_cursor(&mut self, window: &mut Window, cx: &mut Context<Self>) {
- if !self.global_editor_option(&CONTEXTMENU) {
+ let Some(editor) = self.editors.active() else { return };
+ if !self.editor_option(editor, &CONTEXTMENU) {
return;
}
let Some(anchor) = self.cursor_anchor(window) else { return };
@@ -230,7 +231,7 @@ impl Workbench {
/// `_showScrollbarContextMenu`: on the scrollbar or the minimap, the `editor.minimap.*` toggles and choices, each
/// writing its setting; all but Minimap are disabled while the minimap is off. Focus comes back to the editor.
pub(super) fn show_scrollbar_context_menu(&mut self, pointer: Point<Pixels>, window: &mut Window, cx: &mut Context<Self>) {
- let settings = self.minimap_settings();
+ let settings = self.minimap_settings(self.editors.active().expect("the scrollbar shows only with an editor open"));
// diffEditorEditors.ts `_adjustOptionsForSubEditor` turns the minimap off in both sides.
let enabled = settings.enabled && self.editors.active_diff().is_none();
let render_characters = settings.layout.render_characters;
diff --git a/native/crates/app/src/workbench/editor_options.rs b/native/crates/app/src/workbench/editor_options.rs
index cdbab53ac07..52280a9716c 100644
--- a/native/crates/app/src/workbench/editor_options.rs
+++ b/native/crates/app/src/workbench/editor_options.rs
@@ -23,6 +23,15 @@ impl Workbench {
(option.validate)(value.as_ref().unwrap_or(&Value::Null))
}
+ /// `editor_option` of the active code editor, the one `with_group` and `with_code_editor` put under the mouse,
+ /// the find widget and the scroll; without an editor, the configuration's value.
+ pub(super) fn active_editor_option<T>(&self, option: &EditorOption<T>) -> T {
+ match self.editors.active() {
+ Some(editor) => self.editor_option(editor, option),
+ None => self.global_editor_option(option),
+ }
+ }
+
/// `configurationService.getValue` of an editor option outside a code editor: no language override.
pub(super) fn global_editor_option<T>(&self, option: &EditorOption<T>) -> T {
(option.validate)(&self.setting(option.key))
@@ -76,15 +85,23 @@ pub(super) const GUIDES_HIGHLIGHT_ACTIVE_INDENTATION: EditorOption<Value> = Edit
pub(super) const GUIDES_INDENTATION: EditorOption<bool> = EditorOption { key: "editor.guides.indentation", validate: |value| boolean(value, true) };
/// editorConfigurationSchema.ts, a model option: the schema's default.
pub(super) const INSERT_SPACES: EditorOption<bool> = EditorOption { key: "editor.insertSpaces", validate: |value| boolean(value, true) };
+pub(super) const MINIMAP_AUTOHIDE: EditorOption<&str> = EditorOption { key: "editor.minimap.autohide", validate: |value| string_set(value, "none", &["none", "mouseover", "scroll"]) };
pub(super) const MINIMAP_ENABLED: EditorOption<bool> = EditorOption { key: "editor.minimap.enabled", validate: |value| boolean(value, true) };
/// `EditorMinimap.validate`: a pattern that does not compile is the default.
pub(super) const MINIMAP_MARK_SECTION_HEADER_REGEX: EditorOption<String> = EditorOption {
key: "editor.minimap.markSectionHeaderRegex",
validate: |value| value.as_str().filter(|pattern| onig::Regex::new(pattern).is_ok()).unwrap_or(crate::editor::section_headers::MARK_SECTION_HEADER_REGEX).to_string(),
};
+pub(super) const MINIMAP_MAX_COLUMN: EditorOption<usize> = EditorOption { key: "editor.minimap.maxColumn", validate: |value| clamped_int(value, 120, 1, 10000) };
pub(super) const MINIMAP_RENDER_CHARACTERS: EditorOption<bool> = EditorOption { key: "editor.minimap.renderCharacters", validate: |value| boolean(value, true) };
+pub(super) const MINIMAP_SCALE: EditorOption<usize> = EditorOption { key: "editor.minimap.scale", validate: |value| clamped_int(value, 1, 1, 3) };
+pub(super) const MINIMAP_SECTION_HEADER_FONT_SIZE: EditorOption<f64> = EditorOption { key: "editor.minimap.sectionHeaderFontSize", validate: |value| float(value, 9.).clamp(4., 32.) };
+pub(super) const MINIMAP_SECTION_HEADER_LETTER_SPACING: EditorOption<f64> = EditorOption { key: "editor.minimap.sectionHeaderLetterSpacing", validate: |value| float(value, 1.).clamp(0., 5.) };
pub(super) const MINIMAP_SHOW_MARK_SECTION_HEADERS: EditorOption<bool> = EditorOption { key: "editor.minimap.showMarkSectionHeaders", validate: |value| boolean(value, true) };
pub(super) const MINIMAP_SHOW_REGION_SECTION_HEADERS: EditorOption<bool> = EditorOption { key: "editor.minimap.showRegionSectionHeaders", validate: |value| boolean(value, true) };
+pub(super) const MINIMAP_SHOW_SLIDER: EditorOption<&str> = EditorOption { key: "editor.minimap.showSlider", validate: |value| string_set(value, "mouseover", &["always", "mouseover"]) };
+pub(super) const MINIMAP_SIDE: EditorOption<&str> = EditorOption { key: "editor.minimap.side", validate: |value| string_set(value, "right", &["right", "left"]) };
+pub(super) const MINIMAP_SIZE: EditorOption<&str> = EditorOption { key: "editor.minimap.size", validate: |value| string_set(value, "proportional", &["proportional", "fill", "fit"]) };
pub(super) const MOUSE_MIDDLE_CLICK_ACTION: EditorOption<&str> = EditorOption { key: "editor.mouseMiddleClickAction", validate: |value| string_set(value, "default", &["default", "openLink", "ctrlLeftClick"]) };
pub(super) const MOUSE_WHEEL_ZOOM: EditorOption<bool> = EditorOption { key: "editor.mouseWheelZoom", validate: |value| boolean(value, false) };
pub(super) const MULTI_CURSOR_MODIFIER: EditorOption<&str> = EditorOption { key: "editor.multiCursorModifier", validate: |value| string_set(value, "alt", &["ctrlCmd", "alt"]) };
diff --git a/native/crates/app/src/workbench/editor_options/tests.rs b/native/crates/app/src/workbench/editor_options/tests.rs
index 146084b4e8b..433540e5d76 100644
--- a/native/crates/app/src/workbench/editor_options/tests.rs
+++ b/native/crates/app/src/workbench/editor_options/tests.rs
@@ -103,17 +103,14 @@ fn the_allowed_characters_keep_the_true_entries() {
assert_eq!(validate(&UNICODE_HIGHLIGHT_ALLOWED_CHARACTERS, json!("a")), json!({}));
}
-/// textResourceConfigurationService.ts `getValue(resource, position, section)`: a code editor reads its options with
-/// its language's `[lang]` block; outside one the block does not apply.
-#[gpui::test]
-fn a_code_editor_reads_its_language_block(cx: &mut TestAppContext) {
+/// A workbench showing `a.txt` (plaintext) with the user `settings`, in a temporary folder named after `test`.
+fn open_plaintext<'a>(cx: &'a mut TestAppContext, test: &str, settings: &str) -> (gpui::Entity<Workbench>, &'a mut gpui::VisualTestContext, std::path::PathBuf) {
let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();
let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();
let theme = load_theme(&[themes], "Dark Modern").unwrap();
- let dir = std::env::temp_dir().join(format!("code-gpui-editor-options-{}", std::process::id()));
+ let dir = std::env::temp_dir().join(format!("code-gpui-editor-options-{test}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(dir.join("User")).unwrap();
- let settings = r#"{ "editor.renderWhitespace": "none", "editor.guides.indentation": false, "[plaintext]": { "editor.renderWhitespace": "all", "editor.guides.indentation": true } }"#;
std::fs::write(dir.join("User/settings.json"), settings).unwrap();
let file = dir.join("a.txt");
std::fs::write(&file, "a\n").unwrap();
@@ -124,6 +121,15 @@ fn a_code_editor_reads_its_language_block(cx: &mut TestAppContext) {
workbench
});
cx.run_until_parked();
+ (workbench, cx, dir)
+}
+
+/// textResourceConfigurationService.ts `getValue(resource, position, section)`: a code editor reads its options with
+/// its language's `[lang]` block; outside one the block does not apply.
+#[gpui::test]
+fn a_code_editor_reads_its_language_block(cx: &mut TestAppContext) {
+ let settings = r#"{ "editor.renderWhitespace": "none", "editor.guides.indentation": false, "[plaintext]": { "editor.renderWhitespace": "all", "editor.guides.indentation": true } }"#;
+ let (workbench, cx, dir) = open_plaintext(cx, "block", settings);
workbench.read_with(cx, |workbench, _| {
let editor = workbench.editors.active().unwrap();
assert_eq!(editor.document().language_id, "plaintext");
@@ -133,3 +139,49 @@ fn a_code_editor_reads_its_language_block(cx: &mut TestAppContext) {
});
std::fs::remove_dir_all(dir).unwrap();
}
+
+/// editorConfigurationSchema.ts registers every editor option under the `LANGUAGE_OVERRIDABLE` `editor` node, and
+/// the readers ask the code editor (`editor.getOption`): minimap.ts, viewController.ts, middleScrollController.ts,
+/// stickyScrollController.ts, findController.ts, findWidget.ts, multicursor.ts, contextmenu.ts, mouseHandler.ts,
+/// viewLayout.ts, goToDefinitionAtPosition.ts, clickLinkGesture.ts. toggleMultiCursorModifier.ts's context key
+/// reads `configurationService.getValue('editor')`, without the block.
+#[gpui::test]
+fn the_mouse_find_scroll_and_minimap_options_take_the_language_block(cx: &mut TestAppContext) {
+ let settings = r#"{ "[plaintext]": {
+ "editor.minimap.enabled": false, "editor.minimap.side": "left", "editor.minimap.autohide": "scroll", "editor.minimap.renderCharacters": false, "editor.minimap.scale": 2,
+ "editor.multiCursorModifier": "ctrlCmd", "editor.scrollOnMiddleClick": true, "editor.stickyScroll.maxLineCount": 2,
+ "editor.find.loop": false, "editor.find.findOnType": false, "editor.find.addExtraSpaceOnTop": false, "editor.selectedTextMatchMode": "caseSensitive",
+ "editor.mouseWheelZoom": true, "editor.columnSelection": true, "editor.doubleClickSelectsBlock": false, "editor.smoothScrolling": true,
+ "editor.contextmenu": false, "editor.definitionLinkOpensInPeek": true, "editor.mouseMiddleClickAction": "openLink"
+ } }"#;
+ let (workbench, cx, dir) = open_plaintext(cx, "sites", settings);
+ workbench.update_in(cx, |workbench, window, cx| {
+ let editor = workbench.editors.active().unwrap();
+ let minimap = workbench.minimap_settings(editor);
+ let checks = [
+ ("minimap.enabled", !minimap.enabled),
+ ("minimap.renderCharacters", !minimap.layout.render_characters),
+ ("minimap.side", minimap.layout.side == crate::editor::minimap::MinimapSide::Left),
+ ("minimap.scale", minimap.layout.scale == 2.),
+ ("minimap.autohide", minimap.autohide == crate::workbench::minimap_view::Autohide::Scroll),
+ ("stickyScroll.maxLineCount", workbench.sticky_scroll_lines(editor) == 2),
+ ("multiCursorModifier", workbench.multi_cursor_modifier_is_cmd()),
+ ("multiCursorModifier context key", workbench.key_context(window)["multiCursorModifier"] == json!("altKey")),
+ ("contextmenu", !workbench.editor_option(editor, &CONTEXTMENU)),
+ ("find.loop", !workbench.active_editor_option(&FIND_LOOP)),
+ ("find.findOnType", !workbench.active_editor_option(&FIND_FIND_ON_TYPE)),
+ ("find.addExtraSpaceOnTop", !workbench.active_editor_option(&FIND_ADD_EXTRA_SPACE_ON_TOP)),
+ ("selectedTextMatchMode", workbench.active_editor_option(&SELECTED_TEXT_MATCH_MODE) == "caseSensitive"),
+ ("mouseWheelZoom", workbench.active_editor_option(&MOUSE_WHEEL_ZOOM)),
+ ("columnSelection", workbench.active_editor_option(&COLUMN_SELECTION)),
+ ("doubleClickSelectsBlock", !workbench.active_editor_option(&DOUBLE_CLICK_SELECTS_BLOCK)),
+ ("smoothScrolling", workbench.active_editor_option(&SMOOTH_SCROLLING)),
+ ("definitionLinkOpensInPeek", workbench.active_editor_option(&DEFINITION_LINK_OPENS_IN_PEEK)),
+ ("mouseMiddleClickAction", workbench.active_editor_option(&MOUSE_MIDDLE_CLICK_ACTION) == "openLink"),
+ ("scrollOnMiddleClick", workbench.middle_scroll_mouse_down(true, gpui::point(gpui::px(10.), gpui::px(10.)), cx)),
+ ];
+ let wrong: Vec<_> = checks.iter().filter(|(_, ok)| !ok).map(|(option, _)| *option).collect();
+ assert_eq!(wrong, Vec::<&str>::new());
+ });
+ std::fs::remove_dir_all(dir).unwrap();
+}
diff --git a/native/crates/app/src/workbench/editor_view.rs b/native/crates/app/src/workbench/editor_view.rs
index f46b738fd19..4692856a36e 100644
--- a/native/crates/app/src/workbench/editor_view.rs
+++ b/native/crates/app/src/workbench/editor_view.rs
@@ -1282,10 +1282,10 @@ impl Workbench {
let laid_out = cx.entity();
let view_line_count = editor.view_line_count();
// quickDiffWidget.ts `_fillBody`: `stickyScroll: { enabled: false }`.
- let sticky_scroll_lines = if self.quick_diff_editor_diff(editor).is_some() { 0 } else { self.sticky_scroll_lines() };
+ let sticky_scroll_lines = if self.quick_diff_editor_diff(editor).is_some() { 0 } else { self.sticky_scroll_lines(editor) };
let top_whitespace = self.editors.viewport.top_whitespace;
let stop_rendering_line_after = self.stop_rendering_line_after;
- let minimap_settings = self.minimap_settings();
+ let minimap_settings = self.minimap_settings(editor);
let in_cell = self.in_cell_editor(editor);
let minimap_enabled = self.minimap_enabled(editor);
let viewport = self.editors.viewport;
@@ -1713,7 +1713,7 @@ impl Workbench {
ScrollDelta::Pixels(delta) => (f32::from(delta.x) / 40., f32::from(delta.y) / 40.),
ScrollDelta::Lines(delta) => (delta.x, delta.y),
};
- if self.global_editor_option(&MOUSE_WHEEL_ZOOM) {
+ if self.active_editor_option(&MOUSE_WHEEL_ZOOM) {
let modifiers = event.modifiers;
let has_zoom_modifiers = (modifiers.platform || modifiers.control) && !modifiers.shift && !modifiers.alt;
// ScrollDelta::Lines is AppKit's imprecise delta of a mouse wheel, `isPhysicalMouseWheel` upstream.
@@ -2729,8 +2729,8 @@ impl Workbench {
/// too it selects a column. `visible` is the pointer's visible column (`mouseColumn`).
#[allow(clippy::too_many_arguments)]
fn dispatch_mouse(&mut self, position: Position, visible: f32, modifiers: gpui::Modifiers, select: bool, click_count: usize, reveal: bool, cx: &mut Context<Self>) {
- let column_selection = self.global_editor_option(&COLUMN_SELECTION);
- let selects_block = self.global_editor_option(&DOUBLE_CLICK_SELECTS_BLOCK);
+ let column_selection = self.active_editor_option(&COLUMN_SELECTION);
+ let selects_block = self.active_editor_option(&DOUBLE_CLICK_SELECTS_BLOCK);
let classifier = self.word_classifier(false).expect("text is clickable only with an editor open");
// viewController.ts `_hasMulticursorModifier` and `_hasNonMulticursorModifier`; `ctrlCmd` is Cmd on macOS.
let (multi_cursor, non_multi_cursor) = match self.multi_cursor_modifier_is_cmd() {
@@ -2793,7 +2793,7 @@ impl Workbench {
/// `editor.multiCursorModifier`: any value but `ctrlCmd` is Alt (editorOptions.ts `_multiCursorModifierFromString`).
pub(super) fn multi_cursor_modifier_is_cmd(&self) -> bool {
- self.global_editor_option(&MULTI_CURSOR_MODIFIER) == "ctrlCmd"
+ self.active_editor_option(&MULTI_CURSOR_MODIFIER) == "ctrlCmd"
}
/// The middle button selects a column (`editor.scrollOnMiddleClick` off): from the pointer, or with
@@ -2833,14 +2833,14 @@ impl Workbench {
/// simpleCommentEditor.ts in a comment's, referencesWidget.ts in the peek's, testResultsOutput.ts in a result message's.
fn minimap_enabled(&self, editor: &OpenEditor) -> bool {
let minimap_off_scheme = matches!(editor.document().scheme.as_str(), super::walkthrough_part::SNIPPET_SCHEME | crate::testing::TEST_DATA_SCHEME);
- self.editors.active_diff().is_none() && self.editors.active_multi_diff().is_none() && self.editors.active_merge().is_none() && !self.in_cell_editor(editor) && !minimap_off_scheme && !is_comment_input(editor) && editor.peek_preview.is_none() && self.minimap_settings().enabled
+ self.editors.active_diff().is_none() && self.editors.active_multi_diff().is_none() && self.editors.active_merge().is_none() && !self.in_cell_editor(editor) && !minimap_off_scheme && !is_comment_input(editor) && editor.peek_preview.is_none() && self.minimap_settings(editor).enabled
}
/// `editorOverviewRuler.background`, else the tokens' default background while the minimap is on the right, so
/// the ruler hides the minimap's line highlights under it.
pub(super) fn overview_ruler_background(&self, editor: &OpenEditor) -> Option<Rgba> {
self.theme.color("editorOverviewRuler.background").or_else(|| {
- (self.minimap_enabled(editor) && self.minimap_settings().layout.side == crate::editor::minimap::MinimapSide::Right)
+ (self.minimap_enabled(editor) && self.minimap_settings(editor).layout.side == crate::editor::minimap::MinimapSide::Right)
.then(|| Rgba::try_from(self.theme.tokens.color_map()[2].as_str()).expect("the token color map holds hex colors"))
})
}
@@ -3008,7 +3008,7 @@ impl Workbench {
pub(super) fn editor_status_items(&self, foreground: Rgba, window: &Window, cx: &mut Context<Self>) -> Vec<(bool, gpui::AnyElement)> {
// editorStatus.ts `updateColumnSelectionModeElement`, `updateTabFocusModeElement` and `updateInputModeElement`: prominent entries.
let mut items = Vec::new();
- if self.editors.active().is_some() && self.global_editor_option(&COLUMN_SELECTION) {
+ if self.editors.active().is_some() && self.active_editor_option(&COLUMN_SELECTION) {
items.push(("Column Selection".to_string(), "Disable Column Selection Mode", "editor.action.toggleColumnSelection", "status.editor.columnSelectionMode"));
}
if self.tab_focus_mode() {
diff --git a/native/crates/app/src/workbench/editor_view/sticky_scroll_view.rs b/native/crates/app/src/workbench/editor_view/sticky_scroll_view.rs
index 8d50c5ae6d0..f248e31e005 100644
--- a/native/crates/app/src/workbench/editor_view/sticky_scroll_view.rs
+++ b/native/crates/app/src/workbench/editor_view/sticky_scroll_view.rs
@@ -56,11 +56,11 @@ struct StickyLine {
impl Workbench {
/// `editor.stickyScroll.maxLineCount` (1 to 20) with sticky scroll on, else 0.
- pub(super) fn sticky_scroll_lines(&self) -> usize {
- if !self.global_editor_option(&STICKY_SCROLL_ENABLED) {
+ pub(in crate::workbench) fn sticky_scroll_lines(&self, editor: &OpenEditor) -> usize {
+ if !self.editor_option(editor, &STICKY_SCROLL_ENABLED) {
return 0;
}
- self.global_editor_option(&STICKY_SCROLL_MAX_LINE_COUNT)
+ self.editor_option(editor, &STICKY_SCROLL_MAX_LINE_COUNT)
}
/// `_findRenderingData`: the lines the widget shows, with the one under Shift showing its scope's end, and
diff --git a/native/crates/app/src/workbench/find_widget.rs b/native/crates/app/src/workbench/find_widget.rs
index f9d205afcfb..8ca50a8142e 100644
--- a/native/crates/app/src/workbench/find_widget.rs
+++ b/native/crates/app/src/workbench/find_widget.rs
@@ -325,7 +325,12 @@ impl Workbench {
let scrolled = self.animate_scroll_from(scroll, cx) || self.editors.viewport.top_whitespace != top_whitespace;
self.find.version_id = self.editors.active().expect("checked above").text_model().version_id;
self.find.ignore_own_change = true;
- self.model_content_changed(change, crate::workbench::model_events::Cursor { moved, source: "api", reveal: crate::editor::Reveal::Nothing }, cx);
+ // findModel.ts: replace all leaves its command's selection; a replace moves on to the next match by `setSelection`.
+ let source = match change.as_ref().map(|change| super::model_events::edit_source(&change.reason)) {
+ Some("replaceAll") => "replaceAll",
+ _ => "api",
+ };
+ self.model_content_changed(change, crate::workbench::model_events::Cursor { moved, source, reveal: crate::editor::Reveal::Nothing }, cx);
self.find.ignore_own_change = false;
if scrolled {
self.editor_scrolled(cx);
@@ -501,19 +506,19 @@ impl Workbench {
/// `editor.find` settings the controller reads.
fn find_options(&self) -> FindOptions {
- let seed = match self.global_editor_option(&FIND_SEED_SEARCH_STRING_FROM_SELECTION) {
+ let seed = match self.active_editor_option(&FIND_SEED_SEARCH_STRING_FROM_SELECTION) {
"never" => SeedFromSelection::Never,
"selection" => SeedFromSelection::Selection,
_ => SeedFromSelection::Always,
};
- let auto_find_in_selection = match self.global_editor_option(&FIND_AUTO_FIND_IN_SELECTION) {
+ let auto_find_in_selection = match self.active_editor_option(&FIND_AUTO_FIND_IN_SELECTION) {
"always" => AutoFindInSelection::Always,
"multiline" => AutoFindInSelection::Multiline,
_ => AutoFindInSelection::Never,
};
- let is_loop = self.global_editor_option(&FIND_LOOP);
- let cursor_move_on_type = self.global_editor_option(&FIND_CURSOR_MOVE_ON_TYPE);
- let global_find_clipboard = self.global_editor_option(&FIND_GLOBAL_FIND_CLIPBOARD);
+ let is_loop = self.active_editor_option(&FIND_LOOP);
+ let cursor_move_on_type = self.active_editor_option(&FIND_CURSOR_MOVE_ON_TYPE);
+ let global_find_clipboard = self.active_editor_option(&FIND_GLOBAL_FIND_CLIPBOARD);
let (word_separators, word_segmenter_locales) = self.word_separators(false).unwrap_or((word_operations::DEFAULT_WORD_SEPARATORS.to_string(), Vec::new()));
FindOptions { seed_search_string_from_selection: seed, auto_find_in_selection, is_loop, global_find_clipboard, cursor_move_on_type, word_separators, word_segmenter_locales, ..FindOptions::default() }
}
@@ -530,7 +535,7 @@ impl Workbench {
}
// `editor.find.findOnType` off: the search string waits for Enter (`find_input_key_down`); a line more or
// less still resizes the widget and its zone (`onDidHeightChange`, `_showViewZone`).
- if id == InputId::Find && !self.global_editor_option(&FIND_FIND_ON_TYPE) {
+ if id == InputId::Find && !self.active_editor_option(&FIND_FIND_ON_TYPE) {
let top_whitespace = self.editors.viewport.top_whitespace;
self.layout_find_zone(true);
if self.editors.viewport.top_whitespace != top_whitespace {
@@ -551,7 +556,7 @@ impl Workbench {
/// The find input's keydown, before the keybindings: with `editor.find.findOnType` off Enter searches.
pub(super) fn find_input_key_down(&mut self, keystroke: &Keystroke, window: &mut Window, cx: &mut Context<Self>) {
let modifiers = keystroke.modifiers;
- if keystroke.key != "enter" || modifiers.modified() || !self.find.find_focus.is_focused(window) || self.global_editor_option(&FIND_FIND_ON_TYPE) {
+ if keystroke.key != "enter" || modifiers.modified() || !self.find.find_focus.is_focused(window) || self.active_editor_option(&FIND_FIND_ON_TYPE) {
return;
}
let new = NewFindState { search_string: Some(self.find.find_input.value.clone()), ..Default::default() };
@@ -633,7 +638,7 @@ impl Workbench {
}
fn selected_text_match_mode(&self) -> String {
- self.global_editor_option(&SELECTED_TEXT_MATCH_MODE).to_string()
+ self.active_editor_option(&SELECTED_TEXT_MATCH_MODE).to_string()
}
/// `SelectionHighlighter._update`, run on every render; the matches are searched again only when the query, the
@@ -679,7 +684,7 @@ impl Workbench {
/// widget sits above line 1; the scroll moves with it, so the text stays put, unless `adjust` is false on show.
fn layout_find_zone(&mut self, adjust: bool) {
let state = &self.find.controller.state;
- let extra_space = self.global_editor_option(&FIND_ADD_EXTRA_SPACE_ON_TOP);
+ let extra_space = self.active_editor_option(&FIND_ADD_EXTRA_SPACE_ON_TOP);
let height = if state.is_revealed && extra_space { self.find_widget_height() } else { 0. };
let delta = height - self.editors.viewport.top_whitespace;
if delta == 0. {
diff --git a/native/crates/app/src/workbench/goto_symbol.rs b/native/crates/app/src/workbench/goto_symbol.rs
index 8aa1f0000df..211fab906c0 100644
--- a/native/crates/app/src/workbench/goto_symbol.rs
+++ b/native/crates/app/src/workbench/goto_symbol.rs
@@ -225,7 +225,7 @@ impl Workbench {
/// goToDefinitionAtPosition.ts `gotoDefinition`: the cursor moves to the clicked position, then a muted Go to
/// Definition runs, in the peek with `editor.definitionLinkOpensInPeek` unless it opens to the side.
pub(super) fn go_to_definition_at(&mut self, position: Position, open_to_side: bool, window: &mut Window, cx: &mut Context<Self>) {
- let open_in_peek = !open_to_side && self.global_editor_option(&DEFINITION_LINK_OPENS_IN_PEEK);
+ let open_in_peek = !open_to_side && self.active_editor_option(&DEFINITION_LINK_OPENS_IN_PEEK);
self.editors.active_mut().expect("the link is in the active editor").move_to(position, false);
let action = Action { id: "", kind: DEFINITION, open_to_side, open_in_peek, compact: false, mute_message: true };
self.run_symbol_navigation(action, None, None, window, cx);
@@ -234,7 +234,7 @@ impl Workbench {
/// inlayHintsLocations.ts `goToDefinitionWithLocation`: a muted Go to Definition anchored at the span's start,
/// with the peek over the span, the cursor left where it is.
pub(super) fn go_to_definition_with_location(&mut self, span: Range<Position>, open_to_side: bool, window: &mut Window, cx: &mut Context<Self>) {
- let open_in_peek = !open_to_side && self.global_editor_option(&DEFINITION_LINK_OPENS_IN_PEEK);
+ let open_in_peek = !open_to_side && self.active_editor_option(&DEFINITION_LINK_OPENS_IN_PEEK);
let action = Action { id: "", kind: DEFINITION, open_to_side, open_in_peek, compact: false, mute_message: true };
self.run_symbol_navigation(action, None, Some(span), window, cx);
}
diff --git a/native/crates/app/src/workbench/inlay_hints.rs b/native/crates/app/src/workbench/inlay_hints.rs
index 0fdb155f359..1815bbeebba 100644
--- a/native/crates/app/src/workbench/inlay_hints.rs
+++ b/native/crates/app/src/workbench/inlay_hints.rs
@@ -622,7 +622,7 @@ impl Workbench {
/// clickLinkGesture.ts `hasTriggerModifier`: Cmd, or Alt when `editor.multiCursorModifier` is `ctrlCmd`.
fn link_modifier(&self, modifiers: Modifiers) -> bool {
- match self.global_editor_option(&MULTI_CURSOR_MODIFIER) == "ctrlCmd" {
+ match self.active_editor_option(&MULTI_CURSOR_MODIFIER) == "ctrlCmd" {
true => modifiers.alt,
false => modifiers.platform,
}
diff --git a/native/crates/app/src/workbench/inline_completions.rs b/native/crates/app/src/workbench/inline_completions.rs
index 139e671c7d3..4e930e17aaf 100644
--- a/native/crates/app/src/workbench/inline_completions.rs
+++ b/native/crates/app/src/workbench/inline_completions.rs
@@ -225,13 +225,14 @@ impl Workbench {
self.language_features.ordered(REGISTER, &candidate).iter().map(|registration| (registration.handle, registration.debounce_delay_ms)).collect()
}
- /// `createStateWithAppliedEdit`, then the refetch of a text change: typing (and the keyboard's deletes and Tab,
- /// `onDidType`) starts a session or asks again, any other edit asks again while a session runs.
+ /// `createStateWithAppliedEdit`, then the refetch of a text change: typing (`onDidType`) and the edits of the
+ /// controller's `triggerCommands` start a session or ask again, any other edit asks again while a session runs.
pub(super) fn inline_completions_edited(&mut self, change: &ContentChanged, source: &str, cx: &mut Context<Self>) {
self.rebase_inline_completions();
self.update_ghost_text(cx);
let Some(editor) = self.editors.active() else { return };
- let starts = match source == "keyboard" {
+ let triggers = matches!(source, "keyboard" | "tab" | "deleteLeft" | "deleteRight" | "editor.action.insertLineAfter" | "editor.action.insertLineBefore");
+ let starts = match triggers {
true => self.suggest_setting(editor, "editor.inlineSuggest.enabled") != json!(false),
false => self.inline_completions.active,
};
diff --git a/native/crates/app/src/workbench/keyboard.rs b/native/crates/app/src/workbench/keyboard.rs
index 43faf245505..51051df95f5 100644
--- a/native/crates/app/src/workbench/keyboard.rs
+++ b/native/crates/app/src/workbench/keyboard.rs
@@ -19,7 +19,7 @@ use crate::commands::Outcome;
use crate::editor::TextDocument;
use crate::keybindings::{self, Chord, Item, Resolution, Resolver};
use crate::system_wide_keybindings::{HotKeys, SystemWide};
-use crate::workbench::editor_options::{COLUMN_SELECTION, FOLDING};
+use crate::workbench::editor_options::{COLUMN_SELECTION, FOLDING, MULTI_CURSOR_MODIFIER};
/// The keybindings and the dispatch state of `AbstractKeybindingService`.
pub struct Keybindings {
@@ -465,7 +465,7 @@ impl Workbench {
context.insert("scm.providerCount".into(), json!(self.scm.model.providers.len()));
context.insert("dirtyWorkingCopies".into(), json!(self.editors.all_editors().any(|editor| editor.is_dirty())));
// toggleMultiCursorModifier.ts `MultiCursorModifierContextKeyController`.
- context.insert("multiCursorModifier".into(), json!(if self.multi_cursor_modifier_is_cmd() { "ctrlCmd" } else { "altKey" }));
+ context.insert("multiCursorModifier".into(), json!(if self.global_editor_option(&MULTI_CURSOR_MODIFIER) == "ctrlCmd" { "ctrlCmd" } else { "altKey" }));
self.word_wrap_context(&mut context);
self.action_widget_context(&mut context);
self.problems_context(window, &mut context);
diff --git a/native/crates/app/src/workbench/links.rs b/native/crates/app/src/workbench/links.rs
index 87a3eb40d3a..6dbdb4c67b6 100644
--- a/native/crates/app/src/workbench/links.rs
+++ b/native/crates/app/src/workbench/links.rs
@@ -219,7 +219,7 @@ impl Workbench {
/// `openLink`, on a link opens it. Answers whether it took the click.
pub(super) fn links_mouse_up(&mut self, line: usize, visible: f32, modifiers: Modifiers, middle: bool, window: &mut Window, cx: &mut Context<Self>) -> bool {
let triggered = match middle {
- true => self.global_editor_option(&MOUSE_MIDDLE_CLICK_ACTION) == "openLink",
+ true => self.active_editor_option(&MOUSE_MIDDLE_CLICK_ACTION) == "openLink",
false => self.link_trigger_modifier(modifiers),
};
let Some(editor) = self.editors.active().filter(|_| triggered) else { return false };
diff --git a/native/crates/app/src/workbench/middle_scroll.rs b/native/crates/app/src/workbench/middle_scroll.rs
index 3a76d3f5e40..e0b51dddb0b 100644
--- a/native/crates/app/src/workbench/middle_scroll.rs
+++ b/native/crates/app/src/workbench/middle_scroll.rs
@@ -23,7 +23,7 @@ impl Workbench {
cx.notify();
return false;
}
- if !middle || !self.global_editor_option(&SCROLL_ON_MIDDLE_CLICK) {
+ if !middle || !self.active_editor_option(&SCROLL_ON_MIDDLE_CLICK) {
return false;
}
self.middle_scroll = Some(MiddleScroll { origin: position, mouse: position, last_frame: Instant::now(), did_scroll: false });
@@ -55,7 +55,7 @@ impl Workbench {
/// session runs, so the caller asks for the next frame.
pub(super) fn middle_scroll_frame(&mut self, cx: &mut Context<Self>) -> bool {
// The autorun drops the session when the setting turns off.
- if !self.global_editor_option(&SCROLL_ON_MIDDLE_CLICK) {
+ if !self.active_editor_option(&SCROLL_ON_MIDDLE_CLICK) {
self.middle_scroll = None;
}
let viewport = self.editors.viewport;
diff --git a/native/crates/app/src/workbench/minimap_view.rs b/native/crates/app/src/workbench/minimap_view.rs
index ca54a8b26d8..e621c4f0b9f 100644
--- a/native/crates/app/src/workbench/minimap_view.rs
+++ b/native/crates/app/src/workbench/minimap_view.rs
@@ -23,7 +23,10 @@ use crate::editor::folding::{FoldDecoration, hidden_range};
use crate::editor::section_headers::{FindOptions, SectionHeader, find_section_headers, fit_section_header};
use crate::editor::{OpenEditor, Position, TextModel, VERTICAL_SCROLLBAR_WIDTH, Viewport};
use crate::theme::relative_luminance;
-use crate::workbench::editor_options::{MINIMAP_ENABLED, MINIMAP_MARK_SECTION_HEADER_REGEX, MINIMAP_RENDER_CHARACTERS, MINIMAP_SHOW_MARK_SECTION_HEADERS, MINIMAP_SHOW_REGION_SECTION_HEADERS};
+use crate::workbench::editor_options::{
+ MINIMAP_AUTOHIDE, MINIMAP_ENABLED, MINIMAP_MARK_SECTION_HEADER_REGEX, MINIMAP_MAX_COLUMN, MINIMAP_RENDER_CHARACTERS, MINIMAP_SCALE, MINIMAP_SECTION_HEADER_FONT_SIZE, MINIMAP_SECTION_HEADER_LETTER_SPACING,
+ MINIMAP_SHOW_MARK_SECTION_HEADERS, MINIMAP_SHOW_REGION_SECTION_HEADERS, MINIMAP_SHOW_SLIDER, MINIMAP_SIDE, MINIMAP_SIZE,
+};
/// minimap.css `.minimap-slider` opacity transition, and `_hideSliderAfterScrollScheduler`.
const SLIDER_FADE: Duration = Duration::from_millis(100);
@@ -294,12 +297,12 @@ impl Workbench {
return None;
}
let viewport = self.editors.viewport;
- let settings = self.minimap_settings();
+ let settings = self.minimap_settings(editor);
let sampling = info.is_sampling.then(|| Rc::new(self.sticky_minimap_sampling(editor, viewport, pixel_ratio, settings.layout)));
let layout = self.minimap_layout(editor, info, pixel_ratio, viewport, sampling.as_deref());
let image = self.minimap_image(editor, &info, &layout, sampling.as_deref());
let fills = self.minimap_decorations(editor, &info, &layout, sampling.as_deref(), cx);
- let label_options = self.section_header_options();
+ let label_options = self.section_header_options(editor);
let labels = self.minimap_section_labels(editor, &info, pixel_ratio, &layout, &label_options, sampling.as_deref());
let background = self.minimap_background();
let label_background = Rgba { a: 0.7, ..background };
@@ -633,7 +636,7 @@ impl Workbench {
fn minimap_mouse_over_changed(&mut self, cx: &mut Context<Self>) {
let now = Instant::now();
self.minimap.update_slider(now);
- if self.minimap_settings().autohide == Autohide::Mouseover {
+ if self.editors.active().is_some_and(|editor| self.minimap_settings(editor).autohide == Autohide::Mouseover) {
self.minimap.autohide.set(self.minimap.mouse_over, now, AUTOHIDE_TRANSITION);
}
cx.notify();
@@ -664,7 +667,7 @@ impl Workbench {
return;
}
self.minimap.scroll_top = editor.scroll.top;
- if self.minimap_settings().autohide == Autohide::Scroll {
+ if self.minimap_settings(editor).autohide == Autohide::Scroll {
self.minimap.autohide.set(true, Instant::now(), AUTOHIDE_TRANSITION);
self.minimap.active = Some(cx.spawn(async move |workbench, cx| {
// `_hideSoon`: 500ms, again while the pointer is over the minimap.
@@ -714,41 +717,38 @@ pub(super) struct SectionHeaderOptions {
}
impl Workbench {
- /// `EditorMinimap.validate`: an unknown value falls back to the default; `scale` and `maxColumn` are clamped.
- pub(super) fn minimap_settings(&self) -> MinimapSettings {
- let string = |key: &str| self.setting(&format!("editor.minimap.{key}")).as_str().map(str::to_owned);
- let number = |key: &str, default: f64, min: f64, max: f64| self.setting(&format!("editor.minimap.{key}")).as_f64().map_or(default, |value| value.floor().clamp(min, max));
- let defaults = MinimapOptions::default();
+ /// `EditorMinimap.validate` of the code editor's `editor.minimap` (minimap.ts `options.get(EditorOption.minimap)`).
+ pub(super) fn minimap_settings(&self, editor: &OpenEditor) -> MinimapSettings {
let layout = MinimapOptions {
- size: match string("size").as_deref() {
- Some("fill") => MinimapSize::Fill,
- Some("fit") => MinimapSize::Fit,
+ size: match self.editor_option(editor, &MINIMAP_SIZE) {
+ "fill" => MinimapSize::Fill,
+ "fit" => MinimapSize::Fit,
_ => MinimapSize::Proportional,
},
- side: if string("side").as_deref() == Some("left") { MinimapSide::Left } else { MinimapSide::Right },
- render_characters: self.global_editor_option(&MINIMAP_RENDER_CHARACTERS),
- max_column: number("maxColumn", defaults.max_column, 1., 10000.),
- scale: number("scale", defaults.scale, 1., 3.),
+ side: if self.editor_option(editor, &MINIMAP_SIDE) == "left" { MinimapSide::Left } else { MinimapSide::Right },
+ render_characters: self.editor_option(editor, &MINIMAP_RENDER_CHARACTERS),
+ max_column: self.editor_option(editor, &MINIMAP_MAX_COLUMN) as f64,
+ scale: self.editor_option(editor, &MINIMAP_SCALE) as f64,
};
MinimapSettings {
- enabled: self.global_editor_option(&MINIMAP_ENABLED),
+ enabled: self.editor_option(editor, &MINIMAP_ENABLED),
layout,
- slider_always: string("showSlider").as_deref() == Some("always"),
- autohide: match string("autohide").as_deref() {
- Some("mouseover") => Autohide::Mouseover,
- Some("scroll") => Autohide::Scroll,
+ slider_always: self.editor_option(editor, &MINIMAP_SHOW_SLIDER) == "always",
+ autohide: match self.editor_option(editor, &MINIMAP_AUTOHIDE) {
+ "mouseover" => Autohide::Mouseover,
+ "scroll" => Autohide::Scroll,
_ => Autohide::None,
},
}
}
- pub(super) fn section_header_options(&self) -> SectionHeaderOptions {
- let float = |key: &str, default: f64, min: f64, max: f64| self.setting(key).as_f64().unwrap_or(default).clamp(min, max);
- SectionHeaderOptions {
- show_region: self.global_editor_option(&MINIMAP_SHOW_REGION_SECTION_HEADERS),
- mark_regex: self.global_editor_option(&MINIMAP_SHOW_MARK_SECTION_HEADERS).then(|| self.global_editor_option(&MINIMAP_MARK_SECTION_HEADER_REGEX)),
- font_size: float("editor.minimap.sectionHeaderFontSize", 9., 4., 32.),
- letter_spacing: float("editor.minimap.sectionHeaderLetterSpacing", 1., 0., 5.),
+ /// sectionHeaders.ts `createOptions(editor.getOption(EditorOption.minimap))`.
+ pub(super) fn section_header_options(&self, editor: &OpenEditor) -> SectionHeaderOptions {
+ SectionHeaderOptions {
+ show_region: self.editor_option(editor, &MINIMAP_SHOW_REGION_SECTION_HEADERS),
+ mark_regex: self.editor_option(editor, &MINIMAP_SHOW_MARK_SECTION_HEADERS).then(|| self.editor_option(editor, &MINIMAP_MARK_SECTION_HEADER_REGEX)),
+ font_size: self.editor_option(editor, &MINIMAP_SECTION_HEADER_FONT_SIZE),
+ letter_spacing: self.editor_option(editor, &MINIMAP_SECTION_HEADER_LETTER_SPACING),
}
}
}
diff --git a/native/crates/app/src/workbench/model_events.rs b/native/crates/app/src/workbench/model_events.rs
index 5f9299a404e..87d491d966e 100644
--- a/native/crates/app/src/workbench/model_events.rs
+++ b/native/crates/app/src/workbench/model_events.rs
@@ -7,7 +7,7 @@ use std::rc::Rc;
use gpui::Context;
use super::Workbench;
-use crate::editor::{ContentChanged, Reveal, VerticalReveal, uri_string};
+use crate::editor::{ContentChanged, EditReason, Reveal, VerticalReveal, uri_string};
use crate::navigation::Reason;
/// How the active editor's cursors moved with an announcement.
@@ -25,6 +25,16 @@ impl Cursor<'_> {
}
}
+/// cursor.ts `source` of an edit made through the code editor: `executeEdits` and `executeCommands` pass theirs,
+/// which the reason carries; undo, redo and an EOL change reach the cursors by `onModelContentChanged`.
+pub(super) fn edit_source(reason: &EditReason) -> &'static str {
+ match reason {
+ EditReason::Cursor { detailed_source, .. } => detailed_source,
+ EditReason::Unknown(name) => name,
+ EditReason::ApplyEdits | EditReason::EolChange => "modelChange",
+ }
+}
+
impl Workbench {
/// `onDidChangeContent` of the change's model, then `onDidChangeModelContent` and `onDidChangeCursorPosition`
/// when the active code editor shows it. Without a change, `cursor_position_changed`.
diff --git a/native/crates/app/src/workbench/model_events/tests.rs b/native/crates/app/src/workbench/model_events/tests.rs
index 03c531a88fb..3dcf463f97d 100644
--- a/native/crates/app/src/workbench/model_events/tests.rs
+++ b/native/crates/app/src/workbench/model_events/tests.rs
@@ -164,19 +164,20 @@ fn insert_at_start(file: &Path, text: &str) -> Value {
/// Every path tells the host first, then wakes the content listeners of the active code editor when it shows the
/// model (codelensController.ts, inlayHintsController.ts, colorDetector.ts) and none when it does not. The shown
-/// editor's selection follows with the source cursor.ts gives it; None: a gap of the M27 ledger row.
+/// editor's selection follows with the source cursor.ts gives it: coreCommands.ts `deleteRight`'s id, cursor.ts
+/// `onModelContentChanged`'s for undo, findModel.ts `replaceAll`, saveParticipants.ts `insertFinalNewLine`.
#[gpui::test]
fn every_path_of_an_edit_tells_the_host_first_and_wakes_the_shown_editor(cx: &mut TestAppContext) {
let table = [
(EditPath::Type, true, Some("keyboard")),
- (EditPath::Command, true, None),
- (EditPath::Undo, true, None),
+ (EditPath::Command, true, Some("deleteRight")),
+ (EditPath::Undo, true, Some("modelChange")),
(EditPath::BulkEditOfTheActiveEditor, true, Some("modelChange")),
(EditPath::BulkEditOfAnotherGroup, false, None),
(EditPath::BulkEditOfAModelWithoutEditor, false, None),
- (EditPath::ReplaceAll, true, None),
+ (EditPath::ReplaceAll, true, Some("replaceAll")),
(EditPath::HostEdit, true, Some("MainThreadTextEditor")),
- (EditPath::SaveParticipant, true, None),
+ (EditPath::SaveParticipant, true, Some("insertFinalNewLine")),
(EditPath::Revert, true, Some("modelChange")),
];
let registrations = [
@@ -229,7 +230,8 @@ fn every_path_of_an_edit_tells_the_host_first_and_wakes_the_shown_editor(cx: &mu
let messages: Vec<HostMessage> = receiver.try_iter().collect();
let methods: Vec<&str> = messages.iter().map(|message| message.method).collect();
if let Some(source) = source {
- let selection = messages.iter().find(|message| message.method == "$acceptEditorPropertiesChanged").expect("the shown editor's selection");
+ let mut after_change = messages.iter().skip_while(|message| message.method != "$acceptModelChanged");
+ let selection = after_change.find(|message| message.method == "$acceptEditorPropertiesChanged").expect("the shown editor's selection");
assert_eq!(selection.args[1]["selections"]["source"], source, "{path:?}");
}
let changed = methods.iter().position(|method| *method == "$acceptModelChanged");
diff --git a/native/crates/app/src/workbench/smooth_scrolling.rs b/native/crates/app/src/workbench/smooth_scrolling.rs
index 99e7b9856b4..a309985aeeb 100644
--- a/native/crates/app/src/workbench/smooth_scrolling.rs
+++ b/native/crates/app/src/workbench/smooth_scrolling.rs
@@ -28,7 +28,7 @@ impl Workbench {
/// Runs `scroll` on the active editor from the future scroll position and, with `editor.smoothScrolling`,
/// animates from the current one to where it lands. Returns whether the editor scrolled.
pub(super) fn scroll_smoothly(&mut self, cx: &mut Context<Self>, scroll: impl FnOnce(&mut OpenEditor, Viewport)) -> bool {
- let smooth = self.global_editor_option(&SMOOTH_SCROLLING);
+ let smooth = self.active_editor_option(&SMOOTH_SCROLLING);
let viewport = self.editors.viewport;
let running = self.smooth_scrolling.take();
let editor = self.editors.active_mut().expect("an editor scrolls only while open");
diff --git a/native/crates/app/src/workbench/suggest_controller.rs b/native/crates/app/src/workbench/suggest_controller.rs
index becbbde55ef..baf39f981cc 100644
--- a/native/crates/app/src/workbench/suggest_controller.rs
+++ b/native/crates/app/src/workbench/suggest_controller.rs
@@ -198,7 +198,7 @@ impl Workbench {
if composing {
return;
}
- if !selection.is_empty() || source != "keyboard" {
+ if !selection.is_empty() || !matches!(source, "keyboard" | "deleteLeft") {
self.cancel_suggest(false, cx);
return;
}
diff --git a/native/crates/app/src/workbench/text_input.rs b/native/crates/app/src/workbench/text_input.rs
index 60444cec109..49034c772a1 100644
--- a/native/crates/app/src/workbench/text_input.rs
+++ b/native/crates/app/src/workbench/text_input.rs
@@ -84,7 +84,12 @@ impl Workbench {
let changes = model.run_save_participants(&participants);
let changed = !changes.is_empty();
for change in changes {
- self.model_content_changed(Some(change), crate::workbench::model_events::Cursor::model_change(), cx);
+ // Only FinalNewLineParticipant edits through the shown editor (`executeEdits`); the others through the model.
+ let source = match super::model_events::edit_source(&change.reason) {
+ "insertFinalNewLine" => "insertFinalNewLine",
+ _ => "modelChange",
+ };
+ self.model_content_changed(Some(change), Cursor { moved: false, source, reveal: Reveal::Nothing }, cx);
}
if changed {
self.host.send_visible_ranges(&self.editors);
diff --git a/port/ledger.md b/port/ledger.md
index 7ce8b7e4394..6c334af1a73 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -46,7 +46,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,
| Milestones | M24 Windows build | in progress | Branch `worktree-m24-windows`, beside milestone 23 on the same seams: macOS and Linux code stays as it is, each Windows counterpart sits behind `cfg(target_os = "windows")` in the function where it is a few lines, in a `windows.rs` beside `macos.rs` and `linux.rs` where it is not. Scope: WebView2, the Win32 file dialogs and message boxes, the in-window menu bar and custom title bar, Credential Manager (keyring), named pipes for the extension host and single instance, ConPTY for the terminal (terminal/pty/conpty.rs, the VT backend libghostty-vt is platform-neutral), drive-letter paths and file URIs, the user-setup install path with `bin` on the user PATH (code.iss `addtopath`), `%APPDATA%\Code` settings import, an x64 and arm64 zip and a user installer, no Authenticode signing (the Windows signing decision). Cross build on the Studio (cargo-xwin, `x86_64-pc-windows-msvc` and `aarch64-pc-windows-msvc`) for compile checks and host-run unit tests; real runs on GitHub Actions `windows` runners (`.github/workflows/windows.yml`, by hand). Seams: the "M24 Windows" rows. | `cargo build --release -p app` and the area tests pass on win32-x64 and win32-arm64 runners; the app opens a folder, edits, saves, runs an extension (the exthost handshake, emmet and git activate) and shows a webview on the runner; `v1.147.0-insider` carries `VSRustium-win32-x64-1.147.0-insider.zip`, `VSRustium-win32-arm64-1.147.0-insider.zip` and both user setups; the macOS and Linux builds are unchanged (their area tests as before). |
| Milestones | M25 virtual workspaces | later | Artur: its own milestone after M20, not part of the gap audits. A folder of a non-file scheme (`.code-workspace` `uri` folders, `--folder-uri`, `vscode.openFolder` with an extension file system provider scheme) kept as a URI; every reader of workspace folders (173 `.folders` uses in 70 files: explorer, search, quick open, terminal cwd, tasks, git, watcher, settings layers, trust) goes through the file system providers; the workspace marked virtual, `virtualWorkspaces: false` extensions disabled with the `notSupportedInWorkspace` message (config/workspace.rs:101, port/notes.md provider entries deferred until virtual workspaces). | not started |
| Milestones | M26 GPUI on gpui-fast | done | Artur, 2026-12-01: the port's GPUI moved from Wu (dstrml/wu a3ced28) to gpui-fast (longbridge/gpui-fast f0a91cf952678e4d205da1ec189b6d134e975bcd, base zed a36d485, vendored in `native/vendor/gpui-fast`), a Zed GPUI fork whose Retained Mode redraws only the views that changed; `native/vendor/wu` is deleted. Reason, risks, sync, the gate's results and the open gaps (outer shadow clip, Linux `super-q`): port/notes.md "GPUI on gpui-fast". | All area tests and `port/tools/api-tests` green; `cargo test -p app corner_lab` within today's thresholds; a Retained Mode on/off differential test without differences; GUI: open a folder, edit, save, an extension (exthost handshake, emmet, git), a webview, a long list scroll, the terminal; `port/tools/bench` not worse than Wu in any column; `bun port/tools/ledger-check.ts` passes. Results: port/notes.md "GPUI on gpui-fast", "M26 gate". |
-| Milestones | M27 architecture deepening | open | Artur, 2026-12-02: the six candidates of the architecture review, one per session and worktree, in the order 4, 1, 3, 5, 6, 2: one answer to who serves a MainThread call, one announcement of a model content change, one extension host start per window, editor options as a module, language feature registrations decoded once, one pass over the editors of every group (the swap of `with_group` stays, the multi-instance code editor builds on it). Every candidate is pixel-neutral and keeps the invariants of ARCHITECTURE.md; performance is M28. Plan, evidence and the picked interfaces of candidates 4 and 1: port/plans/architecture-deepening.md. Done: 4, 1, 3, 5, 6, 2 (port/notes.md "Architecture deepening"). Pixel-neutral, measured once over the six from `f4d6aabdf09` to the last candidate (port/notes.md "Architecture deepening"): `port/tools/pixel-check` gives identical port images in 36 of 40 window and theme pairs, the 4 `panel` ones differing only in the checkout path the terminal prompt prints; `port/tools/ui-pair` with ONLY=port over steps-params-actions, steps-color and steps-ghost gives identical images. Open from 6: the `$provide*` calls stay built by each feature (83 `"ExtHostLanguageFeatures"` sites), not in the language features module as the plan's goal says; its "Done when" holds. Open from 5: the editor options are read under the settings lock on every call, not once per settings change (the settings service has no change counter to key a cache on; the typing and scroll gates did not move); `language_setting`, `suggest_setting`, `editor_bool_setting` and the raw `get_value` reads of word wrap, folding, paste and comments still hold their own defaults outside `workbench/editor_options.rs`. | Each candidate's "Done when" of port/plans/architecture-deepening.md holds; `port/tools/pixel-check` and the area's `port/tools/ui-pair` steps show no difference from the commit before each candidate; `bun port/tools/ledger-check.ts` passes. |
+| Milestones | M27 architecture deepening | done | Artur, 2026-12-02: the six candidates of the architecture review, one per session and worktree, in the order 4, 1, 3, 5, 6, 2: one answer to who serves a MainThread call, one announcement of a model content change, one extension host start per window, editor options as a module, language feature registrations decoded once, one pass over the editors of every group (the swap of `with_group` stays, the multi-instance code editor builds on it). Every candidate is pixel-neutral and keeps the invariants of ARCHITECTURE.md; performance is M28. Plan, evidence and the picked interfaces of candidates 4 and 1: port/plans/architecture-deepening.md. Done: 4, 1, 3, 5, 6, 2 (port/notes.md "Architecture deepening"). Pixel-neutral, measured once over the six from `f4d6aabdf09` to the last candidate (port/notes.md "Architecture deepening"): `port/tools/pixel-check` gives identical port images in 36 of 40 window and theme pairs, the 4 `panel` ones differing only in the checkout path the terminal prompt prints; `port/tools/ui-pair` with ONLY=port over steps-params-actions, steps-color and steps-ghost gives identical images. Open from 6: the `$provide*` calls stay built by each feature (83 `"ExtHostLanguageFeatures"` sites), not in the language features module as the plan's goal says; its "Done when" holds. Open from 5: the editor options are read under the settings lock on every call, not once per settings change (the settings service has no change counter to key a cache on; the typing and scroll gates did not move); `language_setting`, `suggest_setting`, `editor_bool_setting` and the raw `get_value` reads of word wrap, folding, paste and comments still hold their own defaults outside `workbench/editor_options.rs`. | Each candidate's "Done when" of port/plans/architecture-deepening.md holds; `port/tools/pixel-check` and the area's `port/tools/ui-pair` steps show no difference from the commit before each candidate; `bun port/tools/ledger-check.ts` passes. |
| Milestones | M28 Zed gate | open | Artur, 2026-12-02: the port is not behind Zed in any metric of `port/tools/bench`, time and memory. Its own track, apart from M27. Behind today (README.md, port/results/benchmark.md): peak footprint and peak RSS. The plan follows a memory profile of the peak footprint. | `port/tools/bench > run.tsv && bun port/tools/bench-check.ts run.tsv vsrustium zed` prints no `BEHIND` on a quiet machine (the run's load under `max_load` of port/budgets.json). |
| M23 Linux | app/src/webview/linux.rs:66 | done | [linux L] webviews through WebKitGTK: webview panels and views, editor insets, notebook outputs, extension details, release notes. | `FIXTURE=webview-tests port/tools/linux/smoke` on X11 (Xvfb): 10/10 ok; `cargo gc test -p app webview` on Linux: 19 passed |
| M23 Linux | app/src/webview/linux.rs:47 | open | [linux L] webviews in a Wayland session. Linux shows now: no webview under Wayland: GPUI has no X window there to hold the GTK window, so `supported()` is false and each webview surface stays empty. Needs a route that does not embed: GTK opens its own Wayland connection, and a `wl_subsurface` cannot take a surface of another client, so the reparenting X11 uses has no Wayland form; WPE WebKit rendering offscreen into a GPUI texture, with input forwarded, is the route left (not started). | |
@@ -198,7 +198,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| mainthread/MainThreadDocumentContentProviders | MainThread* shape (Rust side) | M12 | verified | | main_thread.rs keeps the registrations and opens provider URIs through $provideTextDocumentContent; host_requests.rs applies $onVirtualDocumentChange as one edit (no minimal edits): api-tests MOCHA_GREP="vscode API - workspace" 94/2/13, all 8 content provider tests pass; 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"), all content provider tests |
| mainthread/MainThreadDocuments | MainThread* shape (Rust side) | M8 | verified | | host_sync.rs, host_requests.rs: port/tools/api-tests whole folder suite, `MOCHA_GREP="vscode API - editors"` 13/0/0, `MOCHA_GREP="vscode API - workspace"` 84/2/0 (the 2 upstream skips), `workspace events` 10/0/0 (port/results/api-tests.md, milestone 20 sweep); `port/tools/settings-check preferences` (vscode://defaultsettings and vscode://schemas documents) |
| mainthread/MainThreadBulkEdits | MainThread* shape (Rust side) | M12 | verified | | file edits of workspace.applyEdit (api-tests: rename & ignoreIfExists, delete & ignoreIfNotExists, #111867 1/3 to 3/3, binary files pass); text edits and EOL changes through workbench/bulk_text_edits.rs, api-tests MOCHA_GREP="vscode API - workspace" 94/2/13 with every applyEdit test passing; cell edits go to the notebook models (api-tests notebook.document `workspace edit API` cases pass, milestone 17); an edit that needs confirmation waits in the Refactor Preview, `false` for no edits (port/resul [... omitted end of long line]; file edits of workspace.applyEdit (api-tests: rename & ignoreIfExists, delete & ignoreIfNotExists, #111867 1/3 to 3/3, binary files pass); text edits and EOL changes through workbench/bulk_text_edits.rs, api-tests MOCHA_GREP="vscode API - workspace" 94/2/13 with every applyEdit test passing; cell edits fail until milestone 13; an edit that needs confirmation waits in the Refactor Preview, `false` for no edits (port/results/refactor-preview.md) |
-| mainthread/MainThreadTextEditors | MainThread* shape (Rust side) | M27 | ported | [3 S] model_events.rs: the selection that follows an edit carries the wrong source for 4 paths (mainThreadEditor.ts `onDidChangeCursorSelection` passes cursor.ts's, which `TextEditorSelectionChangeKind.fromValue` reads): an editor command sends `keyboard` where coreCommands.ts sends its id (`deleteRight`), undo `keyboard` where cursor.ts `onModelContentChanged` sends `modelChange`, replace all `api` where findModel.ts sends `replaceAll`, the final newline save participant `modelChange` where saveParticipants.ts sends `insertFinalNewLine`. | host_requests.rs, workbench/editor_view/quick_diff.rs: cargo test -p app the_host_sees_the_code_editors_of_the_rendered_cells cell_list_editors_follow_the_rendered_rows set_options_apply_the_cursor_style_and_line_numbers text_editor_show_and_hide quick_diff_contributed every_path_of_an_edit_tells_the_host_first; api-tests `MOCHA_GREP="vscode API - editors"` 13/0/0, `MOCHA_GREP="vscode API - window"` 40/0/0 (port/results/api-tests.md) |
+| mainthread/MainThreadTextEditors | MainThread* shape (Rust side) | M27 | verified | | host_requests.rs, workbench/editor_view/quick_diff.rs: cargo test -p app the_host_sees_the_code_editors_of_the_rendered_cells cell_list_editors_follow_the_rendered_rows set_options_apply_the_cursor_style_and_line_numbers text_editor_show_and_hide quick_diff_contributed every_path_of_an_edit_tells_the_host_first; api-tests `MOCHA_GREP="vscode API - editors"` 13/0/0, `MOCHA_GREP="vscode API - window"` 40/0/0 (port/results/api-tests.md) |
| mainthread/MainThreadTreeViews | MainThread* shape (Rust side) | M11 | verified | | workbench/tree_view.rs, workbench/view_containers.rs: cargo test -p app tree_view custom_tree; api-tests `MOCHA_GREP="vscode API - window|vscode API - tree"` 43/0/1 (the 1 a notebook test, milestone 17; tree.test.ts all pass); ui-pair port/fixtures/extensions/ui-tree-checkbox.json with `ARGS=--extensionDevelopmentPath=<abs>/port/fixtures/extensions/tree-checkbox`; port/results/references-view.md; scrollbars: cargo test -p app the_tree_shows_its_scrollbar_under_the_pointer (treeView.ts tree in Workbench::scrollable) |
| mainthread/MainThreadDownloadService | MainThread* shape (Rust side) | M18 | verified | | `_workbench.downloadResource` copies a file, fetches a URL and rejects a 404 with the upstream message: port/tools/extensions-check; session.rs answers undefined |
| mainthread/MainThreadErrors | MainThread* shape (Rust side) | M6 | verified | | main_thread_errors.rs: `$onUnexpectedError` goes through log.ts `createUnexpectedErrorHandler` (the stack, or `toErrorMessage`; the same text again within 1000 ms dropped) to the Window log; the session still prints it on stderr (cargo test -p app output::logger main_thread_errors: log.test.ts cases); session.rs writes `$onUnexpectedError` stacks to the port log (code-gpui stderr); seen in port/tools/api-tests api-folder.log |
@@ -393,7 +393,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 | verified | | 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 the_scrollbars_stay_shown_over_the_minimap_and_the_track; ui-pair m12/compare.json, port/fixtures/ui-pair/m8/scrollbar-hover.json (FOLDER=<reference>/src/vs/base/common FILE=strings.ts: the 14px scrollbar column matches with 0 px over 6% fuzz while the pointer is on the minimap and on the track), 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 | M27 | ported | [3 M] workbench/editor_options.rs: the editor options read through `global_editor_option` take no `[lang]` block where upstream reads them per code editor (`editor.getOption`): the find widget's options, `mouseWheelZoom`, `multiCursorModifier`, `columnSelection` (mouse), `doubleClickSelectsBlock`, `smoothScrolling`, `stickyScroll.enabled`/`maxLineCount`, the minimap's options, `contextmenu`, `definitionLinkOpensInPeek`, `mouseMiddleClickAction`, `scrollOnMiddleClick` (port/notes.md "Architecture deepening", candidate 5). | 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/common | src/vs/editor | M27 | verified | | app/src/editor, decorations.rs, link_computer.rs, syntax.rs, brackets/tree.rs, the diff crate, workbench/editor_options.rs: 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 editor_options (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 |
diff --git a/port/notes.md b/port/notes.md
index d407e68200c..9ac2e60cc74 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -1180,7 +1180,8 @@ Work the port does at another time than 1.147.0, accepted with a measured same r
- A proxy with a `(proxy, _)` arm answers a method it does not name with rpcProtocol.ts `_doInvokeHandler`'s error, `Unknown method $bar on actor MainThreadFoo` (cargo test -p app an_unknown_method_of_a_routed_proxy); before, it answered `undefined`. Every method of those proxies in extHost.protocol.ts 1.148.0 has its own arm, checked by script before the switch: the deliberate `undefined` answers are the `not_ported` arms (audit: "MainThread* methods answering `undefined`" above), and `$startFileSearch`, `$startTextSearch` and `$requestResourceTrust` answer null when the window has no workspace for the session's MainThreadWorkspace to serve them, as before.
- `$trySaveDocument` keeps its blocking path, but its handler returns `Outcome::Pending`; the blocking loop of `app/src/workbench/extension_host_restart.rs` awaits it.
- Candidate 1, one announcement of a model content change (branch refactor/m27-model-content-changed): `ContentChanged` names its model and every edit and cursor move goes through `app/src/workbench/model_events.rs::Workbench::model_content_changed` or `cursor_position_changed`, which send `$acceptModelChanged` and the shown editor's selection before any listener runs. `editor_edited`, `editor_edited_revealing`, `cursors_changed`, `send_model_edit` and `HostSync::send_content_change` are gone; `app/src/workbench/model_events/tests.rs::every_path_of_an_edit_tells_the_host_first_and_wakes_the_shown_editor` makes one edit by each of 10 paths.
-- Skips closed test first (model_events/tests.rs): a bulk, host or save participant edit of the shown model now asks code lens, inlay hints and colors again (codelensController.ts, inlayHintsController.ts, colorDetector.ts); a cursor move wakes code actions, parameter hints and linked editing (codeActionModel.ts, parameterHintsModel.ts, linkedEditing.ts); a click in the output view locks its scroll (outputView.ts `onDidChangeCursorPosition`, reason `Explicit`). The selection after an edit takes the cursor's source instead of a fixed `keyboard` (cursor.ts `onModelContentChanged` sends `modelChange`); 4 paths still send another source than upstream, a gap of the `mainthread/MainThreadTextEditors` row.
+- Skips closed test first (model_events/tests.rs): a bulk, host or save participant edit of the shown model now asks code lens, inlay hints and colors again (codelensController.ts, inlayHintsController.ts, colorDetector.ts); a cursor move wakes code actions, parameter hints and linked editing (codeActionModel.ts, parameterHintsModel.ts, linkedEditing.ts); a click in the output view locks its scroll (outputView.ts `onDidChangeCursorPosition`, reason `Explicit`). The selection after an edit takes the cursor's source instead of a fixed `keyboard` (cursor.ts `onModelContentChanged` sends `modelChange`).
+- Selection source of an edit through the editor (branch refactor/m27-selection-source): codeEditorWidget.ts `executeEdits` and `executeCommands` pass one string as both the cursor event's `source` and the edit reason's `detailedSource`, so `model_events.rs::edit_source` reads it back from `EditReason` (undo, redo and an EOL change: `modelChange`). `editor_command_ran` sends it, so `deleteRight` sends its id and undo `modelChange`; Replace All sends `replaceAll` (findModel.ts `_executeEditorCommand`), a replace keeps `api` for its move to the next match; of the save participants only `insertFinalNewLine` edits through the editor (saveParticipants.ts `FinalNewLineParticipant`). The listeners that read the source follow upstream: suggestModel.ts keeps a session for `keyboard` and `deleteLeft`, inlineCompletionsController.ts starts on typing and its `triggerCommands` (`tab`, `deleteLeft`, `deleteRight`, the insert line actions), so the other edit commands (word deletes, line operations) no longer start inline completions. Test: `every_path_of_an_edit_tells_the_host_first_and_wakes_the_shown_editor`.
- Trap: with one announcement, the find widget's own Replace All reached `find_editor_edited` and reset its match position; `ignore_own_change` skips it as findModel.ts `_ignoreModelContentChanged` does. Language detection lost its own `edited` channel and runs from the model listeners.
- Candidate 3, one extension host start per window (branch refactor/m27-host-start): `app/src/extension_host_start.rs`. Three interfaces, on one axis, where the start reads the window state the host needs (extensions, settings, storage, trust, workspace, runtime, user data): (a) from the caller, one free function over a 16-field struct both callers fill; (b) from a `HostStarter` object the workbench keeps, holding the channels and the process kind; (c) from the `Workbench` itself, `Workbench::spawn_extension_host(HostStart, HostLaunch, development)`, with only what `open_window` alone knows (`HostLaunch`: the process and `--user-data-dir`) stored once on the workbench. Picked (c): (a) leaves both callers gathering the same list, the place the copies drifted; (b) is a class beside state the workbench already owns. `HostStart::new` makes the channels and queues the color theme and language ids before `Workbench::new`, which takes the `HostSync`.
- The seam has two adapters, `HostProcess::Runtime` (Bun, or Node with `--node`) and, in tests, `HostProcess::Silent` over `ExtensionHost::silent`, which hands the test the init data and its end of the socket. The restart's `cfg!(test)` return is gone: a test's `Workbench` has no `host_launch` and only counts the start; `app/src/workbench/extension_host_restart/tests.rs::a_host_restart_starts_the_host_as_the_window_did` sets one and checks the host the restart opens.
@@ -1192,6 +1193,9 @@ Work the port does at another time than 1.147.0, accepted with a measured same r
- Open, written back to the M27 row: the module reads under the settings lock on every call, not once per settings change; the reads that stay global take no `[lang]` block (a class 3 gap of the editor/common row, moved to M27); three more per-editor readers (`format.rs::language_setting`, `suggest_controller.rs::suggest_setting`, `editor_commands.rs::editor_bool_setting`) and the raw `get_value` reads of word wrap, folding, paste and comments keep their own defaults.
- Gates on the Studio before and after candidate 5: `typing_latency_on_a_large_file` p95 at line 100, 25000 and 49000 10.06, 10.59, 11.57 ms and 10.03, 10.62, 11.80 ms; `scroll_frame_time` editor (20000 lines) median 4.15 and 4.15 ms, p95 7.97 and 7.95 ms.
- Pixel check for candidate 5: `port/tools/pixel-check` stops before and after on `ref-screenshot` timing out, so the port's own screenshots (file, main, find, folded in Dark Modern and High Contrast) were compared before and after with `pixeldiff`: file, main and folded match to the pixel; find differs by as many pixels between two runs of the same build, so the difference is run noise.
+- Closed from candidate 5 (branch refactor/m27-lang-options), test first (`editor_options/tests.rs::the_mouse_find_scroll_and_minimap_options_take_the_language_block`, which lists the 18 options that read the configuration without the block before): every editor option is language-overridable (editorConfigurationSchema.ts puts the `editorOptionsRegistry` under the `LANGUAGE_OVERRIDABLE` `editor` node, and no option sets its own scope), and its reader asks the code editor (`editor.getOption` in findController.ts, findWidget.ts, findModel.ts, multicursor.ts, mouseHandler.ts, viewController.ts, viewLayout.ts, stickyScrollController.ts, minimap.ts, sectionHeaders.ts, contextmenu.ts, goToDefinitionAtPosition.ts, clickLinkGesture.ts, contentHoverController.ts, links.ts, middleScrollController.ts, editorStatus.ts `onColumnSelectionModeChange`, editorAccessibilityHelp.ts). So the find widget's options, `selectedTextMatchMode`, `mouseWheelZoom`, `multiCursorModifier`, `columnSelection` (mouse and status bar), `doubleClickSelectsBlock`, `smoothScrolling`, `stickyScroll.enabled` and `maxLineCount`, every `editor.minimap.*` option (the raw reads of size, side, showSlider, autohide, maxColumn, scale and the section header font became typed options), `contextmenu`, `definitionLinkOpensInPeek`, `mouseMiddleClickAction` and `scrollOnMiddleClick` take the editor's `[lang]` block. A site with the editor at hand calls `editor_option(editor, ...)`; the mouse, find and scroll sites call `Workbench::active_editor_option`, the active code editor being the one `with_group` and `with_code_editor` put under them. Global as upstream: the `multiCursorModifier` context key and Toggle Multi-Cursor Modifier (toggleMultiCursorModifier.ts reads `configurationService.getValue('editor')`).
+- Not folded into the module: `language_setting`, `suggest_setting` and `editor_bool_setting` (80 call sites, string keys, several of them settings that are not editor options such as `editor.defaultFormatter` and `editor.formatOnSave`, and the nested `editor.suggest.*` and `editor.quickSuggestions` objects) and the raw reads of word wrap, folding, paste and comments: each needs its own typed option and validator checked against editorOptions.ts, more than this change; they already take the `[lang]` block.
+- Gates on the Studio before and after: `typing_latency_on_a_large_file` p95 at line 100, 25000 and 49000 10.84, 11.24, 11.67 ms and 10.24, 10.77, 11.85 ms; `scroll_frame_time` editor (20000 lines) median 4.32 and 4.34 ms, p95 8.27 and 8.25 ms, over the 8 ms gate on the commit before too (2e1d027c7ef). No pixel check: no default `[lang]` block (modesRegistry.ts, the built-in extensions' `configurationDefaults`) sets one of these options, so the values and the render do not change in the default settings.
- Candidate 6, language feature registrations decoded once (branch refactor/m27-language-registrations): `app/src/language_features.rs::Registration::decode`. Three interfaces, on one axis, the form a feature reads a decoded registration in: (a) an enum with one variant per `$register*` method and its fields (`Provider::DocumentLink { supports_resolve }`), matched at each site; (b) one flat struct whose fields carry the protocol's names (`supports_resolve`, `event_handle`, `extension_id`, `metadata`, `trigger_characters`, ...), filled by one table keyed by the method in `register`, a field the method lacks keeping its default; (c) accessor methods over the kept wire tuple (`registration.supports_resolve()`), each knowing its position per method. Picked (b): every site already picks its registrations by method, so (a) makes each read a `let ... else` with an unreachable arm, and (c) decodes on every read and keeps the tuple for the next positional read. `register(method, args)` keeps its signature, so the callers and tests that register stay as they were.
- Every positional read moved, the 30 of the plan's check and 5 sites its pattern misses: `provided_kinds(&registration.args)` (code actions, 3 sites), `format.rs::formatter` (`args[2..4]` through a local) and `inline_completions.rs::inline_completion_handles`, which handed the whole tuple to the debounce (`debounceDelayMs`, position 8). `format.rs::extension_id` moved into the decode. No difference from upstream found: each field sits where extHost.protocol.ts `MainThreadLanguageFeaturesShape` puts it (`app/src/language_features/tests.rs::register_decodes_each_method_at_its_protocol_positions`).
- Not done from the plan's goal: the `$provide*` calls stay built by each feature (`"ExtHostLanguageFeatures"`, 83 sites). Their arguments are the feature's own request (a URI, a position, a context), not a shape the features repeat, so one builder per call would be a wrapper over `vec![...]` with nothing hidden; the plan's "Done when" does not ask for it.