maurobalbi / glas

Apache License 2.0
41 stars 2 forks source link

All extension's requests fail due to panic #13

Closed MalinavyBusel closed 6 months ago

MalinavyBusel commented 6 months ago

System: Ubuntu 22, rustc 1.75.0

This is the extension output example:

thread 'tokio-runtime-worker' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/salsa-0.17.0-pre.2/src/input.rs:106:32:
no value set for FileSourceRootQuery(FileId(0))
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   3: <DB as ide::base::SourceDatabase>::file_source_root::__shim
   4: ide::def::scope::module_scope_with_map_query
   5: salsa::runtime::Runtime::execute_query_implementation
   6: salsa::derived::slot::Slot<Q,MP>::read_upgrade
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: salsa::QueryTable<Q>::get
  10: <DB as ide::def::DefDatabase>::module_scope_with_map
  11: salsa::runtime::Runtime::execute_query_implementation
  12: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  15: <DB as ide::def::DefDatabase>::module_source_map::__shim
  16: ide::def::semantics::find_container
  17: ide::ide::hover::hover
  18: salsa::Cancelled::catch
  19: ide::ide::Analysis::hover
  20: glas::handler::hover
  21: glas::server::with_catch_unwind
  22: tokio::runtime::task::core::Core<T,S>::poll
  23: tokio::runtime::task::harness::Harness<T,S>::poll
  24: tokio::runtime::blocking::pool::Inner::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

[Error - 17:17:12] Request textDocument/hover failed.
  Message: Panicked in textDocument/hover: no value set for FileSourceRootQuery(FileId(0))
Location: /cargo/registry/src/index.crates.io-6f17d22bba15001f/salsa-0.17.0-pre.2/src/input.rs:106:32
Backtrace:    0:     0x7fe5f48367fe - std::backtrace_rs::backtrace::libunwind::trace::h7d9d6777fb8bb20d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fe5f48367fe - std::backtrace_rs::backtrace::trace_unsynchronized::hf7cc901404488615
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe5f48367fe - std::backtrace::Backtrace::create::hd75710cb70a42f36
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/backtrace.rs:331:13
   3:     0x7fe5f4836740 - std::backtrace::Backtrace::force_capture::h7402a920a98228b8
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/backtrace.rs:312:9
   4:     0x7fe5f452ec03 - glas::server::with_catch_unwind::{{closure}}::{{closure}}::h067ed652390b6a61
   5:     0x7fe5f4842b36 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha49528d6bb122ccd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2029:9
   6:     0x7fe5f4842b36 - std::panicking::rust_panic_with_hook::hc412fca92650d4b2
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:783:13
   7:     0x7fe5f4842882 - std::panicking::begin_panic_handler::{{closure}}::hf6e9952ead3e2c54
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
   8:     0x7fe5f4841056 - std::sys_common::backtrace::__rust_end_short_backtrace::h1410a9c85ac94b3e
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
   9:     0x7fe5f48425e0 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  10:     0x7fe5f448c885 - core::panicking::panic_fmt::h2838d0515af9b2ed
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  11:     0x7fe5f479292b - <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch::he0b0e02df5dc779d
  12:     0x7fe5f47a90fa - <DB as ide::base::SourceDatabase>::file_source_root::__shim::h478deda2930e308f
  13:     0x7fe5f477b177 - ide::def::scope::module_scope_with_map_query::h164de293526c30f2
  14:     0x7fe5f478679a - salsa::runtime::Runtime::execute_query_implementation::h05e08b4b824059dd
  15:     0x7fe5f47b3ba9 - salsa::derived::slot::Slot<Q,MP>::read_upgrade::h4143b2c7eab33d8d
  16:     0x7fe5f47d15d4 - salsa::derived::slot::Slot<Q,MP>::read::hec8921686c06954d
  17:     0x7fe5f4771735 - <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch::hddad7f0d0b967ae0
  18:     0x7fe5f47861de - salsa::QueryTable<Q>::get::h7f23c23d63a8012f
  19:     0x7fe5f473981f - <DB as ide::def::DefDatabase>::module_scope_with_map::h88856ee117664130
  20:     0x7fe5f47869cb - salsa::runtime::Runtime::execute_query_implementation::h06add4c949ed1ddc
  21:     0x7fe5f47b51dc - salsa::derived::slot::Slot<Q,MP>::read_upgrade::h540d66a3b5fb77d0
  22:     0x7fe5f47ceb3d - salsa::derived::slot::Slot<Q,MP>::read::h796e06c36b726a60
  23:     0x7fe5f476e284 - <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch::h10f43a3e12f3071f
  24:     0x7fe5f479a94a - <DB as ide::def::DefDatabase>::module_source_map::__shim::h31266f8d959614d0
  25:     0x7fe5f4737c52 - ide::def::semantics::find_container::h83283511dd339c32
  26:     0x7fe5f4797155 - ide::ide::hover::hover::hf436f79a802db256
  27:     0x7fe5f47885b5 - salsa::Cancelled::catch::he9c8286c27095da6
  28:     0x7fe5f4738a10 - ide::ide::Analysis::hover::ha716ef33cd2f8e9c
  29:     0x7fe5f45522fc - glas::handler::hover::h34f9551c5c5d20fb
  30:     0x7fe5f44f42d0 - glas::server::with_catch_unwind::h688c6907f203d18b
  31:     0x7fe5f456bbf5 - tokio::runtime::task::core::Core<T,S>::poll::h5512e2189bd18e90
  32:     0x7fe5f4518b16 - tokio::runtime::task::harness::Harness<T,S>::poll::h9dfbf7e146c85fc3
  33:     0x7fe5f46a953c - tokio::runtime::blocking::pool::Inner::run::h97622e1faf281135
  34:     0x7fe5f46b8fa4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h00e99ec19de4aaad
  35:     0x7fe5f46b99a9 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hd46e71c8ef512c30
  36:     0x7fe5f4847f05 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0c19c267a854c212
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2015:9
  37:     0x7fe5f4847f05 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc50bf08128f952fb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2015:9
  38:     0x7fe5f4847f05 - std::sys::unix::thread::Thread::new::thread_start::ha18af1a028ebd29e
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys/unix/thread.rs:108:17

  Code: -32603 
maurobalbi commented 6 months ago

Thanks for the report! Do you have some more info and / or a repo with the code that caused the problem? Otherwise it's difficult to reproduce the issue.

Edit: I could reproduce the issue, currently gleam files that are in directories which haven't been initialised with gleam new are causing crashes.

MalinavyBusel commented 6 months ago

actually i have this issue even when i'm in directory created with gleam new

upd: if write in src dir, glas works, but without completion

maurobalbi commented 6 months ago

Thanks for the update! I could reproduce the issue. When first opening a fresh gleam project, the order of downloading / loading the packages is in the wrong order. After a Reload window or reopening the project it should work properly however!