Skip to content

Commit

Permalink
chore: Normalize line separators in BiomeCheckRunner updates (#109)
Browse files Browse the repository at this point in the history
Ensure consistent handling of line separators by normalizing text to "\n" before updating documents.
  • Loading branch information
denbezrukov authored Dec 11, 2024
1 parent 2bfccaf commit 4b0575e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ class BiomeCheckRunner(
is BiomeRunner.Response.Success -> {
val text = response.code
val lineSeparator = StringUtil.detectSeparators(text)

// internally we keep newlines as \n
val normalizedText = StringUtil.convertLineSeparators(text)
writeCommandAction(project, request.commandDescription) {
if (!StringUtil.equals(request.document.text, text)) {
request.document.setText(text)
if (!StringUtil.equals(request.document.charsSequence, normalizedText)) {
request.document.setText(normalizedText)
}

setDetectedLineSeparator(project, request.virtualFile, lineSeparator)
Expand Down

0 comments on commit 4b0575e

Please sign in to comment.