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

Helix Crashes when accessing suggestion for text completion #11488

Closed
farovictor opened this issue Aug 14, 2024 · 2 comments
Closed

Helix Crashes when accessing suggestion for text completion #11488

farovictor opened this issue Aug 14, 2024 · 2 comments
Labels
C-bug Category: This is a bug

Comments

@farovictor
Copy link

Summary

Helix crashes when I click the down arrow on a suggestion for completion of Python code using pylsp as a language server. My error only happens if I have a split window and try importing content from the second window into the first one. More details are explained in the reproduction steps section.

Reproduction Steps

To replicate the error, follow the steps below:

# create two python files
touch one.py two.py

# fill second file with placeholder functions
echo "def some_test():\n\treturn\n\ndef some_other_test():\n\treturn" >> two.py

# set python 3.12.2 as your local python version with pyenv
pyenv local 3.12.2

# install poetry for current python version
pip install poetry==1.8.3

# initilize a poetry project
poetry init --name=test --python=3.12.2 --no-interaction

# install a language server
poetry add "python-lsp-server[all]" --group=debug

#
# set pylsp as default lsp for python in languages.toml
# 

# open empty file
hx one.py
  1. From this point, just split the view with the second file (two.py)
  2. write the following in one.py and wait for completion suggestions:
    from two import som

At this point, two suggestions will be shown in the screen:

Screenshot 2024-08-14 at 16 53 31

If you press the down arrow, the helix crashes.

Curious fact: If I don't open the second file (the same one I am refering in the import in first window) in a split view, this crash doesn't happen.

Helix log

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

My helix.log have no data regarding the error I get, all logs available are non-related to this issue.

The only log I have is the one thrown when error occur in the terminal:

❯ RUST_BACKTRACE=1 RUST_BACKTRACE=full hx main.py
thread 'main' panicked at /Users/envuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ropey-1.6.1/src/slice.rs:656:9:
Attempt to slice past end of RopeSlice: slice end 21, RopeSlice length 20
stack backtrace:
   0:        0x105a02400 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4699abefd07a84a3
   1:        0x104e5f8fc - core::fmt::write::he20999f7a51cdf3e
   2:        0x1059fbbdc - std::io::Write::write_fmt::hf214e623647db141
   3:        0x105a02210 - std::sys_common::backtrace::print::h99c92515f9244444
   4:        0x1059f7190 - std::panicking::default_hook::{{closure}}::h9ee44d77b22015e9
   5:        0x1059f6ea8 - std::panicking::default_hook::h1574e360da6cf342
   6:        0x1059f7ab4 - std::panicking::rust_panic_with_hook::h8c63523cb5f49fbc
   7:        0x105a027dc - std::panicking::begin_panic_handler::{{closure}}::h22187a0d322c75e4
   8:        0x105a02638 - std::sys_common::backtrace::__rust_end_short_backtrace::ha6c62cb1233a6655
   9:        0x1059f73b4 - _rust_begin_unwind
  10:        0x105ac15c0 - core::panicking::panic_fmt::h48dfedcd5cf205f7
  11:        0x10523c188 - ropey::slice::RopeSlice::slice::h63d12841ca6df60c
  12:        0x1052401a8 - helix_lsp::util::generate_transaction_from_completion_edit::hda3bc71765c30768
  13:        0x10541af84 - helix_term::ui::completion::Completion::new::{{closure}}::item_to_transaction::h66d596f377990b34
  14:        0x1053a4d78 - helix_term::ui::completion::Completion::new::{{closure}}::hfdc384e29aa20285
  15:        0x1053a64fc - <helix_term::ui::menu::Menu<T> as helix_term::compositor::Component>::handle_event::h94e7cef8363b9cb8
  16:        0x10530a4ec - <helix_term::ui::popup::Popup<T> as helix_term::compositor::Component>::handle_event::h28abdae5c07d54d5
  17:        0x1054270f4 - <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event::h54f82cd45dbe999e
  18:        0x1054198b4 - helix_term::compositor::Compositor::handle_event::h323ff4c305ffb764
  19:        0x1057bc088 - helix_term::application::Application::run::{{closure}}::h4650a96060405666
  20:        0x1057ce3f8 - tokio::runtime::park::CachedParkThread::block_on::hbf6d4dc277d5267f
  21:        0x10583ab10 - tokio::runtime::context::runtime::enter_runtime::hda468a4a0a4e32d2
  22:        0x10584a128 - tokio::runtime::runtime::Runtime::block_on::ha3ee6e3f34224ac2
  23:        0x1057f80ac - hx::main::h30f59b979b789530
  24:        0x1058413a0 - std::sys_common::backtrace::__rust_begin_short_backtrace::h07cfb181de7fd816
  25:        0x10582a76c - std::rt::lang_start::{{closure}}::haa90a90dc990c958
  26:        0x1059f7308 - std::panicking::try::h9eb4926af0fb4f23
  27:        0x1059e1490 - std::rt::lang_start_internal::h47d7f1f6477d860b
  28:        0x1057f81a8 - _main

Platform

macOs M2

Terminal Emulator

item Build 3.5.4

Installation Method

source

Helix Version

helix v24.07 079f544

@farovictor farovictor added the C-bug Category: This is a bug label Aug 14, 2024
@the-mikedavis
Copy link
Member

I believe this is a duplicate of #10689, fixed recently in #11266

Could you try building from the latest source and seeing if you can reproduce?

@farovictor
Copy link
Author

You are right, I built it from tag 24.07. Now, from the master it actually worked without errors. Thanks for quick reply and sorry for inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants