Illuminated Cloud SDK not created when scratch org connection created or selected

Issue #2451 resolved
Mark Mindenhall created an issue

As stated in other issues, our team chose to use a github monorepo for our org, and for reasons I no longer remember, we structure the repo as follows:

  1. The project root is not a DX project (i.e., no sfdx-project.json file)
  2. Most (but not all) top-level folders are DX projects (i.e., with a sfdx-project.json file) that contain a single DX package. We have 38 of these folders so far, and they all exist as IC2 modules within a single IDEA/IC2 project.

My general workflow is something like this.

  1. I create a scratch org with the maximum 30 day expiration.
  2. I set up my project so that the scratch org is the selected connection for all of the modules/packages.
  3. I run a script to push the metadata/code in each module/package to the scratch org.
  4. I update the offline symbol table from the scratch org.

Having done all of that, I can open any code file in any module/package with no red squiggly “bad code” lines.

Here’s what happens every time I need to switch to a new scratch org (usually after the existing one expires).

  1. I go to the “Configure Application…” view and click the button to create a new scratch org
  2. I select “Load Scratch Org Definition” to load a pre-configured definition.
  3. I replace some boilerplate things in the loaded definition (org name, alias, username, etc), then click OK.
  4. The IC2 plugin creates the new scratch org. After this step is done, I would expect there to be a new Illuminated Cloud SDK created for the new scratch org, but this is not the case. If it’s possible to create the SDK at this step, I think it would help (or maybe even solve this).
  5. I have a bunch of “Invalid configuration for module X” notifications (one for each module/package). I select one and click “Resolve”.
  6. I select a module, and change the Connection to the scratch org I just created. I see a dialog asking whether I want to update all modules to use that connection. It doesn’t matter whether I answer Yes or No at this dialog.
  7. I click OK, but nothing happens! If I open the “Configure Project…” view again, the module still has no selected connection.

Also at this point if I try to generate the offline symbol table (having removed “orphaned” OSTs), nothing happens. Also, most of the items in the Tools->Illuminated Cloud menu are greyed out.

I have a python script I wrote that uses the sfdx tool to set the "default username" for each module/package to the new scratch org, and “fixes up” the .iml file with the new scratch org. The end result is something like this:

<?xml version='1.0' encoding='UTF-8'?>
<module type="GENERAL_MODULE" version="4">
  <component name="FacetManager">
    <facet type="IlluminatedCloud" name="Illuminated Cloud">
      <configuration>
        <option name="connectionName" value="mmscratch11" />
        <option name="connectionType" value="SFDX" />
        <option name="moduleContents">
          <ModuleContents>
            <option name="contentSelectionType" value="SELECTED" />
          </ModuleContents>
        </option>
      </configuration>
    </facet>
  </component>
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/force-app" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/unpackaged-metadata" isTestSource="false" />
      <excludeFolder url="file://$MODULE_DIR$/.sfdx" />
      <excludeFolder url="file://$MODULE_DIR$/.sf" />
    </content>
    <orderEntry type="inheritedJdk" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
</module>

After I have run this script, I can close and reopen the project, and then the Tools->IC menu is back, and I can generate the OST. Having generated the OST, I now have a new IC2 SDK, and I can set that as the project SDK, after which everything is working.

I’d prefer not to have to go through all of these steps, and have the SDK created when the scratch org is created or selected as a Connection, and have the option to update the Project SDK to use this new SDK.

Comments (2)

  1. Scott Wells repo owner
    • changed status to open

    Mark, what probably makes the most sense is for you to create a simple, standalone project that accurately models your actual project into terms of its monorepo layout and behavior. Then attach that project to one of these issues (this one is fine) with a description of the expected vs. actual behavior around it. That way I can walk through all of the described problems in turn and see what makes sense in terms of trying to support this project type.

  2. Scott Wells repo owner

    Resolving due to lack of activity. Please feel free to reopen with the requested diagnostic information so that I can see the described behavior locally.

  3. Log in to comment