Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
debugger: Fix nits (#30632)
Remco Smits48b376fdc9d5
diff --git a/crates/debugger_ui/src/tests/inline_values.rs b/crates/debugger_ui/src/tests/inline_values.rsindex 76b94360807..6fed57ecacc 100644--- a/crates/debugger_ui/src/tests/inline_values.rs+++ b/crates/debugger_ui/src/tests/inline_values.rs@@ -1,7 +1,7 @@use std::{path::Path, sync::Arc};use dap::{Scope, StackFrame, Variable, requests::Variables};-use editor::{Editor, EditorMode, MultiBuffer, actions::ToggleInlineValues};+use editor::{Editor, EditorMode, MultiBuffer};use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext};use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_python, tree_sitter_rust};use project::{FakeFs, Project};@@ -239,11 +239,7 @@ fn main() {});cx.run_until_parked();- editor.update_in(cx, |editor, window, cx| {- if !editor.inline_values_enabled() {- editor.toggle_inline_values(&ToggleInlineValues, window, cx);- }- });+ editor.update(cx, |editor, cx| editor.refresh_inline_values(cx));cx.run_until_parked();@@ -1604,11 +1600,7 @@ def process_data(untyped_param, typed_param: int, another_typed: str):)});- editor.update_in(cx, |editor, window, cx| {- if !editor.inline_values_enabled() {- editor.toggle_inline_values(&ToggleInlineValues, window, cx);- }- });+ editor.update(cx, |editor, cx| editor.refresh_inline_values(cx));client.on_request::<dap::requests::Threads, _>(move |_, _| {Ok(dap::ThreadsResponse {diff --git a/crates/language/src/language_settings.rs b/crates/language/src/language_settings.rsindex 3bcff8913ae..d7a237cf490 100644--- a/crates/language/src/language_settings.rs+++ b/crates/language/src/language_settings.rs@@ -980,8 +980,8 @@ pub struct InlayHintSettings {pub enabled: bool,/// Global switch to toggle inline values on and off.///- /// Default: false- #[serde(default)]+ /// Default: true+ #[serde(default = "default_true")]pub show_value_hints: bool,/// Whether type hints should be shown.///diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rsindex 90ca66a2d40..ff20de4d3c2 100644--- a/crates/project/src/debugger/dap_store.rs+++ b/crates/project/src/debugger/dap_store.rs@@ -577,6 +577,17 @@ impl DapStore {let snapshot = buffer_handle.read(cx).snapshot();let all_variables = session.read(cx).variables_by_stack_frame_id(stack_frame_id);+ fn format_value(mut value: String) -> String {+ const LIMIT: usize = 100;++ if value.len() > LIMIT {+ value.truncate(LIMIT);+ value.push_str("...");+ }++ format!(": {}", value)+ }+cx.spawn(async move |_, cx| {let mut inlay_hints = Vec::with_capacity(inline_value_locations.len());for inline_value_location in inline_value_locations.iter() {@@ -597,7 +608,7 @@ impl DapStore {inlay_hints.push(InlayHint {position,- label: InlayHintLabel::String(format!(": {}", variable.value)),+ label: InlayHintLabel::String(format_value(variable.value.clone())),kind: Some(InlayHintKind::Type),padding_left: false,padding_right: false,@@ -620,7 +631,7 @@ impl DapStore {if let Some(response) = eval_task.await.log_err() {inlay_hints.push(InlayHint {position,- label: InlayHintLabel::String(format!(": {}", response.result)),+ label: InlayHintLabel::String(format_value(response.result)),kind: Some(InlayHintKind::Type),padding_left: false,padding_right: false,