-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on Save JSON File with Emojis #4791
Comments
Can't reproduce on Manjaro KDE with Konsole, might be a Mac problem. Can you reproduce it when building the master branch? |
Yes, just to be sure, i cloned the helix project and ran |
This panic needs the language server to be installed - it's caused by the auto-formatting change. On 322e957 in a debug build, I see this backtrace...
This can be reproduced most minimally with this test case: // helix-lsp/src/lib.rs
// ...
#[test]
fn emoji_format_gh_4791() {
use lsp_types::{Position, Range, TextEdit};
let edits = vec![
TextEdit {
range: Range {
start: Position {
line: 0,
character: 1,
},
end: Position {
line: 1,
character: 0,
},
},
new_text: "\n ".to_string(),
},
TextEdit {
range: Range {
start: Position {
line: 1,
character: 7,
},
end: Position {
line: 2,
character: 0,
},
},
new_text: "\n ".to_string(),
},
];
let source = Rope::from_str(
r#"[
"🇺🇸",
"🎄"
]"#,
);
generate_transaction_from_edits(&source, edits, OffsetEncoding::Utf8);
} I'm not sure whether we're not calculating the position in the rope correctly or if the language server is sending nonsense. We may need to add a clause in
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position |
Summary
when saving a file with the following contents:
helix crashes with the following error:
Reproduction Steps
create a file
data.json
with the following contents:(note that the level of indentation appears to be important)
Open the file with helix
hx data.json
.Save the file with
:w
.Observe the crash.
Helix log
~/.cache/helix/helix.log
Platform
macOS
Terminal Emulator
iTerm2 3.4.16
Helix Version
helix 22.08.1 (a7ec4aa)
The text was updated successfully, but these errors were encountered: