Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant panic on opening any .go file #1746

Closed
max-privatevoid opened this issue Mar 4, 2022 · 1 comment · Fixed by #1747
Closed

Instant panic on opening any .go file #1746

max-privatevoid opened this issue Mar 4, 2022 · 1 comment · Fixed by #1747
Labels
A-packaging Area: Packaging and bundling C-bug Category: This is a bug

Comments

@max-privatevoid
Copy link
Contributor

Bisect suggests ddbf036 may be the culprit. git reverting it over master fixes the crash, but I assume there's a better way to solve this than reverting an update.

Reproduction steps

$ RUST_BACKTRACE=full nix run github:helix-editor/helix/d62ad8b595a4f901b9c5dba1bb6e8f70ece395bf main.go
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: QueryError { row: 101, column: 3, offset: 1514, message: "", kind: NodeType }', src/syntax.rs:405:14
stack backtrace:
   0:     0x5632ad0a9b5c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0cbaef3adcb5a454
   1:     0x5632ad0d101c - core::fmt::write::h35a8eb836b847360
   2:     0x5632ad0a1f25 - std::io::Write::write_fmt::h45f2b8390f189782
   3:     0x5632ad0abd80 - std::panicking::default_hook::{{closure}}::ha3121a0b8482251f
   4:     0x5632ad0ab935 - std::panicking::default_hook::hde5d78c11ae3b8f6
   5:     0x5632ad0ac434 - std::panicking::rust_panic_with_hook::he6f55c3e7ed1777c
   6:     0x5632ad0abf10 - std::panicking::begin_panic_handler::{{closure}}::h4b51effcc76f0c14
   7:     0x5632ad0aa024 - std::sys_common::backtrace::__rust_end_short_backtrace::haae2fe666128308b
   8:     0x5632ad0abe79 - rust_begin_unwind
   9:     0x5632ac9c4cf1 - core::panicking::panic_fmt::h6434c641853e4979
  10:     0x5632ac9c4de3 - core::result::unwrap_failed::hf9ff91c3b831b4ba
  11:     0x5632acf7ec1c - helix_core::syntax::LanguageConfiguration::initialize_highlight::h4500e51f6c0b6928
  12:     0x5632acf456b1 - once_cell::imp::OnceCell<T>::initialize::{{closure}}::h22ea5bd89e8d5102
  13:     0x5632ad051a70 - once_cell::imp::initialize_inner::h6747fc915c876fca
  14:     0x5632ac9bd21e - once_cell::imp::OnceCell<T>::initialize::h271a4a4dda922aa2
  15:     0x5632acf7ecfe - helix_core::syntax::LanguageConfiguration::highlight_config::h15ff58ac6015c550
  16:     0x5632acd3485e - helix_view::document::Document::set_language::hbd56d9c313acc8c5
  17:     0x5632acd33b70 - helix_view::document::Document::open::h9ecfdc62f67e8ce3
  18:     0x5632acd65fab - helix_view::editor::Editor::open::heac526db9fc57c0c
  19:     0x5632acb64b26 - helix_term::application::Application::new::hea8cd9414345bd8f
  20:     0x5632aca3fac0 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h9c65e2e3b727a46e
  21:     0x5632aca137bb - tokio::park::thread::CachedParkThread::block_on::h83e570717eb07b10
  22:     0x5632aca0775d - tokio::runtime::thread_pool::ThreadPool::block_on::h43b02ba3fbb56fb3
  23:     0x5632aca399e2 - tokio::runtime::Runtime::block_on::h8818931c0b17ddaa
  24:     0x5632aca0c009 - hx::main::hc2db7538b4e4c8d1
  25:     0x5632aca0c363 - std::sys_common::backtrace::__rust_begin_short_backtrace::h7ec710ba38eef7ce
  26:     0x5632aca1550d - std::rt::lang_start::{{closure}}::hf422623347b49e6f
  27:     0x5632ad0a97eb - std::rt::lang_start_internal::hec7f1b06f38d8409
  28:     0x5632aca0c152 - main
  29:     0x7f8bb2470780 - __libc_start_main
  30:     0x5632ac9c549a - _start
  31:                0x0 - <unknown>

Environment

  • Platform: Linux
  • Terminal emulator: Tilix
  • Helix version: v0.5.0-832-gd62ad8b5
~/.cache/helix/helix.log N/A
@max-privatevoid max-privatevoid added the C-bug Category: This is a bug label Mar 4, 2022
@the-mikedavis the-mikedavis added the A-packaging Area: Packaging and bundling label Mar 4, 2022
@the-mikedavis
Copy link
Member

It looks like this only happens when running from the flake, presumably because the flake pulls down the grammars at a specific and now out-of-date revision (see here). I think we should be safe to just bump that linked ref field. Long-term this will be fixed by #1659.

the-mikedavis added a commit to the-mikedavis/helix that referenced this issue Mar 4, 2022
closes helix-editor#1746

The queries for Go were updated in ddbf036.
The old ref was before this commit, so running helix from the flake

    nix flake run github:helix-editor/helix/d62ad8b595a4f901b9c5dba1bb6e8f70ece395bf -- path/to/file.go

will crash because the old grammar's query analysis will fail (because `iota`
was not yet a named node).

This commit updates the version of the grammars that we pull down when building
the flake so that the queries match the grammars. We'll have to do an update like
this whenever a grammar is bumped in a breaking way (which happens fairly often
in tree-sitter) until helix-editor#1659 comes along and the version of the grammar becomes
tied to the version declared in source.
archseer pushed a commit that referenced this issue Mar 5, 2022
closes #1746

The queries for Go were updated in ddbf036.
The old ref was before this commit, so running helix from the flake

    nix flake run github:helix-editor/helix/d62ad8b595a4f901b9c5dba1bb6e8f70ece395bf -- path/to/file.go

will crash because the old grammar's query analysis will fail (because `iota`
was not yet a named node).

This commit updates the version of the grammars that we pull down when building
the flake so that the queries match the grammars. We'll have to do an update like
this whenever a grammar is bumped in a breaking way (which happens fairly often
in tree-sitter) until #1659 comes along and the version of the grammar becomes
tied to the version declared in source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-packaging Area: Packaging and bundling C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants