Skip to content
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

fix: set format line separators on save #88

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

JohannesIBK
Copy link
Contributor

Previously, line separators were never formatted and had to be changed manually in the IDE.

@nhedger
Copy link
Member

nhedger commented Sep 1, 2024

Could you expand a bit on what issue the PR solves?

Also wouldn't this make the CLI and extension formatting inconsistent?

@JohannesIBK
Copy link
Contributor Author

So basically when using Format on Save, the line separators wouldn't change (Try change the line separators in biome.json and see how the line separators are not changed when saving). This basically correctly sets them and should make the output equal to the CLI output.

@ematipico
Copy link
Member

I still don't understand what the issue is. Via configuration, Biome is able to use a different line ending. Why would the extension be in charge of changing that?

@JohannesIBK
Copy link
Contributor Author

With the current version of the plugin, IntelliJ basically just ignores the line separators returned by Biome. There were two problems with the current implementation:

  1. setText(...)` does not change the line breaks, so no matter what the config would be, it would never change the line breaks.
  2. The CapturingProcessHandler always replaces the line breaks it reads with LF line breaks.

So this PR fixes the plugin so that even the IDE accepts and correctly sets the line separators returned by Biome.

@ematipico ematipico merged commit 8f67583 into biomejs:main Oct 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants