Save file error

Issue #54 resolved
Sergey Trusov created an issue

I try to save the invalid class on server and plugin say that it is OK, but there is no file on server, I would like to see error in this case.

Comments (15)

  1. Scott Wells repo owner

    Can you send me a standalone example of the type of error that's not being displayed properly so that I can reproduce it? Also, let me know whether you're using the Tooling API or Metadata API (assuming Tooling API). With those in hand I should be able to turn around a fix for this one pretty quickly. Thanks!

  2. Sergey Trusov reporter

    E.g. try yo save the following class:

    public with sharing class Test {
        public Test() {
            System.debug(LoggingLevel.ERROR, 'Test');

    I use Tooling API

  3. Scott Wells repo owner

    Thanks for the example. I'll take a look in a bit and see if I can reproduce/diagnose the issue. If so, I should be able to turn around a fix quickly. If not I'll let you know what additional diagnostic info I need from you.

  4. Scott Wells repo owner

    Sergey, I apologize if I've missed something. The code sample you provided above seems valid to me, and it deployed successfully without errors. Was that the correct sample to reproduce this issue?

  5. Sergey Trusov reporter

    Could you please create project without e.g. ApexClass Metadata Type subscription and create new class and try to save it to server. Plugin say that all is ok, but class don't exist on server.

  6. Scott Wells repo owner

    That will definitely help. It's possible that I'm filtering based on the subscription for deployment and/or error reporting. Just so I'm 100% clear, is this when it's deploying on save (CTRL+S/CMD+S), using bulk deployment via the Build menu, or both?

  7. Sergey Trusov reporter

    In my case I create project from empty Org and try to create and save any metadata type and faced with this issue.

  8. Scott Wells repo owner

    Quick update. If I set up the module not to include ApexClass and have a source file with syntax errors locally, I'm seeing them reported in the editor on compile/validate-on-edit and in the editor and Problems view on deploy-on-save but not when deploying through the Build menu. That's because the metadata selection for the module controls what gets deployed/retrieved in bulk but not when you're typing and saving in a single file editor.

    This is currently by design, though I can see how it might be confusing to have inconsistent results. The likely alternative is to indicate to the user that the saved file isn't being auto-deployed to the organization because it's not included in the current metadata selection. I'd definitely be interested to get your take as a user!

    UPDATE: Your described scenario of a brand new empty project with no metadata selected is a good one. Right now it would be confusing to the user as to why things aren't being deployed. I'll think about how I might report inconsistencies between the metadata types represented in the local source root and those configured in the metadata selection. I'd want to err on the side of not being noisy to the user when things are really configured as desired, but I think there's easily a situation where the user needs to know that things aren't configured as expected/desired. This is good info! Thanks!

  9. Scott Wells repo owner

    I bet I know what's going on...I'm listing the metadata types that are returned in the global describe result (or maybe one of the downstream API results), but if you don't have any deployed, I think that gets omitted. I'll look at fixing this by making sure that the selection tree contains all possible metadata types and not just those reported by the org.

    While I certainly plan to address this, in the interim I think you can work around this by deploying the class explicitly in one of two manners: 1) open the local class in the editor, make any change (whitespace is fine), and save the file; assuming you've configured Illuminated Cloud to handle saves by deploying through either the tooling or metadata API, the class should deploy; 2) change your metadata selection temporarily to All and deploy. In either case, after a class is successfully in the org, switch back the selected metadata and refresh the metadata selection tree. ApexClass should be there. Like I said...workarounds, not solutions. I'll get a real solution out soon!

  10. Scott Wells repo owner

    Hmmmm...did you try both workarounds? Needless to say, I don't want you having to do either of these as a workaround! I'll definitely take a closer look at this tonight and try to get out a solid fix for it.

  11. Scott Wells repo owner

    Okay, I was able to reproduce this tonight. Here's what I did:

    1. Created a new project against an empty dev org.
    2. Chose "Selected" for metadata selection and, as you pointed out, ApexClass and many other metadata types were missing. I have a fix for this that I'll be submitting shortly.
    3. Created a new Apex class in the project and it was not successfully deployed.
    4. Tried workaround 1 above and it was not successfully deployed.
    5. I then tried workaround 2 above and it was deployed both on save and on incremental/full deploy. Then I was able to add ApexClass to the metadata selection after a Refresh.

    Like I said, I have a real fix that I'm about to submit, so hopefully you won't need the workaround anyway, but I wanted to list the steps I went through so we could compare notes on what we've both done to cause the issue. I'll be uploading a new version shortly with these fixes. Hopefully they take care of this problem for you!

  12. Log in to comment