haskell / haskell/haskell-language-server
Unicode symbols >= π are broken
- Dominant language
- Haskell
- Stars
- 3k
- Forks
- 455
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 13
Description
### Your environment
Which OS do you use: MacOS
Which LSP client (editor/plugin) do you use: Sublime Code
### Steps to reproduce
```
aaa :: Word
aaa = 10
πππ :: Word
πππ = 10
```
### Expected behaviour
Both `aaa` and `πππ` should be underlined as unused bindings.
### Actual behaviour
`aaa` is underlined correctly, but only the first character of `πππ` is underlined.

That's because HLS does not distinguish positions returned from GHC (which are in code points = characters) from positions mandated by LSP (which are UTF-16 code units). Basically, GHC says us that 3 first code points in line 5 are an unused binding. Each `π` is a single character, but 2 UTF-16 code units, so HLS should ask LSP to underline first 6 code units. Instead of this HLS asks LSP to underline only 3, and since the 3rd one is in the middle of the 2nd character, only the 1st character gets underlined.
CC @michaelpj @alanz, this is related to https://github.com/haskell/lsp/pull/392#discussion_r790164996.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the supplied Haskell snippet and inspect the HLS path that converts GHC positions into LSP diagnostic ranges. Compare code-point positions with UTF-16 code units, then verify that the complete three-symbol binding is underlined rather than only its first character.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100