Indexing forever if large class in source (MetadataService.cls)

Issue #1554 resolved
Robert Sösemann created an issue

I am unable to work with projects in IC2 when they contain this widely used Open Source lib. https://github.com/financialforcedev/apex-mdapi/blob/master/apex-mdapi/src/classes/MetadataService.cls

When I open such a project its indexing for ages (endless loop??)

If I remove this file everything runs smoothly.

Comments (8)

  1. Scott Wells repo owner

    Okay, this should be addressed in the next build (targeting later this week). There were several components to the fix including a few optimizations that are critically important for larger files like this but will likely help on even moderately-sized files. I also now automatically disable all real-time Apex code inspections on files above 500K bytes in length, though you can explicitly run those inspections against these files to see results. When a file of this size is opened, IC informs the user that real-time code inspections are not active. Put it all together, and you end up with something like this:

    Issue_1554.png

    As you can see, some non-Apex code inspections may still run, e.g., there are 246 misspellings found by the Spellchecker plugin.

    I wouldn't recommend trying to edit/maintain a file this large in IC, though you could not if you really wanted to. However, it's probably going to be sluggish. The important thing, though, is that IC can now process files like this in a project.

  2. Oleh Berehovskyi

    Hello Scott.

    What if I want to set the maximum file size manually? I tried to edit the idea.properties file with idea.max.content.load.filesize=2000 . Unfortunately, it didn’t work and I still see the same banner. According to the banner message the limit is still (500 kB) . Is there any property that can override that value?

  3. Scott Wells repo owner

    Hi, Oleh. That limit is IC-specific and not controlled by the IDE's max file size property. The IDE has a much higher tolerance.

    Is there a specific value you're looking for? How large is the class that you're opening? If it's over 500kB, have there been no performance issues when working with it?

  4. Oleh Berehovskyi

    Yes, code inspection (before 2.1.3.6 update) of MetadataService.cls was really slow but didn't fall into an endless loop in my case. Maybe instead of just limiting the file size to 500kB it is possible to implement that value to be customizable by the IC user so then the user will able to decide for himself.

  5. Scott Wells repo owner

    Got it. Let me look at a few options and I'll make something configurable in the next build.

  6. Scott Wells repo owner

    Okay, I just committed some changes to make this configurable on a per-project basis:

    Issue_1554_redux.png

    I also debugged the issue where multiple file-level annotations would accumulate and tracked it down to a plugin SDK bug with tabbed editors:

    https://youtrack.jetbrains.com/issue/IJSDK-918

    I've implemented a workaround for now so that files matching the "large" threshold aren't displayed in tabbed editors. That ensures that only one banner is displayed on those files. Once JetBrains provides a fix for this bug I'll remove the workaround.

    This will be included in the next build which will likely be released in the next couple of days.

  7. Log in to comment