PsiShortNamesCache not working in test fixture?

Hi all,

I'm trying to create some tests for my annotator, and the tests aren't working. This seems to be because PsiShortNamesCache is returning no items even when I search for something common (like "List"). This is roughly what I'm doing to initialise my fixture (my code is in Clojure so this is not exact but I think this is the important bit):

factory = IdeaTestFixtureFactory.getFixtureFactory()
builder = factory.createLightFixtureBuilder(new DefaultLightProjectDescriptor())
fixture = builder.getFixture()
testFixture = factory.createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true))

Am I missing a step necessary to index the SDK classes? I thought that registering the DefaultLightProjectDescriptor would take care of that.

1 comment
Comment actions Permalink

I just found a usage of the short names cache in a test (GroovyStubsTest), which is run from a LightCodeInsightFixtureTestCase. The initialisation of the fixture is basically identical to mine, the only difference is this line:

myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true));

i.e. it's using JavaTestFixtureFactory.getFixtureFactory(). I've changed my code to do that but it still doesn't work - I guess the short names cache is not being initialised with the SDK classes. Is there any way I can do this?

Please sign in to leave a comment.