Skip to content

Visual Studio Code, rebuilt in Rust

Rust

fix(output): wrap lines in the Output view (#97)

Artur Rok6cdcd98757e9
diff --git a/native/crates/app/src/workbench/output_view/tests.rs b/native/crates/app/src/workbench/output_view/tests.rs
index 25c5d150de4..764244f3923 100644
--- a/native/crates/app/src/workbench/output_view/tests.rs
+++ b/native/crates/app/src/workbench/output_view/tests.rs
@@ -134,6 +134,29 @@ fn open_output_in_editor_shows_the_channel_in_an_editor_group(cx: &mut TestAppCo
std::fs::remove_dir_all(dir).unwrap();
}
+/// outputView.ts `getConfigurationOverrides`: the Output view wraps with `editor.wordWrap` off, and `[Log]`'s
+/// `editor.wordWrap` overrides that.
+#[gpui::test]
+fn the_output_view_wraps_unless_log_settings_say_otherwise(cx: &mut TestAppContext) {
+ let (workbench, cx, _receiver, dir) = open(cx);
+ let file = dir.join("1-hello.log");
+ std::fs::write(&file, "x ".repeat(400)).unwrap();
+ let id = request(&workbench, cx, "MainThreadOutputService", "$register", json!(["hello", { "scheme": "file", "path": file }, null, "pub.ext"]));
+ request(&workbench, cx, "MainThreadOutputService", "$reveal", json!([id, false]));
+ let wraps = |cx: &mut VisualTestContext| {
+ workbench.update_in(cx, |workbench, window, cx| workbench.focus_group(crate::editor::PANEL_GROUP, window, cx));
+ for _ in 0..2 {
+ cx.update(|window, _| window.refresh());
+ cx.run_until_parked();
+ }
+ workbench.read_with(cx, |workbench, _| workbench.output_editor().unwrap().wraps())
+ };
+ assert!(wraps(cx));
+ workbench.update(cx, |workbench, _| workbench.update_user_setting("[Log]", json!({ "editor.wordWrap": "off" })));
+ assert!(!wraps(cx));
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
/// mainThreadOutputService.ts `_showChannelQuietly`: a hidden Output view with `workbench.view.showQuietly` stays
/// hidden and a status bar entry offers the channel.
#[gpui::test]
diff --git a/native/crates/app/src/workbench/word_wrap.rs b/native/crates/app/src/workbench/word_wrap.rs
index bcb0ae7f528..4cf45afd945 100644
--- a/native/crates/app/src/workbench/word_wrap.rs
+++ b/native/crates/app/src/workbench/word_wrap.rs
@@ -116,6 +116,11 @@ impl Workbench {
Some(false) => "off".to_string(),
// simpleCommentEditor.ts `getEditorOptions`: wordWrap on.
None if editor.document().scheme == super::comments::INPUT_SCHEME => "on".to_string(),
+ // outputView.ts `getConfigurationOverrides`: the Output view wraps unless `[Log]` sets `editor.wordWrap`.
+ None if self.editors.id == crate::editor::PANEL_GROUP && editor.document().scheme == crate::output::OUTPUT_SCHEME => {
+ let log = settings.get_value(Some("[Log]"), &Overrides::default()).unwrap_or(Value::Null);
+ log["editor.wordWrap"].as_str().unwrap_or("on").to_string()
+ }
None => value("editor.wordWrap").as_str().unwrap_or("off").to_string(),
};
let word_wrap_column = value("editor.wordWrapColumn").as_u64().unwrap_or(80).max(1) as usize;
diff --git a/port/ledger.md b/port/ledger.md
index dbeace3f4c9..f230bc4ffc8 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -624,7 +624,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| workbench/contrib/onboarding | workbench contribution | M19 | removed | | the only registered tours are the Agents window ones (src/vs/sessions/contrib/onboardingTours): no AI by decision (port/notes.md) |
| workbench/contrib/opener | workbench contribution | M12 | verified | | workbench/opener.rs open_folder_link: a link to a workspace folder reveals it in the Explorer; verified at port-m12b-verify: cargo test -p app opener 4/4 |
| workbench/contrib/outline | workbench contribution | M13 | verified | | workbench/outline_pane.rs, workbench/outline_actions.rs, workbench/outline_find.rs, workbench/icon_label.rs: cargo test -p app outline_pane outline the_compare_commands_open_diff_editors focus_view_commands_open_the_explorer_pane_and_focus_it find_filters_or_highlights_the_symbols the_keys_move_the_focus_and_the_list_commands_act_on_it a_description_is_0_9em; cargo test -p app -- a_row_s_contents_start_30px_into_the_row the_detail_follows_the_name_s_exact_width; ui-pair m12/compare-outline.json, steps-outline.json (port/results/language-features.md), m12/outline-find.json, search and quick open rows |
-| workbench/contrib/output | workbench contribution | M15 | verified | | output/compound.rs, output/links.rs, workbench/output_compound.rs, output_view.rs, output_actions.rs: cargo test -p app output open_output_in_editor_shows_the_channel_in_an_editor_group toggle_output_opens_and_closes_the_view a_quiet_reveal_offers_the_channel_in_the_status_bar logs_export_to_a_file_and_import_as_a_channel output_paths_in_the_workspace_are_links compute_links filters_hide_log_entries filters_hide_entries_and_lines |
+| workbench/contrib/output | workbench contribution | M15 | verified | | output/compound.rs, output/links.rs, workbench/output_compound.rs, output_view.rs, output_actions.rs: cargo test -p app output open_output_in_editor_shows_the_channel_in_an_editor_group toggle_output_opens_and_closes_the_view a_quiet_reveal_offers_the_channel_in_the_status_bar logs_export_to_a_file_and_import_as_a_channel output_paths_in_the_workspace_are_links compute_links filters_hide_log_entries filters_hide_entries_and_lines the_output_view_wraps_unless_log_settings_say_otherwise |
| workbench/contrib/performance | workbench contribution | M19 | verified | | Developer: Startup Performance (perf_view.rs, perfviewEditor.ts): System Info, Performance Marks from the timer service, Extension Activation Stats, Raw Perf Marks of the renderer and localExtHost; inputLatencyContrib, startupTimings and the auto profilers only report telemetry or take V8 profiles (no telemetry by decision, platform/profiling n/a); cargo test -p app timer:: perf_view; System Info takes the CPU speed and VM likelihood as Node's `os` reports them and no process memory, which 1.147 turns off (cargo test -p app the_system_info_lists apple_silicon_reports_libuvs_fallback_cpu_speed) |
| workbench/contrib/policyExport | workbench contribution | M10 | removed | | build tool: `--export-policy-data` writes the policy definitions that upstream's build turns into ADMX and macOS profiles; the port ships no policy templates |
| workbench/contrib/preferences | workbench contribution | M10 | verified | | settings_editor.rs, workbench/settings_editor_view.rs, workbench/keybindings_editor_view.rs, workbench/define_keybinding.rs, smart_snippet_inserter.rs, workbench/preferences/unsupported_settings.rs: cargo test -p app settings_editor keybindings_editor_view define_keybinding smart_snippet_inserter preferences unsupported_settings a_policy_setting_disables_its_select_and_its_hover_applies_the_policy_filter the_lang_filter_shows_the_language_block_value descriptions_render_emphasis_lists_and_setting_links an_extension_source_opens_the_extension the_editor_hover_shows_the_message_of_a_marked_key; ui-pair port/results/settings-editor.md, port/results/keybindings-editor.md. keyboardLayoutPicker.ts n/a (web only) |