Illuminated Cloud fetch setting line endings to LF on Windows

Issue #1726 resolved
Ken Jones created an issue

Scenario:

  1. Pull from remote git repo → Line endings are CRLF (Which makes sense for Windows)
  2. Fetch metadata from org using illuminated cloud → Line endings for updated files are LF

This is a major problem for my workflow.

Comments (7)

  1. Scott Wells repo owner

    Ken, Illuminated Cloud doesn't change line endings when metadata is retrieved from Salesforce. Files are placed into the filesystem exactly as returned by the API. It sounds like perhaps the issue is that Git on Windows is configured for CRLF instead of preserving existing line endings. You might play with Git line ending configuration to resolve this issue:

    https://docs.github.com/en/free-pro-team@latest/github/using-git/configuring-git-to-handle-line-endings

  2. Scott Wells repo owner

    I'm going to resolve this since the line endings in question are managed by the Salesforce API/CLI and Git respectively. If you do find an issue with line endings of files created explicitly by Illuminated Cloud, e.g., when creating source files using the IDE, feel free to let me know.

  3. Ken Jones reporter

    I haven’t set any api configuration separate from illuminated cloud, this wasn’t a problem until very recently and my git configuration has always been set to use CRLF which is the recommended setting in Windows.

    It’s not clear to me how I can configure illuminated clouds interaction with the API, this isn’t something I’ve had to do in the past.

  4. Scott Wells repo owner

    Ken, when files are retrieved from an organization, one of three things happens:

    1. If it's a metadata format project (pre-Salesforce DX), then Illuminated Cloud calls MetadataApi.retrieveMetadata() to retrieve an archive of the requested metadata files.
    2. If it's a source format project against a non-scratch org, then Illuminated Cloud uses sfdx force:source:retrieve to retrieve the requested metadata files.
    3. If it's a source format project against a scratch org, then Illuminated Cloud uses sfdx force:source:pull to retrieve the out-of-date metadata files.

    In all cases, the line endings of the retrieved files are determined by Salesforce, whether via the API or the CLI (which in turn is just using the API).

    Which of the three above matches your project? I'd like to isolate this behavior from Illuminated Cloud by having you reproduce it 100% from the CLI.

  5. Scott Wells repo owner

    Okay. I'd like for you to download the same metadata outside of IC so we can see whether the same behavior occurs. You can do that in one of a few ways:

    1. You can use Workbench.
    2. You can use the Salesforce CLI's force:mdapi:retrieve command.

    Let's start with those two. Hopefully one of them will allow you to do this quickly. What I'd like you to do is download any metadata object through one of those mechanisms that is exhibiting this line ending behavior in IC, and then I'd like to you to see whether the same line endings are in place when retrieved that way. My guess is that they will be in which case it likely means that your metadata files are stored in Salesforce using LF and not CRLF, or that Salesforce is translating to LF on retrieval.

    Please let me know what you find.

  6. Log in to comment