mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[intention-preview] PsiEditorUtilBase#findEditorByPsiElement; PsiEditorUtil#findEditor: fix for preview
GitOrigin-RevId: ed19a469439eb75c277ebc80b4482f386a9188d7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d472e40b99
commit
555e85aa6c
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.psi.util
|
||||
|
||||
import com.intellij.codeInsight.intention.preview.IntentionPreviewUtils
|
||||
import com.intellij.ide.DataManager
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
@@ -36,6 +37,9 @@ object PsiEditorUtilBase : PsiEditorUtil {
|
||||
*/
|
||||
override fun findEditorByPsiElement(element: PsiElement): Editor? {
|
||||
val psiFile = element.containingFile
|
||||
if (IntentionPreviewUtils.isPreviewElement(psiFile)) {
|
||||
return IntentionPreviewUtils.getPreviewEditor()
|
||||
}
|
||||
val virtualFile = PsiUtilCore.getVirtualFile(element) ?: return null
|
||||
val project = psiFile.project
|
||||
if (virtualFile.isInLocalFileSystem || virtualFile.fileSystem is NonPhysicalFileSystem) { // Try to find editor for the real file.
|
||||
|
||||
Reference in New Issue
Block a user