helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
34.03k stars 2.52k forks source link

Haskell Syntax highlight break when write a type signature with "=>" sign #11517

Open foxmean opened 3 months ago

foxmean commented 3 months ago

Summary

Around 95% up when I write a type signature with "=>" sign, the syntax highlight is break. Everything is recover when I quite and reopen the helix as show below. asciicast

Reproduction Steps

I tried this: 1. Open the helix editor and write some Haskell script 2. Everything worked just fine except when I wrote a type signature that included "=>" sign (mostly). I usually not happen when I haven't included "=>". 3. When I save and restart helix, everything fixed. But it is annoying. I expected this to happen: The syntax highlighter maybe break due to incomplete writing since it haven't happened if I wrote the function definition *before* type signature as show below [![asciicast](https://asciinema.org/a/nNTGRRhXe4vY2wGrl0FKzkADv.svg)](https://asciinema.org/a/nNTGRRhXe4vY2wGrl0FKzkADv) Instead, this happened: When I wrote a type signature before the function definition [![asciicast](https://asciinema.org/a/1TB081PmRJ3BTCzfmQvxbesSX.svg)](https://asciinema.org/a/1TB081PmRJ3BTCzfmQvxbesSX) ### Helix log A copy of `~/.cache/helix/helix.log` here (with `RUST_BACKTRAACE=1 hx -vv` when reproducing bug. I have no idea how to summary these lines but I have selected only line that I reproduced the bug [here](https://pastecode.io/s/rxou198h). ### Platform MacOS Sonoma 14.6.1; on MacBook Air M1, 2020 ### Terminal Emulator iTerm2, Build 3.5.0 (without terminal multiplex); and Alacritty Version 0.13.2 (1) with Zellij 0.40.1. Both terminal was installed via homebrew cask. Zellij was installed via nixpkgs (nix-darwin) ### Installation Method nixpkgs through nix-darwin flake ### Helix Version helix 24.7 (079f5442)
kirawi commented 3 months ago

We disable highlighting on a buffer if highlighting takes longer than half a second to compute. It sounds to me like => has some buggy behavior here. We could see if a newer commit for the grammar has resolved this issue.

foxmean commented 2 months ago

Sorry for the last archived video. I can reproduce some of the bug related to just "->" too like. asciicast BTW, I think the bug is from HLS itself due to I can reproduce it in Zed editor. I use GHC 9.10.1 with HLS 2.9.0.1 from GHCup

foxmean commented 2 weeks ago

We disable highlighting on a buffer if highlighting takes longer than half a second to compute. It sounds to me like => has some buggy behavior here. We could see if a newer commit for the grammar has resolved this issue.

Where is the place that I should follow for this issue or take a look if someone fix it already in development build or anything I can do for help fixing it?

foxmean commented 2 weeks ago

I've try to change timeout in [language-server.haskell-language-server] as in the documentation specified to something like 6_000_000 but the bug still wasn't fixed.

RoloEdits commented 1 week ago

You can try to update the tree sitter grammar for Haskell to see if there a parser error was fixed.

https://github.com/tree-sitter/tree-sitter-haskell

Current rev if from Sep 24, 2023.

https://github.com/helix-editor/helix/blob/cbbeca6c5227e65bebdbe9abbadbd2202ffc1005/languages.toml#L1348-L1361C79

foxmean commented 1 week ago

One thing I found wired is that I cannot reproduce it in Neovim (NVIM v0.10.2, Build type: Release, LuaJIT 2.1.1731601260). But consistently reproducible with Helix asciicast .