-
Notifications
You must be signed in to change notification settings - Fork 889
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
FileLines::all().to_json_spans()
returns []
which is parsed as empty map
#3649
Comments
I think that it would be simpler to fix this part instead, |
This would mean that |
Yeah, you are right. Actually In that case, I would prefer to go with your second option. |
If we go with @Xanewok's second option, then it will introduce an update to the public API ( Rather, we could implement A different approach would be to relax the stability guarantee of rustfmt so that 'small' breaking changes can be introduced with a minor version update. This sounds fine, as the main (or the only?) consumer of rustfmt-as-a-library is rls. |
I'd probably lean towards the last option since it's more of a bugfix (comment mentions serializing into format accepted by However, having a What's puzzling is the difference between representation - I'd probably find it puzzling to see a slightly different |
@topecongiro I can take a look at this one |
Opened #3954 that implements the second option detailed by @Xanewok I didn't include the rustfmt/src/config/file_lines.rs Lines 333 to 354 in 7713d05
However, let me know you'd prefer utilizing those impls and removing the relevant functions/etc. that are currently in use. |
This surfaced at rust-lang/rls#1463 (fixed in rust-lang/rls#1497).
The underlying data structure discerns a missing/"all" state in addition to actual set (possibly empty) of lines:
rustfmt/src/config/file_lines.rs
Lines 151 to 157 in 26d370e
whereas
to_json_span
only encodes a specified set of those changes (can't representFileLines(None)
):rustfmt/src/config/file_lines.rs
Lines 218 to 221 in 26d370e
I think we should either:
None
match into_json_spans
(sincevec![]
returned forFileLines(None)
won't be parsed back into theFileLines(None)
but ratherFileLines(Some(HashMap::new))
null
lines in--file-lines JSON
and maketo_json_spans()
returnOption<Vec<JsonSpan>>
Thoughts?
cc @jsgf @ljw1004
The text was updated successfully, but these errors were encountered: