Skip to content

Commit 85c4897

Browse files
committed
Suggest all targets when autocompleting with an ordinal. Closes #2214
1 parent 8fcf793 commit 85c4897

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/main/kotlin/platform/mixin/handlers/injectionPoint/InjectionPoint.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,15 @@ abstract class InjectionPoint<T : PsiElement> {
155155
) {
156156
addShiftSupport(at, targetClass, collectVisitor)
157157
addSliceFilter(at, targetClass, collectVisitor)
158-
// make sure the ordinal filter is last, so that the ordinal only increments once the other filters have passed
159-
addOrdinalFilter(at, targetClass, collectVisitor)
160-
addSpecifierFilter(at, targetClass, collectVisitor, defaultSpecifier, mode)
158+
159+
// Make sure the ordinal and specifier filters are last, so that the ordinal only increments once the other
160+
// filters have passed, and the specifier acts on the result of them.
161+
// Separately, these happen to also be the filters that we don't want to apply during completion, so that all
162+
// results are shown.
163+
if (mode != CollectVisitor.Mode.COMPLETION) {
164+
addOrdinalFilter(at, targetClass, collectVisitor)
165+
addSpecifierFilter(at, targetClass, collectVisitor, defaultSpecifier)
166+
}
161167
}
162168

163169
protected open fun addShiftSupport(at: PsiAnnotation, targetClass: ClassNode, collectVisitor: CollectVisitor<*>) {
@@ -218,12 +224,7 @@ abstract class InjectionPoint<T : PsiElement> {
218224
targetClass: ClassNode,
219225
collectVisitor: CollectVisitor<T>,
220226
defaultSpecifier: InjectionPointSpecifier,
221-
mode: CollectVisitor.Mode,
222227
) {
223-
if (mode == CollectVisitor.Mode.COMPLETION) {
224-
// Ignore the specifier, we want to show all results
225-
return
226-
}
227228
val point = at.findDeclaredAttributeValue("value")?.constantStringValue ?: return
228229
val specifier = InjectionPointSpecifier.entries.firstOrNull { point.endsWith(":$it") } ?: defaultSpecifier
229230
collectVisitor.addResultFilter("specifier") { results, _ ->

0 commit comments

Comments
 (0)