mirror of
https://github.com/chylex/IntelliJ-Inspection-Lens.git
synced 2025-04-23 21:15:47 +02:00
Fix intentions popup not working in Rider and CLion Nova
This commit is contained in:
parent
08ed1aadea
commit
603b35abdb
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user