LightPlatformCodeInsightFixtureTestCase myFixture.getLookup returns null, but lookup appears in editor itself

I'm using LightPlatformCodeInsightFixtureTestCase to test the completion for my plugin.  I have all the tests passing except for those that test completion of `alias as:`.  For some reason, in these tests, the CodeInsightTestFixture#getLookup returns null.  I've placed break points in the getVariants call and it is being called in theses tests, but unlike the other tests the fixture says there's no lookup.  Is there some reason the tests lookup would behave differently than the Debug Plugin runner lookup?

2 comments
Comment actions Permalink

I was doing dot-driven-debugging, looking for other methods to call on myFixture and saw there was getCompletionVariants. Looking at it's actual implementation, it looks like if the lookup would only have on element, it's not shown

But, that's not the behavior in the actual IDE, so how do I get the single value the real IDE would show to check my completion?

public List<String> getCompletionVariants(@NotNull String... filesBefore) {
this.assertInitialized();
this.configureByFiles(filesBefore);
LookupElement[] items = this.complete(CompletionType.BASIC);
Assert.assertNotNull("No lookup was shown, probably there was only one lookup element that was inserted automatically", items);
return this.getLookupElementStrings();
}
0
Comment actions Permalink

The single lookup element might be inserted automatically according to the logic in CodeCompletionHandlerBase#shouldAutoComplete. It might be that your test (or the real IDE) has non-default setting value that controls auto-insertion.

0

Please sign in to leave a comment.