Search code examples
phpstormfilesizecode-completionxero-apivendor

PhpStorm isn't doing code completion with large file


I've just installed this library. PhpStorm does its usual code completion, except for the \XeroAPI\XeroPHP\Api\AccountingApi class. The \XeroAPI\XeroPHP\Api\IdentityApi class in the same folder works just fine.

The file is quite big - 2,560KB. If I delete roughly half of the 65,000 lines from the class (and it works whether it's the first half or the second half) then I get my code completion back. In fact, I can delete just the last 3,000 or so lines (getting the file down to 2,499KB) and it works.

I've also tried a quick regex find/replace to remove all the @throws PHPDoc comments. This got the file down to 2,491KB and hey presto, code completion works fine.

If I had to make a guess I'd say it's not doing code completion with source files over 2.5MB or something, but I can't find any setting for this.

Any way to get code completion going with this file short of deleting stuff from it (which will be restored next time I do a Composer update anyway)?


Solution

  • Based on your info (especially the mentioned file size and the fact that it starts to work after reducing it) you have hit a limit of max file size that IDE is willing to parse and index.

    Solution: configure idea.max.intellisense.filesize option using Help | Edit Custom Properties command. By default it has a value of 2500 (size in KB). Set it to 3000 or so (to cover your file size) and restart IDE (it reads and applies settings from idea.properties file on start only).

    idea.max.intellisense.filesize=3000
    

    P.S. Do not put that value too big as it may cause other performance issues.