Is there a way to force indexing?

Answered

I'm relatively new to IDEA and I don't know all the tricks and ins-and-outs of it yet, so sorry if this feature already exists, or if it's a really easy question to answer...

Is there a way to tell IDEA "Hey, I want you to re-index this module (or directory, or file) right now, please."  In general, IDEA seems to be pretty good at staying on top of changes, but I've noticed a few times where IDEA's UI hasn't caught up to changes I've made (for example, if I remove a needed module dependency, I frequently have to actually open up .java files in the viewer before IDEA will re-index them and flag them as having an error.

Furthermore, a "Hey IDEA, stop indexing right now, I just want to read this damn file" button would be nice too, but I'm sure there are a bunch of reasons over my head for why that would be a terrible idea.

I'm sure I'm not the first person to think of this, and I bet it has been discussed before (I didn't find any threads in my cursory search, feel free to flame if I missed something obvious), so I imagine there's a good reason the feature doesn't seem to exist... I am just curious what it is.

9 comments
Comment actions Permalink

File > Invalidate Caches...


22
Comment actions Permalink

I don't think he really means "indexing", but what IDEA calls "Synchronize".
There's a menu item/toolbar button for that (File -> Synchronize, or third button on the toolbar).

4
Comment actions Permalink

Thanks for both the quick replies!  I'll play around with both of those and see if they help (I imagine it's exactly what I'm looking for).  You may well be right about my misuse of the term "indexing."  Like I said, I'm still getting acquainted with IDEA.

0
Comment actions Permalink

IDEA will synchronize the underlying file system, when switching from an external application back to IDEA. Then you will notice a little spinner in the bottom left of the window, which indicates, that the file system is being searched for changes.

For example we are using a Rake task to compile CSS files from SASS. After changing a SASS file in IDEA, we switch to the shell, where Rake is running and thanks to IDEAs feature of saving files at context switch, we even don't need to save the SASS file first. Rake notices the change and recompiles the CSS. Then, switching back to IDEA, the IDE will synchronize FS state and discover the changed CSS files. After the spinner has stopped, we switch to the browser and IDEA will update the new CSS files to the webapp server.

So, IDEA uses a lot of implicit synchronization. I imagine, you come from Eclipse, because Eclipse has this horrible "mirror-like-Eclipse-internal-file-system" which almost never shows the correct state. In fact, for me this was one of the main reasons for switching to IDEA.

0
Comment actions Permalink

I'd like to ask the opposite...

Is there a way to let it do indexing less often? Is there a way to let it only index certain types of files (e.g. index java but not javascript)? Is there a way to let it stop indexing and let you work normally again while it is busy indexing (in a case where you don't really care that the index will be a bit off then). Is there a way to let it not reindex everything after IntelliJ crashed or was in a deadlock and you had to kill its process?

I accidently slipped the mouse and pressed the synchronize instead of the save button. Boom, 15 minutes of time lost because it starts indexing and disables all kinds of actions while doing that...

Thanks!

0
Comment actions Permalink

Hello Aardwolf,

The indexes cannot be "a bit off"; they can be either available or not available.

To stop indexing certain types of files, you can remap them to plain text
file type.

We may be able to implement an action for suspending indexing, but you won't
be able to work normally in that state - all functionality relying on indexes
(such as Find Usages and refactorings) will not be available.

In general, if you see excessively long indexing in cases other than abnormal
termination of the IDEA process, there's something that can be optimized
in your project configuration to shorten the indexing time. In particular,
this can be achieved by marking directories as excluded in the project structure
dialog.

I'd like to ask the opposite...

Is there a way to let it do indexing less often? Is there a way to let
it only index certain types of files (e.g. index java but not
javascript)? Is there a way to let it stop indexing and let you work
normally again while it is busy indexing (in a case where you don't
really care that the index will be a bit off then). Is there a way to
let it not reindex everything after IntelliJ crashed or was in a
deadlock and you had to kill its process?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


1
Comment actions Permalink

I'm trying to use Cucumber to do the functional tests of the project I'm working on, however IntelliJ is not synchronizing the .feature file. Can someone help me?

0
Comment actions Permalink

Please submit a ticket at https://intellij-support.jetbrains.com/hc/requests/new with the problem details.

0

Please sign in to leave a comment.