haskell / haskell/haskell-language-server

Unicode symbols >= 𐀀 are broken

Open
#2,646 21 comments 1 reaction 0 assignees View on GitHub
component: ghcide component: lsp type: bug
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.