Skip to content
New issue

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

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

Already on GitHub? # to your account

Panics when deleting multiple selections #3730

Closed
getreu opened this issue Sep 7, 2022 · 9 comments
Closed

Panics when deleting multiple selections #3730

getreu opened this issue Sep 7, 2022 · 9 comments
Labels
C-bug Category: This is a bug

Comments

@getreu
Copy link
Contributor

getreu commented Sep 7, 2022

Summary

Helix panics when deleting multiple selections. Experienced with tutor exercise 10.1

hx --tutor
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', helix-view/src/document.rs:1039:62
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction Steps

I tried this:

  1. hx --tutor
  2. Goto exercise 10.1
  3. Type xx, then swould as suggested in the exercise.
  4. Type d to delete multiple selections.

Helix log

~/.cache/helix/helix.log
2022-09-07T04:01:43.430 helix_lsp::transport [ERROR] err <- "Sep 07, 2022 4:01:43 AM org.bsplines.ltexls.server.LtexLanguageServer initialize\n"
2022-09-07T04:01:43.431 helix_lsp::transport [ERROR] err <- "INFO: ltex-ls 15.2.1-alpha.1.nightly.2022-04-18 - initializing...\n"
2022-09-07T04:10:40.919 helix_lsp::transport [ERROR] err <- "Sep 07, 2022 4:10:40 AM org.bsplines.ltexls.server.LtexLanguageServer initialize\n"
2022-09-07T04:10:40.919 helix_lsp::transport [ERROR] err <- "INFO: ltex-ls 15.2.1-alpha.1.nightly.2022-04-18 - initializing...\n"
2022-09-07T04:10:40.956 helix_lsp::transport [ERROR] err <- "thread 'MacroExpander' panicked at 'assertion failed: `(left != right)`\n"
2022-09-07T04:10:40.956 helix_lsp::transport [ERROR] err <- "  left: `0`,\n"
2022-09-07T04:10:40.956 helix_lsp::transport [ERROR] err <- " right: `0`', crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/bridge/handle.rs:22:9\n"
2022-09-07T04:10:40.956 helix_lsp::transport [ERROR] err <- "stack backtrace:\n"
2022-09-07T04:10:40.981 helix_lsp::transport [ERROR] err <- "   0: rust_begin_unwind\n"
2022-09-07T04:10:40.981 helix_lsp::transport [ERROR] err <- "             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5\n"
2022-09-07T04:10:40.981 helix_lsp::transport [ERROR] err <- "   1: core::panicking::panic_fmt\n"
2022-09-07T04:10:40.981 helix_lsp::transport [ERROR] err <- "             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14\n"
2022-09-07T04:10:40.981 helix_lsp::transport [ERROR] err <- "   2: core::panicking::assert_failed_inner\n"
2022-09-07T04:10:40.982 helix_lsp::transport [ERROR] err <- "   3: core::panicking::assert_failed\n"
2022-09-07T04:10:40.982 helix_lsp::transport [ERROR] err <- "   4: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::HandleStore<S>::new\n"
2022-09-07T04:10:40.983 helix_lsp::transport [ERROR] err <- "   5: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::run_server\n"
2022-09-07T04:10:40.984 helix_lsp::transport [ERROR] err <- "   6: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::<impl proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::Client<(proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream,proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream),proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream>>::run\n"
2022-09-07T04:10:40.984 helix_lsp::transport [ERROR] err <- "   7: proc_macro_srv::abis::abi_1_63::Abi::expand\n"
2022-09-07T04:10:40.985 helix_lsp::transport [ERROR] err <- "   8: proc_macro_srv::abis::Abi::expand\n"
2022-09-07T04:10:40.985 helix_lsp::transport [ERROR] err <- "   9: proc_macro_srv::dylib::Expander::expand\n"
2022-09-07T04:10:40.985 helix_lsp::transport [ERROR] err <- "  10: proc_macro_srv::cli::run\n"
2022-09-07T04:10:40.986 helix_lsp::transport [ERROR] err <- "note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"
2022-09-07T04:14:34.610 helix_term::application [WARN] failed to load theme `autumn` - No such file or directory (os error 2)
2022-09-07T04:14:38.254 helix_term::application [ERROR] Timed out waiting for language servers to shutdown
2022-09-07T04:15:13.695 helix_lsp::transport [ERROR] err <- "thread 'MacroExpander' panicked at 'assertion failed: `(left != right)`\n"
2022-09-07T04:15:13.695 helix_lsp::transport [ERROR] err <- "  left: `0`,\n"
2022-09-07T04:15:13.695 helix_lsp::transport [ERROR] err <- " right: `0`', crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/bridge/handle.rs:22:9\n"
2022-09-07T04:15:13.695 helix_lsp::transport [ERROR] err <- "stack backtrace:\n"
2022-09-07T04:15:13.698 helix_lsp::transport [ERROR] err <- "   0: rust_begin_unwind\n"
2022-09-07T04:15:13.698 helix_lsp::transport [ERROR] err <- "             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5\n"
2022-09-07T04:15:13.699 helix_lsp::transport [ERROR] err <- "   1: core::panicking::panic_fmt\n"
2022-09-07T04:15:13.699 helix_lsp::transport [ERROR] err <- "             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14\n"
2022-09-07T04:15:13.699 helix_lsp::transport [ERROR] err <- "   2: core::panicking::assert_failed_inner\n"
2022-09-07T04:15:13.699 helix_lsp::transport [ERROR] err <- "   3: core::panicking::assert_failed\n"
2022-09-07T04:15:13.699 helix_lsp::transport [ERROR] err <- "   4: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::HandleStore<S>::new\n"
2022-09-07T04:15:13.699 helix_lsp::transport [ERROR] err <- "   5: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::run_server\n"
2022-09-07T04:15:13.700 helix_lsp::transport [ERROR] err <- "   6: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::<impl proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::Client<(proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream,proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream),proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream>>::run\n"
2022-09-07T04:15:13.700 helix_lsp::transport [ERROR] err <- "   7: proc_macro_srv::abis::abi_1_63::Abi::expand\n"
2022-09-07T04:15:13.700 helix_lsp::transport [ERROR] err <- "   8: proc_macro_srv::abis::Abi::expand\n"
2022-09-07T04:15:13.700 helix_lsp::transport [ERROR] err <- "   9: proc_macro_srv::dylib::Expander::expand\n"
2022-09-07T04:15:13.700 helix_lsp::transport [ERROR] err <- "  10: proc_macro_srv::cli::run\n"
2022-09-07T04:15:13.700 helix_lsp::transport [ERROR] err <- "note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"
2022-09-07T04:15:14.932 helix_lsp::transport [ERROR] err <- "Sep 07, 2022 4:15:14 AM org.bsplines.ltexls.server.LtexLanguageServer initialize\n"
2022-09-07T04:15:14.932 helix_lsp::transport [ERROR] err <- "INFO: ltex-ls 15.2.1-alpha.1.nightly.2022-04-18 - initializing...\n"
2022-09-07T04:16:29.006 helix_lsp::transport [ERROR] err <- "thread 'MacroExpander' panicked at 'assertion failed: `(left != right)`\n"
2022-09-07T04:16:29.007 helix_lsp::transport [ERROR] err <- "  left: `0`,\n"
2022-09-07T04:16:29.007 helix_lsp::transport [ERROR] err <- " right: `0`', crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/bridge/handle.rs:22:9\n"
2022-09-07T04:16:29.007 helix_lsp::transport [ERROR] err <- "stack backtrace:\n"
2022-09-07T04:16:29.014 helix_lsp::transport [ERROR] err <- "   0: rust_begin_unwind\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   1: core::panicking::panic_fmt\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   2: core::panicking::assert_failed_inner\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   3: core::panicking::assert_failed\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   4: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::HandleStore<S>::new\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   5: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::run_server\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   6: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::<impl proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::Client<(proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream,proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream),proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream>>::run\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   7: proc_macro_srv::abis::abi_1_63::Abi::expand\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   8: proc_macro_srv::abis::Abi::expand\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "   9: proc_macro_srv::dylib::Expander::expand\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "  10: proc_macro_srv::cli::run\n"
2022-09-07T04:16:29.015 helix_lsp::transport [ERROR] err <- "note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.\n"
2022-09-07T04:16:50.828 helix_lsp::transport [ERROR] err <- "Sep 07, 2022 4:16:50 AM org.bsplines.ltexls.server.LtexLanguageServer initialize\n"
2022-09-07T04:16:50.828 helix_lsp::transport [ERROR] err <- "INFO: ltex-ls 15.2.1-alpha.1.nightly.2022-04-18 - initializing...\n"
2022-09-07T04:17:06.378 helix_lsp::transport [ERROR] err <- "thread 'notify-rs inotify loop' panicked at 'called `Result::unwrap()` on an `Err` value: \"SendError(..)\"', crates/vfs-notify/src/lib.rs:87:60\n"
2022-09-07T04:17:06.378 helix_lsp::transport [ERROR] err <- "stack backtrace:\n"

Platform

Linux Debian 11

Terminal Emulator

xfce4-terminal 0.8.10 (Xfce 4.16)

Helix Version

22.08.1-35-g1fe32737

@getreu getreu added the C-bug Category: This is a bug label Sep 7, 2022
@the-mikedavis
Copy link
Member

Looks like the LSP (see also #3683), here:

lsp::VersionedTextDocumentIdentifier::new(self.url().unwrap(), self.version)

It may make sense to gate the sending of textDocument/didChange where there is no path since we can't send a URI

@getreu
Copy link
Contributor Author

getreu commented Sep 10, 2022

I was trying to do the Tutor exercise 10.2.:

hx --tutor
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', helix-view/src/document.rs:1046:62
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I give up. This bug makes the tutor unusable for me.

@archseer
Copy link
Member

Seems like you have ltex LSP running on all files? It shouldn't be running on the tutor.

@archseer
Copy link
Member

Based on your blog post I guess it's because it's getting applied to txt?

@archseer
Copy link
Member

Found it. The tutor is loaded as a txt file then we unset the path:

// Unset path to prevent accidentally saving to the original tutor file.
doc_mut!(editor).set_path(None)?;
but the language server stays in place. I guess unsetting the path should also emit a close event / unload the LSP.

As a quick fix I'll remove the txt suffix from the tutor.

@getreu
Copy link
Contributor Author

getreu commented Sep 12, 2022

Your fix works for me. Thank you.

jdrst pushed a commit to jdrst/helix that referenced this issue Sep 13, 2022
The tutor file is loaded as .txt which can potentially spawn a
language server. Then the path is unset, but the LS remains active.
This can cause panics since updates are now submitted for a doc
with no path.

As a quick workaround we remove the extension which should avoid
detection.

Fixes helix-editor#3730
@superstrong
Copy link

Heads up the public site appears not to have been released since this update, so the tutor.txt link at the top of the usage page is a 404.

@the-mikedavis
Copy link
Member

The link is up to date on the master docs: https://docs.helix-editor.com/master/usage.html

We may want to freeze links like this for releases in the future though

@the-mikedavis
Copy link
Member

I pushed a change to correct the link for the 22.08.1 docs 6668e44

herkhinah pushed a commit to herkhinah/helix that referenced this issue Dec 11, 2022
The tutor file is loaded as .txt which can potentially spawn a
language server. Then the path is unset, but the LS remains active.
This can cause panics since updates are now submitted for a doc
with no path.

As a quick workaround we remove the extension which should avoid
detection.

Fixes helix-editor#3730
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants