Find usages in text files and slow editing of large sql files

I've had a couple issues in IntelliJ 9 (9.0.2) that I didn't have in 8.

When using find usages of a class, and including search for text occurrences, it does not return with references to this class in xml or properties files.
The xml and properties files are not in directories marked as source (as they're in config file directories) but are part of the project files and are included in the class path.
In version 8, finding usages used to return with these text references, but I can't get it to work in 9.

Another issue I've been having is editing large sql files (i.e. 3000-4000+ lines).
Most of these files are simply lots of insert statements.
Under Inspections, I have the whole SQL Inspections group disabled.
I have no additional SQL plugins installed or enabled.
The only processing that should be happening is syntax highlighting.
Whenever I add or remove an insert statement the whole IDE freezes for inspection/highlighting for 10-30 seconds.
It wasn't this bad in 8.
Is there some way I can speed this up without disabling syntax highlighting?


Comment actions Permalink

I'm afraid we need more details within the request:

  1. What IDEA edition do you use - Community or Ultimate?
  2. As far as I understand you say that xml that references target class doesn't remain under 'source' directory (or its descendant). What do you mean under 'config file directories are part of the project files and are included in the class path'? I.e. your configuration setup is not clear at the moment;
  3. Can I ask you to submit new ticket to IDEA tracker with mentioned problem description and one of those huge sql files attached?
Comment actions Permalink

Ultimate edition.
I think there were some changes that caused this behavior.

If I set the config directory as a source directory then it does find usages in the xml files of classes.
I had checked my project files for previous IntelliJ versions and I never had those directories marked as source before, so it must have changed where it looks for usages.
i.e. the project has a root directory, with src as a subdir, and config as another subdir at same level as src. Only src was marked as a source directory. Config was just under the project root dir (so just a yellow icon).
+ root
    |_  src
    |_  config
So that's fine I guess. It just means for some cases I need use Find in Path instead of Find Usages (or add more source directories).

I think the large sql file inspection performance may be due to the change in scope and inspection settings.
Previously I had set my 'realtime' java inspection profile for all non-generated java files only.
Now it appears that this profile is the default and applies to the entire project.
Some of those inspections may not be skipping processing for sql files or may be not specific to java.

So I think I need to now setup the scope of individual inspections to only include java files if I only want them to execute there?
That seems very irritating to setup and maintain and try to keep track of where inspections are assigned.
Unless I'm missing something that makes this easier?


Comment actions Permalink

Just checked 'Find Usages' in scenario you described and it works fine for me under IDEA Ultimate 9.0.2:

You can see that I have a dummy xml file that is not located under 'source' directory and references target class:


That is highlighted at 'Find Usages' results:

Regarding inspection profiles configuration - there is a change with that at IDEA 9 indeed - you assign scopes to concrete inspections at inspection profile instead of the whole profile (IDEA 8 approach). We know about inconvenience in case of necessity to perform bulk inspection-scope mappings change and planning to address that at IDEA 10 - IDEA-49028.

Comment actions Permalink

Thanks for the reply.

I look forward to the fix for that inspection profile scope issue.
Configuring inspections takes me quite a long time, I can't see myself setting aside any time to narrow the scope of individual inspections.
I rarely have any performance issues editing java files, which is the  main file type I work with these days.
I'll probably end up living with poor performance for editing sql or xml files until 10.

So I found more about the find usages issue.
These configuration files are loaded through the class path, so I have a module library that includes the directory, allowing it to be added to the project's class path when executing run/debug targets (to simulate same class path as when run from script).
If I remove the directory from the class path then find usages begins working again.
Also if I marked the directory as a source directory then find usages works whether or not I have added the directory to the class path.
If you want to try this out, add the 'xxx' directory to the module's classpath and you'll see it no longer searches within it (stops indexing it?).

Even if I remove the directory from the library and add it as a single module dependency with runtime selected, it's still excluded from usage searches.

Comment actions Permalink

About inspections configuration - want to point out that there is no GUI way to perform such bulk processing at the moment, howerver, you can automate the job by custom scripting.

I.e. as far as I see you want to setup automatic process that assigns target scopes to target inspections. That may be done by the following actions then:

  1. Create target scope(s) using IDEA GUI;
  2. Create target inspection profile(s);
  3. Create target scope-inspection configuration at any way that is convenient for you;
  4. Create script that gets scope-inspection configuration as an input and tweks IDEA configuration in accordance with it;

About inspections profile configuration - it's a plain *.xml file that is stored under $PROJECT_HOME/.idea/config/inspectionProfiles directory (shared per-project mode). It has rather simple structure, for example consider that we peformed the following custom inspection profile settings via IDEA GUI:

Our custom inspection profile is called 'custom_inspection_profile', so, $PROJECT_HOME/.idea/config/inspectionProfiles/custom_inspection_profile.xml file is created. It has the following content:

<component name="InspectionProjectProfileManager">
  <profile version="1.0" is_locked="false">
    <option name="myName" value="custom-inspection-profile" />
    <option name="myLocal" value="false" />
    <inspection_tool class="AccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true">
      <scope name="my-custom-scope" level="WARNING" enabled="false" />
    <inspection_tool class="Annotator" enabled="true" level="ERROR" enabled_by_default="false">
      <scope name="my-custom-scope" level="ERROR" enabled="true" />

You can see that it's rather simple to create a script that tweaks profile xml context as necessary.

About 'Find Usages' - I tried your configuration, i.e. added single-entry-module library that points to directory and the processing is still fine for me. I.e. target class referenced at *.xml file that doesn't remain at directory marked as 'Source' is found. It would be great if you create minimal but complete standalone example that illustrates the problem and post it here because I suspect there is still a difference in our configurations.


Please sign in to leave a comment.