mirror of
https://github.com/chylex/IntelliJ-Inspection-Lens.git
synced 2025-01-29 19:45:59 +01:00
Compare commits
2 Commits
8936f0e5be
...
603b35abdb
Author | SHA1 | Date | |
---|---|---|---|
603b35abdb | |||
08ed1aadea |
@ -2,8 +2,13 @@ package com.chylex.intellij.inspectionlens.editor.lens
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.IntentionsUI
|
||||
import com.intellij.codeInsight.hint.HintManager
|
||||
import com.intellij.codeInsight.intention.actions.ShowIntentionActionsAction
|
||||
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler
|
||||
import com.intellij.lang.LangBundle
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
@ -18,6 +23,19 @@ internal object IntentionsPopup {
|
||||
}
|
||||
|
||||
private fun tryShow(editor: Editor): Boolean {
|
||||
// If the IDE uses the default Show Intentions action and handler,
|
||||
// use the handler directly to bypass additional logic from the action.
|
||||
val action = ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS)
|
||||
if (action.javaClass === ShowIntentionActionsAction::class.java) {
|
||||
return tryShowWithDefaultHandler(editor)
|
||||
}
|
||||
else {
|
||||
ActionUtil.invokeAction(action, editor.component, ActionPlaces.EDITOR_INLAY, null, null)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryShowWithDefaultHandler(editor: Editor): Boolean {
|
||||
val project = editor.project ?: return false
|
||||
val file = PsiUtilBase.getPsiFileInEditor(editor, project) ?: return false
|
||||
|
||||
|
@ -67,7 +67,7 @@ class LensRenderer(private var info: HighlightInfo, settings: LensSettingsState)
|
||||
|
||||
val font = editor.colorsScheme.getFont(EditorFontType.PLAIN)
|
||||
val x = r.x + TEXT_HORIZONTAL_PADDING
|
||||
val y = r.y + editor.ascent + 1
|
||||
val y = r.y + editor.ascent
|
||||
val w = inlay.widthInPixels - UNDERLINE_WIDTH_REDUCTION - extraRightPadding
|
||||
val h = editor.descent
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user