@@ -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 {
@@ -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.
///
@@ -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,