Do not upload files changed outside the IDE automatically

Issue #40 resolved
Nathen Drees created an issue

I've been doing some testing and right now if you change a file outside of the idea (through a text editor or through a version control update), when you switch back to IntelliJ it automatically uploads the file to Salesforce.

We would like it to not do this, or have a way to turn this off at the project level. The scenario where this causes problems is:

  1. Developer 1 is working updates to file A which is checked in to source control in org A, but hasn't checked their changes in yet.
  2. Developer 2 is refreshes their files from source control to start working on file B. When they switch back to IntelliJ, file A is uploaded and overwrites the changes developer 1 was working on (or worse: updates checked in to another branch).

Ideally IntelliJ should only upload files if the file is saved from within IntelliJ itself, or the user explicitly tells it to upload.

Unfortunately our business model is such that each developer does not get their own org, since we're dependent on our clients to provide development orgs for us.

I created this as a "blocker" priority since this same issue is the main reason we don't use the IDE either. Feel free to change it.

Comments (6)

  1. Scott Wells repo owner

    Makes sense. I believe IDEA will tell me in the event whether a save was explicit or not. I can pretty easily add a configuration option for validation/deployment that lets the user decide whether to include outside changes picked up via refresh or not. I'll see if I can include that in the next patch release. If not (and assuming I can determine explicit vs. implicit that easily), I'll definitely work it into one of the near-term releases.

    UPDATE: Just verified that the event does include whether it was from save or refresh. I'll go ahead and include this as a configurable option under Validation & Deployment in the next patch release.

  2. Scott Wells repo owner

    Okay, that was quite easy. However, there are two caveats:

    1. When configured to ignore external changes, files won't be deployed but they will still be validated if configured to do so when those external edits are picked up. These are two discrete events in IDEA and only the save event has information about whether it's the result of an explicit save in the IDE or an external change detected by auto-refresh. The event that's received when the editor contents are refreshed doesn't provide that distinction.
    2. Incremental bulk deployment may still see these files as newer than their counterparts in the shared org and, if so, will include them when deploying.

    Having said that, I believe this achieves your goal because you'll now be able to configure Illuminated Cloud to avoid deployment of changes from IDEA's on-focus auto-refresh of the current editor's contents based on an external change.

    I'll include this in 1.0.4 that will be posted later today or tomorrow. Let me know if it doesn't meet your needs!

  3. Nathen Drees reporter

    Thank you for the quick turn around!

    I think those caveats are fine. The most common case where this happens is checking files out of source control, and those files should be syntactically valid, so revalidating them wont report anything.

    We don't often do bulk deployments, typically using change sets to move between orgs, so for us at least the bulk deployment won't be an issue. This may be worth something documenting somewhere though, as I could see it catching others off guard?

    I'll wait for 1.0.4 to be released and give this a spin.

  4. Scott Wells repo owner

    1.0.4 uploaded and pending approval. Just go into Settings>Illuminated Cloud>Validation and Deployment and make sure that Deploy on external change is unchecked (should be by default). Let me know if it doesn't give you what you're wanting!

  5. Log in to comment