IDEA-155183 Class autocomplete in META-INF.services duplicate packages

This commit is contained in:
peter
2016-04-29 22:56:21 +02:00
parent 48b941daa8
commit 631964661f
2 changed files with 40 additions and 0 deletions
@@ -17,6 +17,7 @@ package com.intellij.spi.psi;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.util.ClassUtil;
@@ -35,6 +36,11 @@ public class SPIClassProviderReferenceElement extends SPIPackageOrClassReference
super(node);
}
@Override
public TextRange getRangeInElement() {
return TextRange.from(0, getTextLength());
}
@NotNull
@Override
public Object[] getVariants() {
@@ -0,0 +1,34 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.lang.spi;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
/**
* @author peter
*/
public class SPICompletionTest extends LightCodeInsightFixtureTestCase {
public void testQualifiedReference() {
myFixture.addClass("package com.foo; public class Interface {}");
myFixture.addClass("package com.foo; public class Implementation extends Interface {}");
myFixture.configureFromExistingVirtualFile(
myFixture.addFileToProject("META-INF/services/com.foo.Interface", "com.f<caret>").getVirtualFile());
myFixture.completeBasic();
myFixture.checkResult("com.foo.Implementation");
}
}