Skip to content

Commit bd24969

Browse files
committed
refactor: do not focus lookup elements when a template is active
1 parent e1cff6f commit bd24969

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/kotlin/com/github/lppedd/cc/completion/LookupEnhancer.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.github.lppedd.cc.completion.menu.FilterAction
66
import com.github.lppedd.cc.completion.menu.SettingsActions
77
import com.github.lppedd.cc.configuration.CCConfigService
88
import com.github.lppedd.cc.configuration.CCConfigService.ProviderFilterType.KEEP_SELECTED
9+
import com.github.lppedd.cc.isTemplateActive
910
import com.github.lppedd.cc.keyPressAndRelease
1011
import com.github.lppedd.cc.plus
1112
import com.intellij.codeInsight.completion.CodeCompletionHandlerBase
@@ -95,7 +96,11 @@ internal class LookupEnhancer(private val lookup: LookupImpl) : LookupListener,
9596
// registry key is set to "true".
9697
// Also if the user checked the "Insert selected suggestion by... context-dependent keys"
9798
// option, the FOCUSED degree is used while we want SEMI_FOCUSED
98-
lookup.lookupFocusDegree = LookupFocusDegree.SEMI_FOCUSED
99+
lookup.lookupFocusDegree = if (lookup.editor.isTemplateActive()) {
100+
LookupFocusDegree.UNFOCUSED
101+
} else {
102+
LookupFocusDegree.SEMI_FOCUSED
103+
}
99104
} catch (e: Exception) {
100105
logger.error("Couldn't override the lookup focus degree", e)
101106
}

0 commit comments

Comments
 (0)