Skip to content

Crash in picker when file no longer exists #6183

Closed
@rcorre

Description

Summary

I was working on a cpp project, and my compile_commands.json was out of date.
Searching for symbols in the workspace symbol picker caused a crash.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Line index out of bounds: line index 2447, Rope/RopeSlice line count 2', /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.6.0/src/rope.rs:764:41
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/panicking.rs:64:14
   2: core::result::unwrap_failed
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/result.rs:1791:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/result.rs:1113:23
   4: ropey::rope::Rope::line_to_char
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.6.0/src/rope.rs:764:9
   5: <helix_term::ui::picker::FilePicker<T> as helix_term::compositor::Component>::render
             at /home/rcorre/src/helix/helix-term/src/ui/picker.rs:298:25
   6: <helix_term::ui::picker::DynamicPicker<T> as helix_term::compositor::Component>::render
             at /home/rcorre/src/helix/helix-term/src/ui/picker.rs:909:9
   7: <helix_term::ui::overlay::Overlay<T> as helix_term::compositor::Component>::render
             at /home/rcorre/src/helix/helix-term/src/ui/overlay.rs:48:9
   8: helix_term::compositor::Compositor::render
             at /home/rcorre/src/helix/helix-term/src/compositor.rs:170:13
   9: helix_term::application::Application::render::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:307:9
  10: helix_term::application::Application::event_loop_until_idle::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:352:34
  11: helix_term::application::Application::event_loop::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:324:57
  12: helix_term::application::Application::run::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/application.rs:1084:38
  13: hx::main_impl::{{closure}}
             at /home/rcorre/src/helix/helix-term/src/main.rs:156:53
  14: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/park.rs:283:63
  15: tokio::runtime::coop::with_budget
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/coop.rs:102:5
  16: tokio::runtime::coop::budget
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/coop.rs:68:5
  17: tokio::runtime::park::CachedParkThread::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/park.rs:283:31
  18: tokio::runtime::context::BlockingRegionGuard::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/context.rs:315:13
  19: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/scheduler/multi_thread/mod.rs:66:9
  20: tokio::runtime::runtime::Runtime::block_on
             at /home/rcorre/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/runtime.rs:284:45
  21: hx::main_impl
             at /home/rcorre/src/helix/helix-term/src/main.rs:158:5
  22: hx::main
             at /home/rcorre/src/helix/helix-term/src/main.rs:38:21
  23: core::ops::function::FnOnce::call_once
             at /rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/ops/function.rs:507:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Reproduction Steps

I tried this:

  1. cd ~/src/godot
  2. git checkout 3.5.1-stable
  3. scons compiledb=true compile_commands.json
  4. git checkout 4.0.2-stable
  5. hx editor/project_converter_3_to_4.cpp
  6. /\.find
  7. gd -- takes me to an empty buffer, because it can't find String::find due to the old compiledb, the file moved
  8. <space>Sfind

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

helix.log

Platform

Linux

Terminal Emulator

st 0.8.5

Helix Version

22.12-294-g6494fc1d

Metadata

Assignees

No one assigned

    Labels

    A-language-serverArea: Language server clientC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions