DummyIdentifier and CompletionContributor order
I'm having an issue with the way things are processed by the CompletionContributors:
I have 2 distinct CompletionContributors, the first one (A) works well with the default dummy identifier, the second (B) one requires the addition of a special symbol for the parser to run without errors. I need an errorless parsed file because the relative position of the psi element determines what is suggested.
I'm overriding the beforeCompletion for B to provide the new identifier and in the plugin.xml state that B runs after A.
I would have thought that this would mean that the order of things would be:
- A: beforeCompletion() --
- A: fillCompletionVariants() -- provide completions
- B: beforeCompletion() -- set new dummy identifier
- B: fillCompletionVariants() - provide completions
However, it appears to be:
- A: beforeCompletion() --
- B: beforeCompletion() -- set new dummy identifier
- A: fillCompletionVariants() -- provide completions
- B: fillCompletionVariants() - provide completions
The new identifier messes up the Pattern used for B. Is this how it's intended because that feel rather counter intuitive looking at the ordering mechanisme provided by the plugin.xml. I can see the use for the result.stopHere() but having any completion provider modify the identifier before running the provider stated to run before it seems bad.
Please sign in to leave a comment.
Using separate dummy identifiers for different contributors would likely be slow, as when a dummy identifier is introduced, a complete non-physical copy of the file is created and parsed. Usually, developers change dummy identifiers based on context PsiElement (using something like context.getFile().findElementAt(context.getStartOffset())), so if some contributor provides completion options at specific context, the identifier is changed in that context only.