Skip to content

πŸ› Extension does not update Line Separators (and it breaks import sorting)Β #182

@jgreuter

Description

@jgreuter

IDE and version

WebStorm 2025.1.3

Extension version

1.7.2

Biome version

2.0.5

Operating system

  • Windows
  • macOS
  • Linux

Description

When having the document line separators on CRLF and Sort import on save in the extension enabled, the extension outputs invalid code. It also does not change the line separators from CRLF to LF.

My IntelliJ Configuration
Image

My Biome Configuration

{
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "lineWidth": 120,
    "lineEnding": "lf"
  },
  "assist": {
    "actions": {
      "source": {
        "organizeImports": {
          "level": "on",
          "options": {
            "groups": [
              [":PACKAGE:", "!@abc/**"],
              "@abc/**",
              ":PATH:"
            ]
          }
        }
      }
    }
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "double",
      "indentWidth": 2,
      "semicolons": "always",
      "trailingCommas": "all",
      "arrowParentheses": "always",
      "lineEnding": "lf"
    }
  },
  "json": {
    "formatter": {
      "enabled": true
    }
  },
  "css": {
    "formatter": {
      "enabled": true
    }
  },
  "linter": {
    "enabled": false
  }
}

Steps to reproduce

  1. Create a Typescript file with unsorted imports (see playground link)
  2. Set your line separators to CRLF
  3. Save your imports (sometimes multiple saves are required, sometimes it breaks it even more)

Input:
Image

Output with CRLF
Image

Expected behavior

It should produce valid code even when the file is CRLF. It should also change the line separators.

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

https://biomejs.dev/playground/?attributePosition=multiline&code=aQBtAHAAbwByAHQAIAB7ACAASABsAG0AUwBwAGkAbgBuAGUAcgBDAG8AbQBwAG8AbgBlAG4AdAAgAH0AIABmAHIAbwBtACAAIgBAAHMAcABhAHIAdABhAG4ALQBuAGcALwBoAGUAbABtAC8AcwBwAGkAbgBuAGUAcgAiADsACgBpAG0AcABvAHIAdAAgAHsAIABDAGgAYQBuAGcAZQBEAGUAdABlAGMAdABpAG8AbgBTAHQAcgBhAHQAZQBnAHkALAAgAEMAbwBtAHAAbwBuAGUAbgB0ACAAfQAgAGYAcgBvAG0AIAAiAEAAYQBuAGcAdQBsAGEAcgAvAGMAbwByAGUAIgA7AAoACgBAAEMAbwBtAHAAbwBuAGUAbgB0ACgAewAKACAAIABzAGUAbABlAGMAdABvAHIAOgAgACIAcgBlAGkAYgBhAC0AcABhAGcAZQAtAGwAbwBhAGQAaQBuAGcAIgAsAAoAIAAgAHQAZQBtAHAAbABhAHQAZQA6ACAAYAAKACAAIAAgACAAPABoAGwAbQAtAHMAcABpAG4AbgBlAHIAIAAvAD4ACgAgACAAYAAsAAoAIAAgAHMAdAB5AGwAZQBVAHIAbAA6ACAAIgAuAC8AcABhAGcAZQAtAGwAbwBhAGQAaQBuAGcALgBjAG8AbQBwAG8AbgBlAG4AdAAuAGMAcwBzACIALAAKACAAIABjAGgAYQBuAGcAZQBEAGUAdABlAGMAdABpAG8AbgA6ACAAQwBoAGEAbgBnAGUARABlAHQAZQBjAHQAaQBvAG4AUwB0AHIAYQB0AGUAZwB5AC4ATwBuAFAAdQBzAGgALAAKACAAIABpAG0AcABvAHIAdABzADoAIABbAEgAbABtAFMAcABpAG4AbgBlAHIAQwBvAG0AcABvAG4AZQBuAHQAXQAsAAoAfQApAAoAZQB4AHAAbwByAHQAIABjAGwAYQBzAHMAIABQAGEAZwBlAEwAbwBhAGQAaQBuAGcAQwBvAG0AcABvAG4AZQBuAHQAIAB7AH0ACgA%3D&language=ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug confirmedReport has been confirmed as a valid bugHelp wantedExtra attention is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions