mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-232792 use adjusted offset to find fallback declaration via TargetElementUtil
GitOrigin-RevId: 9ff910b85f28508236f748b33214cd59e3d080ae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
53f18f9f60
commit
fe5ffdca09
@@ -4,10 +4,12 @@
|
||||
package com.intellij.model.psi.impl
|
||||
|
||||
import com.intellij.codeInsight.TargetElementUtil
|
||||
import com.intellij.codeInsight.TargetElementUtilBase
|
||||
import com.intellij.model.psi.PsiSymbolDeclaration
|
||||
import com.intellij.model.psi.PsiSymbolDeclarationProvider
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.util.elementsAroundOffsetUp
|
||||
@@ -26,7 +28,9 @@ fun PsiFile.allDeclarationsAround(offsetInFile: Int): Collection<PsiSymbolDeclar
|
||||
}
|
||||
|
||||
// fall back
|
||||
val leaf: PsiElement? = findElementAt(offsetInFile)
|
||||
val document = PsiDocumentManager.getInstance(project).getDocument(this) ?: return emptyList()
|
||||
val adjustedOffset = TargetElementUtilBase.adjustOffset(this, document, offsetInFile)
|
||||
val leaf: PsiElement? = findElementAt(adjustedOffset)
|
||||
if (leaf != null) {
|
||||
val namedElement: PsiElement? = TargetElementUtil.getNamedElement(leaf)
|
||||
if (namedElement != null) {
|
||||
|
||||
Reference in New Issue
Block a user