LC, Apex, VF: Deploying on Edit even when setting turned off

Issue #513 resolved
jrattanpal created an issue

I have the deploy on edit setting turned off (screenshot attached). But even then, I edit my LC/Apex, I notice that it's deploying those without me even saving those files (yes, deploy is on when save action is done).

Is there anything I need to do to make sure it only deploys on explicit action (i.e. save)?

Thanks

Comments (15)

  1. Scott Wells repo owner

    Hmmmm...that's definitely not supposed to happen. Let me look into a bit and based on what I find (or more likely, don't find) I may need to instrument another class with some additional debug logging to see why this is happening.

  2. Scott Wells repo owner

    So the key entries in the provided log are:

    2017-01-18 13:42:22,351 [ 429508]  DEBUG - tellij.builder.ForceComBuilder - Checking whether this is a single item static resource or Lightning bundle file deployment using the Tooling API. 
    2017-01-18 13:42:22,351 [ 429508]   INFO - tellij.builder.ForceComBuilder - Deploying single Lightning bundle file /Users/jrattanpal/Google Drive/LaptopBackup/workspace/FSCDriveWealth/src/aura/DWCreateMarketOrder/DWCreateMarketOrder.cmp using the Tooling API. 
    

    Those are only emitted under very specific conditions that shouldn't all be true here. Basically the important one is that the originating event should be an edit (as opposed to a save) which would keep it from going into the block that tries to perform single-item static resource/lightning deployment.

    I'm going to add some additional logging around the path into that block so that I can see why it's making a decision different from what I'd expect. I'll post a test build here shortly with that additional logging.

  3. Scott Wells repo owner

    Okay, do you mind installing this build (same as 1.7.7.0 with additional logging) via Settings>Plugins>Install plugin from disk, then adding one more class for debug logging:

    #com.illuminatedcloud.intellij.builder.AsYouTypeEventProcessor
    

    and reproducing the issue? You should get debug logging of the form:

    2017-01-18 13:26:06,400 [ 377585]  DEBUG - uilder.AsYouTypeEventProcessor - Received a document changed event. 
    2017-01-18 13:26:06,400 [ 377585]  DEBUG - uilder.AsYouTypeEventProcessor -   File = file://C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df16_1770/src/aura/form/formController.js. 
    2017-01-18 13:26:06,400 [ 377585]  DEBUG - uilder.AsYouTypeEventProcessor -   Project = df16. 
    2017-01-18 13:26:06,400 [ 377585]  DEBUG - uilder.AsYouTypeEventProcessor -   Queueing as-you-type event for file. 
    2017-01-18 13:26:06,442 [ 377627]  DEBUG - uilder.AsYouTypeEventProcessor - Received a document changed event. 
    2017-01-18 13:26:06,442 [ 377627]  DEBUG - uilder.AsYouTypeEventProcessor -   File = file://C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df16_1770/src/aura/form/formController.js. 
    2017-01-18 13:26:06,442 [ 377627]  DEBUG - uilder.AsYouTypeEventProcessor -   Project = df16. 
    2017-01-18 13:26:06,442 [ 377627]  DEBUG - uilder.AsYouTypeEventProcessor -   Queueing as-you-type event for file. 
    2017-01-18 13:26:14,062 [ 385247]  DEBUG - uilder.AsYouTypeEventProcessor - Found 1 as-you-type events for processing. 
    2017-01-18 13:26:14,062 [ 385247]  DEBUG - uilder.AsYouTypeEventProcessor - Requesting the following files for validation: {file://C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df16_1770/src/aura/form/formController.js} 
    2017-01-18 13:26:14,062 [ 385247]  DEBUG - tellij.builder.ForceComBuilder - Asked to build the following files for buildEventType=EDIT, bulkDeploy=false, forceDeploy=false: {file://C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df16_1770/src/aura/form/formController.js}. 
    2017-01-18 13:26:14,062 [ 385247]  DEBUG - tellij.builder.ForceComBuilder - Initializing the Force.com API client for connection dev 
    2017-01-18 13:26:16,176 [ 387361]  DEBUG - tellij.builder.ForceComBuilder - This is a check-only/validation deployment. 
    

    except that something in that final state will be different in yours which is causing it to think it should actually do something. That's what I'll need to see. Thanks!

  4. Scott Wells repo owner

    Thanks. I'll look at it shortly. The build I gave you is the exact same as the one I released this morning with just a little additional debug logging. No need to switch to the "official" build, and when I post a new official build, you'll be prompted to update. Assuming the log does provide insight into the problem and a fix, I'll post another build here for you to confirm the fix and then will include that fix in the next official build.

  5. Scott Wells repo owner

    Okay, so what I'm seeing here is that you're making an edit which does not result in a deployment, then ~3.5 seconds later something has actually saved the file to the filesystem which does result in a deployment:

    2017-01-18 15:19:28,006 [  44333]  DEBUG - tellij.builder.ForceComBuilder - Asked to build the following files for buildEventType=EDIT, bulkDeploy=false, forceDeploy=false: {file:///Users/jrattanpal/Google Drive/LaptopBackup/workspace/FSCDriveWealth/src/aura/DWCreateMarketOrder/DWCreateMarketOrderController.js}. 
    2017-01-18 15:19:28,006 [  44333]  DEBUG - tellij.builder.ForceComBuilder - Initializing the Force.com API client for connection App Innovation Partners - FSC - Drive Wealth 
    2017-01-18 15:19:31,631 [  47958]  DEBUG - tellij.builder.ForceComBuilder - Asked to build the following files for buildEventType=SAVE, bulkDeploy=false, forceDeploy=false: {file:///Users/jrattanpal/Google Drive/LaptopBackup/workspace/FSCDriveWealth/src/aura/DWCreateMarketOrder/DWCreateMarketOrderController.js}. 
    

    I also noticed in your original screenshot that you're not configured for the overridden Save All action which means that not only when you explicitly save, but anytime that IntelliJ IDEA decides it's going to save to the filesystem, it's going to try to deploy. There are several reasons that IntelliJ might decide to save including loss of main window focus, periodic saves, perceived changes vs. version control, etc. Unfortunately in those situations, all I get is an event saying that the file has been saved and not why it was saved.

    What I recommend is that you enable the overridden Save All action (first option in the dialog from the original screenshot) and see if it resolves the issue. It will ensure that deploy-on-save will only occur when you explicitly save the file, and perhaps more importantly, I make sure that it occurs any time that you explicitly save the file even if IntelliJ doesn't think the file has been changed relative to the file system.

    Please let me know whether that resolves the issue for you or not.

  6. jrattanpal reporter

    Yes, I noticed it seems to happen when I move away so I guess save is happening.

    When I try to override, I get following message. Should I say yes? I am not sure what it is trying to override.

    Override_SaveAll.png

    Thanks

  7. Scott Wells repo owner

    Yes. I can't modify the default keymap in-place, so I have to clone it to reassign the Cmd+S keybinding to my own action. The original keymap is still there if you want to switch back at any time.

  8. Scott Wells repo owner

    And yes, if it happens when you move away, that's not doing validate-on-edit but actual deploy-on-save. It's just that by default IntelliJ IDEA is configured to save all modified files to disk when it loses focus. You can disable that, but I think you'll have a much better overall experience if you just use the overridden Save All action since it will do exactly what you want when you press Cmd+S (or the Save All menu entry/toolbar button).

  9. jrattanpal reporter

    I see, yes that fixed it.

    But here is the side effect of this. If I change one file and has 10 files open (Which is often, especially with LC), clicking save will deploy every file.

    I'll see if that is something I want. If not then maybe I will go back and either be ok with current functionality of auto save or disable save all.

    But I guess, in any case, it's not IC issue.

  10. jrattanpal reporter

    and since I pressed save, it's been trying to save all the files and still pending. In this scenario, will it use tooling api or metadata API?

    If MDAPI then I guess it will start adding lot more time to deploy due to that other bug.

    QUestion: How do I change it back if I wanted to go back?

  11. Scott Wells repo owner

    That's right. It saves everything that's been modified since the last successful save, and if it can't do that in a single Tooling API call, it will use the Metadata API. It can batch multiple Apex classes/triggers and Visualforce pages/components in a single Tooling API call, but it can only deploy a single static resource or Lightning bundle file in a single Tooling API call right now (restriction of the Tooling API, not IC).

    If you want to go back, just uncheck that same setting that you checked and it'll revert the behavior. If you want to disable the save-on-focus-lost behavior, uncheck Settings>Appearance & Behavior>System Settings>Save files on frame deactivation. You might want to change some of the other settings in that panel as well to your liking.

  12. Scott Wells repo owner

    I'm going to resolve this since it does look like things are working as designed if not exactly as expected.

  13. jrattanpal reporter

    Thanks!! this was helpful.

    I think we can close this issue; it was just mis understanding (edit vs save)

  14. Log in to comment