zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.46k stars 3.12k forks source link

Store inlay hint enabledness in user settings #20974

Open Poldraunic opened 1 day ago

Poldraunic commented 1 day ago

This is my stab at fixing #15909.

Editor::toggle_tab_bar() function is taken as an example for this. This seems to work, but there is following message in the console [2024-11-21T11:09:53+03:00 ERROR settings] invalid type: null, expected struct InlayHintSettingsContent and a stacktrace that I can't figure out.

stacktrace ``` Stack backtrace: 0: std::backtrace_rs::backtrace::dbghelp64::trace at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91 1: std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66 2: std::backtrace::Backtrace::create at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\backtrace.rs:331 3: std::backtrace::Backtrace::capture at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\backtrace.rs:296 4: anyhow::error::impl$1::from at C:\Users\Joe\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.93\src\backtrace.rs:27 5: core::result::impl$27::from_residual at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\result.rs:1989 6: settings::settings_store::impl$7::deserialize_setting at .\crates\settings\src\settings_store.rs:1094 7: settings::settings_store::SettingsStore::recompute_values at .\crates\settings\src\settings_store.rs:860 8: settings::settings_store::SettingsStore::set_extension_settings at .\crates\settings\src\settings_store.rs:694 9: languages::init::closure$2::async_block$0::closure$0::closure$0 at .\crates\languages\src\lib.rs:294 10: gpui::impl$1::update_global,languages::init::closure$2::async_block$0::closure$0::closure_env$0> at .\crates\gpui\src\gpui.rs:315 11: gpui::global::impl$1::update_global > at .\crates\gpui\src\global.rs:66 12: languages::init::closure$2::async_block$0::closure$0 at .\crates\languages\src\lib.rs:293 13: gpui::app::async_context::AsyncAppContext::update,languages::init::closure$2::async_block$0::closure_env$0> at .\crates\gpui\src\app\async_context.rs:137 14: languages::init::closure$2::async_block$0 at .\crates\languages\src\lib.rs:292 15: core::future::future::impl$1::poll,anyhow::Error> > > > >,alloc::alloc::Global> > at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\future\future.rs:123 16: async_task::runnable::impl$6::spawn_local::impl$1::poll,anyhow::Error> > > > >,alloc::alloc::Global> > > at C:\Users\Joe\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-task-4.7.1\src\runnable.rs:455 17: async_task::raw::RawTask::run,anyhow::Error> > > > >,alloc::alloc::Global> > >,enum2$ > at C:\Users\Joe\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-task-4.7.1\src\runnable.rs:781 19: gpui::platform::windows::platform::WindowsPlatform::run_foreground_tasks at .\crates\gpui\src\platform\windows\platform.rs:171 20: gpui::platform::windows::platform::impl$2::run at .\crates\gpui\src\platform\windows\platform.rs:226 21: gpui::app::App::run at .\crates\gpui\src\app.rs:161 22: zed::main at .\crates\zed\src\main.rs:253 23: core::ops::function::FnOnce::call_once > at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\ops\function.rs:250 24: core::hint::black_box at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\core\src\hint.rs:389 25: std::sys::backtrace::__rust_begin_short_backtrace > at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\sys\backtrace.rs:152 26: std::rt::lang_start::closure$0 > at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\rt.rs:162 27: std::rt::lang_start_internal::closure$2 at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\rt.rs:141 28: std::panicking::try::do_call at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:557 29: std::panicking::try at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panicking.rs:521 30: std::panic::catch_unwind at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\panic.rs:350 31: std::rt::lang_start_internal at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library\std\src\rt.rs:141 32: std::rt::lang_start > at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c\library\std\src\rt.rs:161 33: main 34: invoke_main at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78 35: __scrt_common_main_seh at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 36: BaseThreadInitThunk 37: RtlUserThreadStart ```

I think there is something that must be done, but I don't know what. Help and comments are very much welcomed and appreciated.

Release Notes:

osiewicz commented 1 day ago

Based on that stacktrace you probably need to update assets/default.json, as its deserialization fails. See e.g. #16852 for an example.