oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.28k stars 39 forks source link

thread 'main' panicked ... vfs.rs:194:30 #106

Closed erisco closed 11 months ago

erisco commented 11 months ago

VSCode 1.18.1 running on Windows 10 host, connected to WSL2 Ubuntu nix-ide v0.2.2 nil git-4bdcfcfe38cfcb386142e043392afbfa542665dd

Opened flake.nix

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    # use this fork for git repository
    flake-compat = {
      url = "github:inclyc/flake-compat";
      flake = false;
    };
    what = "ever";
  };

  outputs = { nixpkgs, ... }: {
    foo = nixpkgs.lib.mkIf true;
    #                  ^ goto definition works here (and more)!
  };
}

Nix output:

thread 'main' panicked at 'range end index 377 out of range for slice of length 362', crates/nil/src/vfs.rs:194:30
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail_rt
   3: core::slice::index::slice_end_index_len_fail
   4: nil::vfs::LineMap::normalize
   5: nil::server::Server::set_vfs_file_content
   6: async_lsp::router::Router<St,Error>::notification::{{closure}}
   7: <async_lsp::concurrency::Concurrency<S> as async_lsp::LspService>::notify
   8: futures_util::future::future::FutureExt::poll_unpin
   9: async_lsp::MainLoop<S>::run::{{closure}}::{{closure}}::{{closure}}
  10: tokio::runtime::context::set_scheduler
  11: nil::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 5:04:13 PM] Connection to server got closed. Server will restart.
oxalica commented 11 months ago

Fixed in 4775e34c30f6101a9bb4364a0c7e4aae4ae43f11.

I just know that there are actually Windows users for nix. Remote editing is an interesting case. I have not tested it on Windows ever and I think it's good hear that it runs at all. :smile: Functionalities that involving nix executable may fail, but I hope basic syntactical analysis work fine.