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

Can't type d character and Helix crash #5613

Closed
d4hines opened this issue Jan 20, 2023 · 5 comments
Closed

Can't type d character and Helix crash #5613

d4hines opened this issue Jan 20, 2023 · 5 comments
Labels
C-bug Category: This is a bug

Comments

@d4hines
Copy link
Contributor

d4hines commented Jan 20, 2023

Summary

When trying to type the following code, I noticed that I could not type the d character in payload:

 let signature = String.sub payload

Pressing tab to complete the variable works. But then when trying to finish the line like so:

 let signature = String.sub payload 0 99 |> Ed25519...

I can't press the 'd' in 'Ed25519' either.

When switching away from helix after reproducing this error, Helix crashed twice. I couldn't reproduce the crashing behavior after that, so I'm not sure if they're related.

Reproduction Steps

I tried this:

  1. Open this file: https://gitlab.com/marigold/tezos/-/blob/d4hines/hacking-on-rollups/src/proto_alpha/lib_protocol/sc_rollup_arith.ml
  2. I'm using the nix shell provided in the root of the repository. It provides ocaml-lsp.
  3. Go to line 984.
  4. Try to insert a new line beneath with o.
  5. Try to type let signature = String.sub payload

I expected this to happen:
The character d should be inserted.

Instead, this happened:
Nothing happens.

Helix log

~/.cache/helix/helix.log
2023-01-20T16:45:26.568 helix_lsp::transport [ERROR] err <- "/-----------------------------------------------------------------------\n"
2023-01-20T16:45:26.568 helix_lsp::transport [ERROR] err <- "| Internal error: Uncaught exception.\n"
2023-01-20T16:45:26.568 helix_lsp::transport [ERROR] err <- "| Jsonrpc: json conversion failed: missing field error\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Raised at Jsonrpc__Import.Json.error in file \"jsonrpc/src/import.ml\", line 29, characters 23-50\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Jsonrpc.Response.t_of_yojson in file \"jsonrpc/src/jsonrpc.ml\", line 244, characters 18-74\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Lsp__Io.Make.read.resp in file \"lsp/src/io.ml\", line 99, characters 37-72\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Lsp__Io.Make.read in file \"lsp/src/io.ml\" (inlined), line 102, characters 6-18\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Lsp__Io.Make.read.(fun) in file \"lsp/src/io.ml\", line 115, characters 26-39\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Fiber__Scheduler.exec in file \"src/fiber/scheduler.ml\", line 69, characters 8-11\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Re-raised at Stdune__Exn.raise_with_backtrace in file \"otherlibs/stdune/exn.ml\" (inlined), line 36, characters 27-56\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Stdune__Exn_with_backtrace.reraise in file \"otherlibs/stdune/exn_with_backtrace.ml\", line 18, characters 33-71\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Fiber__Scheduler.advance.(fun) in file \"src/fiber/scheduler.ml\", line 191, characters 2-58\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Fiber.run.loop in file \"src/fiber/fiber.ml\", line 15, characters 30-61\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "| Called from Stdune__Exn_with_backtrace.try_with in file \"otherlibs/stdune/exn_with_backtrace.ml\", line 9, characters 8-12\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "\\-----------------------------------------------------------------------\n"
2023-01-20T16:45:26.569 helix_lsp::transport [ERROR] err <- "\n"
2023-01-20T16:45:26.586 helix_lsp::client [WARN] language server failed to terminate gracefully - server closed the stream
2023-01-20T16:45:26.586 helix_lsp::transport [ERROR] err: <- IO(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })
2023-01-20T16:45:26.589 helix_lsp::transport [ERROR] err: <- StreamClosed

Platform

Nixos

Terminal Emulator

kitty 0.26.2

Helix Version

22.12-102-g0bce1fd1

@d4hines d4hines added the C-bug Category: This is a bug label Jan 20, 2023
@d4hines
Copy link
Contributor Author

d4hines commented Jan 21, 2023

An important detail I forgot in the report is that I'm rebased on top of #2377 and, more relevantly, #5420. I'll try testing against master later.

@CBenoit
Copy link
Member

CBenoit commented Jan 21, 2023

I believe it will be a bit hard to investigate without the panic stack trace. Next time this happens, do you think you could copy and paste it here? I recommend enabling full backtrace with env variable RUST_BACKTRACE=1 when testing on the bleeding edge, just in case. Also, if you’re able to reproduce, could you try again against this branch? (It’s based off #5420 as well, fixing a crash)
https://github.com/pascalkuthe/helix/compare/render_system_2...CBenoit:render_system_2_cbenoit_fork?expand=1
Thank you!

@the-mikedavis
Copy link
Member

I can't reproduce this running from master or #5420 using the Nix shell. I spawn the Nix shell with nix-shell and run dune build within. Then the reproduction steps as listed also within the shell.

Also, could you change the source link to a permalink? The line number could change if you push to that branch and make this harder to reproduce.

@pascalkuthe
Copy link
Member

An important detail I forgot in the report is that I'm rebased on top of #2377 and, more relevantly, #5420. I'll try testing against master later.

I will keep this issue open so the discussion doesn't get lost but if you encounter bugs while running #5420 please report them as a comment against that PR instead of as a new issue. Issues are only intended for bug reports in current master.

@CBenoit reported a similar bug there. I will try to dig into the cause. One major problem for me is that I am unable to reproduce the crash (despite the great instructions provided by @CBenoit) so I am still a bit in the dark about what is actually going on

@d4hines
Copy link
Contributor Author

d4hines commented Jan 23, 2023

I believe I figured out the issue and it was my mistake - in my branch, I had done a remapping of the character d in popups while hunting a performance issue. When the completion popup was triggered, I got this behavior.

As to the crash, I wasn't able to reproduce it consistently. In any case I've rebased on top of the latest changes to #5420. I'll set RUST_BACKTRACE=1 on my system and see if it happens again.

@d4hines d4hines closed this as completed Jan 23, 2023
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

4 participants