[playground]: Fix non‑BMP code point handling in quick‑fixes and markers#20526
[playground]: Fix non‑BMP code point handling in quick‑fixes and markers#20526MichaReiser merged 10 commits intoastral-sh:mainfrom
playground]: Fix non‑BMP code point handling in quick‑fixes and markers#20526Conversation
MichaReiser
left a comment
There was a problem hiding this comment.
Thank you. I think I'd prefer to handle this the same way as we do in ty: That is, implement the conversion in ruff_wasm. The benefit of this is that downstream ruff_wasm users also benefit from this change (I suspect that most downstream users use JS too and would require the exact same conversion).
See
ruff/crates/ty_wasm/src/lib.rs
Lines 88 to 92 in a9b6618
|
crates/ruff_wasm/src/lib.rs
Outdated
| let start_loc = source_code.source_location(range.start(), PositionEncoding::Utf16); | ||
| let end_loc = source_code.source_location(range.end(), PositionEncoding::Utf16); |
There was a problem hiding this comment.
This works but it will break existing clients that assumed UTF8.
I suggest adding positionEncoding a new argument to new (similar to ty) and storing it on the Workspace and then using it here.
This allows each user to use the encoding that best suits their use case.
2376834 to
18d3565
Compare
Summary
Fixes #16266
Updated the playground to convert UTF‑32 (code point) columns from the WASM diagnostics/fixes into Monaco’s UTF‑16 columns when constructing both quick‑fix edit ranges and diagnostic markers in
playground/ruff/src/Editor/SourceEditor.tsx.With this change, applying the
C408quick fix ondict(𠤪=1)now correctly yields{"𠤪": 1}without leaving a stray).