Stub Indexes And Multiple Projects

I created stub indexes in order to speed up the resolution of all the identifiers in my custom language.

I would use a string key which is equal to the name of the indentifier, there are no qualifiers in my language, so there are duplicates of each key name - which works well.

It occured to me that I could just use the list of keys to provide variants to my completions, however when there is more than one project i get keys from the other project when calling getAllKeys(project).

I have worked around it by taking the list of keys and then looking up each one and throwing out any that dont have any symbols in my project's scope.

First. Is this a reasonable thing to be doing. The process of filtering out the other projects variables is quite time consuming, so I am not sure I want to rebuild the filtered list every time there are changes to the PsiTree.

Any advise?

1 comment
Comment actions Permalink

Hi Jon,

Since indices are on application level, you get really all keys that are present in the index.
Project parameter there only limits index update scope. You are right that it is not intuitive so we'll add javadoc there.
We also could have filtered the keys according to the project parameter, but it is not done for performance reasons, so you'll have to perform filtering on your own if you need it.
Please note that also keys that do not have associated values at the moment of query will be returned (I call them "zombie-keys").



Please sign in to leave a comment.