mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[icp-http-client] mapHostRangesToPathFirTree fix for Kotlin's interpolated strings
GitOrigin-RevId: ed1fc0fd52b60ee1a35ffdeeb846737fe14359bd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9f37bf12e6
commit
abafb3b6dc
@@ -115,6 +115,17 @@ sealed class StringEntry {
|
||||
|
||||
class Known(val value: String, override val uExpression: UExpression, override val range: TextRange) : StringEntry()
|
||||
class Unknown(override val uExpression: UExpression, override val range: TextRange) : StringEntry()
|
||||
|
||||
val rangeAlignedToHost: TextRange?
|
||||
get() {
|
||||
val entry = this
|
||||
val sourcePsi = entry.uExpression.sourcePsi ?: return null
|
||||
if (sourcePsi is PsiLanguageInjectionHost) return entry.range
|
||||
if (sourcePsi.parent is PsiLanguageInjectionHost) { // Kotlin interpolated string, TODO: encapsulate this logic to range retrieval
|
||||
return entry.range.shiftRight(sourcePsi.startOffsetInParent - ElementManipulators.getValueTextRange(sourcePsi.parent).startOffset)
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
|
||||
Reference in New Issue
Block a user