PY-40480 Lift literal type completion results higher in a lookup

GitOrigin-RevId: 51fcf9b611250104fdeff04284e908cce1164560
This commit is contained in:
Petr
2024-05-16 17:27:58 +02:00
committed by intellij-monorepo-bot
parent e401164f05
commit 01d14fab4e
4 changed files with 10 additions and 7 deletions

View File

@@ -416,6 +416,8 @@ f:com.intellij.codeInsight.completion.PrioritizedLookupElement
- s:withExplicitProximity(com.intellij.codeInsight.lookup.LookupElement,I):com.intellij.codeInsight.lookup.LookupElement
- s:withGrouping(com.intellij.codeInsight.lookup.LookupElement,I):com.intellij.codeInsight.lookup.LookupElement
- s:withPriority(com.intellij.codeInsight.lookup.LookupElement,D):com.intellij.codeInsight.lookup.LookupElement
*:com.intellij.codeInsight.completion.ml.MLRankingIgnorable
- s:wrap(com.intellij.codeInsight.lookup.LookupElement):com.intellij.codeInsight.lookup.LookupElement
a:com.intellij.codeInsight.completion.util.ParenthesesInsertHandler
- com.intellij.codeInsight.completion.InsertHandler
- sf:NO_PARAMETERS:com.intellij.codeInsight.completion.util.ParenthesesInsertHandler

View File

@@ -547,8 +547,6 @@ com.intellij.codeInsight.completion.ml.ContextFeatures
- a:categoricalValue(java.lang.String):java.lang.String
- a:classNameValue(java.lang.String):java.lang.String
- a:floatValue(java.lang.String):java.lang.Double
*:com.intellij.codeInsight.completion.ml.MLRankingIgnorable
- s:wrap(com.intellij.codeInsight.lookup.LookupElement):com.intellij.codeInsight.lookup.LookupElement
f:com.intellij.codeInsight.completion.util.CompletionStyleUtil
- <init>():V
- s:getCodeStyleSettings(com.intellij.codeInsight.completion.InsertionContext):com.intellij.psi.codeStyle.CommonCodeStyleSettings

View File

@@ -1,6 +1,7 @@
package com.jetbrains.python.codeInsight.completion
import com.intellij.codeInsight.completion.*
import com.intellij.codeInsight.completion.ml.MLRankingIgnorable
import com.intellij.codeInsight.lookup.LookupElementBuilder
import com.intellij.patterns.PlatformPatterns.psiElement
import com.intellij.patterns.StandardPatterns.or
@@ -71,11 +72,13 @@ private class PyLiteralTypeCompletionProvider : CompletionProvider<CompletionPar
.filterIsInstance<PyStringLiteralExpression>()
.forEach {
result.addElement(
PrioritizedLookupElement.withPriority(
LookupElementBuilder
.create(lookupString(it))
.withIcon(IconManager.getInstance().getPlatformIcon(PlatformIcons.Parameter)),
PythonCompletionWeigher.PRIORITY_WEIGHT.toDouble()
MLRankingIgnorable.wrap(
PrioritizedLookupElement.withPriority(
LookupElementBuilder
.create(lookupString(it))
.withIcon(IconManager.getInstance().getPlatformIcon(PlatformIcons.Parameter)),
PythonCompletionWeigher.PRIORITY_WEIGHT.toDouble()
)
)
)
}