mirror of
https://github.com/chylex/IntelliJ-Keyboard-Master.git
synced 2024-11-25 19:42:46 +01:00
Compare commits
No commits in common. "a0500a8666930b82a0fe7fd7b1c2838df47be70b" and "15e459d885e27cc3e9074e9ee996a0c56242620c" have entirely different histories.
a0500a8666
...
15e459d885
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.chylex.intellij.keyboardmaster"
|
group = "com.chylex.intellij.keyboardmaster"
|
||||||
version = "0.4.1"
|
version = "0.4.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -16,7 +16,7 @@ repositories {
|
|||||||
|
|
||||||
intellij {
|
intellij {
|
||||||
type.set("IU")
|
type.set("IU")
|
||||||
version.set("233.11799-EAP-CANDIDATE-SNAPSHOT")
|
version.set("2023.2")
|
||||||
updateSinceUntilBuild.set(false)
|
updateSinceUntilBuild.set(false)
|
||||||
|
|
||||||
plugins.add("com.intellij.java")
|
plugins.add("com.intellij.java")
|
||||||
@ -35,7 +35,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.patchPluginXml {
|
tasks.patchPluginXml {
|
||||||
sinceBuild.set("233.11799.30")
|
sinceBuild.set("232")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package com.chylex.intellij.keyboardmaster.feature.codeCompletion
|
package com.chylex.intellij.keyboardmaster.feature.codeCompletion
|
||||||
|
|
||||||
import com.intellij.codeInsight.lookup.Lookup
|
import com.intellij.codeInsight.lookup.Lookup
|
||||||
import com.intellij.codeInsight.lookup.LookupElement
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
||||||
import com.intellij.codeInsight.lookup.LookupManagerListener
|
import com.intellij.codeInsight.lookup.LookupManagerListener
|
||||||
import com.intellij.codeInsight.lookup.impl.LookupCellRenderer.ItemPresentationCustomizer
|
|
||||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
||||||
import com.intellij.openapi.util.Key
|
import com.intellij.openapi.util.Key
|
||||||
import javax.swing.Icon
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds hints to code completion popup items with the character that selects the item.
|
* Adds hints to code completion popup items with the character that selects the item.
|
||||||
@ -40,32 +37,26 @@ class CodeCompletionPopupListener : LookupManagerListener {
|
|||||||
newLookup.putUserData(IS_MODIFIED_KEY, true)
|
newLookup.putUserData(IS_MODIFIED_KEY, true)
|
||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
newLookup.addPresentationCustomizer(object : ItemPresentationCustomizer {
|
newLookup.addPresentationCustomizer { item, presentation ->
|
||||||
override fun customizePresentation(item: LookupElement, presentation: LookupElementPresentation): LookupElementPresentation {
|
val itemList = newLookup.list.model
|
||||||
val itemList = newLookup.list.model
|
val itemCount = itemList.size
|
||||||
val itemCount = itemList.size
|
val offset = getPageOffset(newLookup)
|
||||||
val offset = getPageOffset(newLookup)
|
|
||||||
|
|
||||||
for (index in 0 until CodeCompletionPopupConfiguration.itemShortcutCount) {
|
for (index in 0 until CodeCompletionPopupConfiguration.itemShortcutCount) {
|
||||||
val itemIndex = offset + index
|
val itemIndex = offset + index
|
||||||
if (itemIndex >= itemCount) {
|
if (itemIndex >= itemCount) {
|
||||||
break
|
break
|
||||||
}
|
|
||||||
|
|
||||||
if (item === itemList.getElementAt(itemIndex)) {
|
|
||||||
val customized = LookupElementPresentation()
|
|
||||||
customized.copyFrom(presentation)
|
|
||||||
customized.appendTailTextItalic(CodeCompletionPopupConfiguration.getHintText(index), true)
|
|
||||||
return customized
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return presentation
|
if (item === itemList.getElementAt(itemIndex)) {
|
||||||
|
val customized = LookupElementPresentation()
|
||||||
|
customized.copyFrom(presentation)
|
||||||
|
customized.appendTailTextItalic(CodeCompletionPopupConfiguration.getHintText(index), true)
|
||||||
|
return@addPresentationCustomizer customized
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun customizeEmptyIcon(icon: Icon): Icon {
|
presentation
|
||||||
return icon
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user