astral-sh / ruff-lsp

A Language Server Protocol implementation for Ruff.
Other
1.28k stars 46 forks source link

Wrong position when reporting error with emoji strings #358

Open karthiknadig opened 8 months ago

karthiknadig commented 8 months ago

This happens because VSCode (or IDEs) expect positions to be calculated using the positionEncoding (see Client capability). pygls has convenient helpers for this, see PositionCodec. image

Client and Server has to agree on which encoding they use for positions. Clients report the encodings they support via the positionEncoding field of Client Capability (missing this field means UTF-16 by default). Server has to pick one out of the offered encodings (again missing means UTF-16).

MichaReiser commented 8 months ago

Thanks for reporting. That's something my Rust LSP rewrite prototype handles already, but we should backport the functionality to our Python version if we can't find the time to finish the prototype soonish.

MichaReiser commented 5 months ago

@snowsignal would you mind testing if this is fixed with ruff server?