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.