Create additional code inspection

Issue #1706 resolved
Mikhail Ivanov created an issue

I’d like to create an additional Intellij plugin to inspect APEX code. Can I achieve this in Illuminated Cloud?

Currently I stuck with the following:

  • What should I set as a language for localInspection tag in my plugin’s resources/META-INF/plugin.xml file?
  • How can I identify my LocalInspectionToolSession.file is APEX? Can I import IlluminatedCloud2 libraries and use them in my plugin?
  • Is there any class I could extend similar to AbstractBaseJavaLocalInspectionTool for JAVA?

Comments (6)

  1. Scott Wells repo owner

    Hi, Mikhail. At present I don't support "extensions" of the plugin because the PSI and libs do change from time to time. Having said that, I do know that a few folks have written plugins that do inspect and work against IC's PSI tree, and though those are subject to breaking at any given time, I assume that's acceptable to those folks.

    If you want to do that, you can use a language of Apex. That will ensure that your code inspections (or whatever EPs you implement) are only invoked for Apex source files (*.cls, *.trigger, *.apex, and *.soql). Because I don't support folks using IC's core libs, there really isn't a base class that you could extend, though even my shared base inspection class is pretty lightweight.

    Good luck!

  2. Mikhail Ivanov reporter

    Thank you, Scott.

    One more question. I don’t understand how I can debug my new inspection. I run gradle task intellij.runIde and it opens new IDE session with IlluminatedCloud as an unknown module. Can you give any instruction on how to properly debug it?

  3. Scott Wells repo owner

    Unfortunately I can't really help much there, at least not specifically w.r.t. gradle. I started my plugin before the gradle task was introduced and use an ant build script for automated builds. For debugging I execute the plugin directly from the IDE. I would guess you could do that, but it might require some tinkering to get it working assuming the IntelliJ project is set up as a gradle project.

  4. Mikhail Ivanov reporter

    Thank you for your response.

    Now I have another issue. I wrote a unit test for my plugin. But when I tried to run the unit test it throws the error:

    ERROR: Failed to initialize license validation.
    com.wyday.turboactivate.TurboActivateException: Failed to find TurboActivate.dat.

    and also:

    Could not initialize class com.illuminatedcloud.intellij.license.LicenseValidator

    But when I run the plugin in the IDE and test it in UI it works fine.

    Do you have any idea how I can resolve the issue?

  5. Scott Wells repo owner

    Assuming you're trying to use IlluminatedCloud2.jar outside of its distribution while running unit tests, that's not going to work. That's going to validate the distribution and will find it not to be as expected. It's just part of IC's DRM. Sorry...

  6. Log in to comment