mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
RUBY-32242 IJPL-159541 removed the maximum length for above-line and end-of-line declarative inlay hints
Hints on their own line or at the end of a line typically don't need to be truncated as they will not interfere with the readability of the code. GitOrigin-RevId: 344eeaecc43ae130f1b25e4bf72a1335cf3add3c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
595b4b6007
commit
c1eeb41243
@@ -6719,7 +6719,8 @@ f:com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl
|
||||
- text(java.lang.String,com.intellij.codeInsight.hints.declarative.InlayActionData):V
|
||||
- toggleButton(kotlin.jvm.functions.Function1):V
|
||||
f:com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl$Companion
|
||||
- f:createRoot():com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl
|
||||
- f:createRoot(com.intellij.codeInsight.hints.declarative.InlayPosition):com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl
|
||||
- bs:createRoot$default(com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl$Companion,com.intellij.codeInsight.hints.declarative.InlayPosition,I,java.lang.Object):com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl
|
||||
f:com.intellij.codeInsight.hints.declarative.impl.TextInlayPresentationEntry
|
||||
- <init>(java.lang.String,B,com.intellij.codeInsight.hints.declarative.impl.InlayMouseArea):V
|
||||
- b:<init>(java.lang.String,B,com.intellij.codeInsight.hints.declarative.impl.InlayMouseArea,I,kotlin.jvm.internal.DefaultConstructorMarker):V
|
||||
|
||||
@@ -31,7 +31,7 @@ class InlayTreeSinkImpl(
|
||||
@NlsContexts.HintText tooltip: String?,
|
||||
hintFormat: HintFormat,
|
||||
builder: PresentationTreeBuilder.() -> Unit) {
|
||||
val b = PresentationTreeBuilderImpl.createRoot()
|
||||
val b = PresentationTreeBuilderImpl.createRoot(position)
|
||||
b.builder()
|
||||
val tree = b.complete()
|
||||
if (tree.size == 0) {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.hints.declarative.impl
|
||||
|
||||
import com.intellij.codeInsight.hints.declarative.CollapseState
|
||||
import com.intellij.codeInsight.hints.declarative.CollapsiblePresentationTreeBuilder
|
||||
import com.intellij.codeInsight.hints.declarative.InlayActionData
|
||||
import com.intellij.codeInsight.hints.declarative.PresentationTreeBuilder
|
||||
import com.intellij.codeInsight.hints.declarative.*
|
||||
import com.intellij.codeInsight.hints.declarative.impl.util.TinyTree
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
|
||||
/**
|
||||
* The presentation is saved into a [TinyTree] during its construction to be compact.
|
||||
@@ -28,8 +26,12 @@ class PresentationTreeBuilderImpl private constructor(
|
||||
private val context: InlayTreeBuildingContext
|
||||
) : CollapsiblePresentationTreeBuilder {
|
||||
companion object {
|
||||
fun createRoot(): PresentationTreeBuilderImpl {
|
||||
val context = InlayTreeBuildingContext()
|
||||
fun createRoot(position: InlayPosition? = null): PresentationTreeBuilderImpl {
|
||||
if (position == null && !ApplicationManager.getApplication().isUnitTestMode) {
|
||||
throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
val context = InlayTreeBuildingContext(position ?: InlineInlayPosition(0, false))
|
||||
return PresentationTreeBuilderImpl(0, context)
|
||||
}
|
||||
|
||||
@@ -91,7 +93,7 @@ class PresentationTreeBuilderImpl private constructor(
|
||||
|
||||
override fun text(text: String, actionData: InlayActionData?) {
|
||||
require(text.isNotEmpty()) { "Text entry may not be empty. Please, fix the provider implementation." }
|
||||
val segmentText = if (MAX_SEGMENT_TEXT_LENGTH < text.length) {
|
||||
val segmentText = if (context.isTruncateTextNodes() && MAX_SEGMENT_TEXT_LENGTH < text.length) {
|
||||
text.substring(0, MAX_SEGMENT_TEXT_LENGTH) + "…"
|
||||
} else {
|
||||
text
|
||||
@@ -123,7 +125,7 @@ class ActionWithContent(
|
||||
val content: Any
|
||||
)
|
||||
|
||||
private class InlayTreeBuildingContext {
|
||||
private class InlayTreeBuildingContext(private val position: InlayPosition) {
|
||||
private var nodeCount = 1
|
||||
private var limitReached = false
|
||||
var textElementCount = 0
|
||||
@@ -144,4 +146,6 @@ private class InlayTreeBuildingContext {
|
||||
nodeCount++
|
||||
return tree.add(parent, nodePayload, data)
|
||||
}
|
||||
|
||||
fun isTruncateTextNodes() = position is InlineInlayPosition
|
||||
}
|
||||
@@ -109,6 +109,7 @@ class InlayHintsChecker(private val myFixture: CodeInsightTestFixture) {
|
||||
inlayFilter: (Inlay<*>) -> Boolean): List<InlayInfo> {
|
||||
val editor = myFixture.editor
|
||||
val allInlays = editor.inlayModel.getInlineElementsInRange(0, editor.document.textLength) +
|
||||
editor.inlayModel.getAfterLineEndElementsInRange(0, editor.document.textLength) +
|
||||
editor.inlayModel.getBlockElementsInRange(0, editor.document.textLength)
|
||||
|
||||
val hintManager = ParameterHintsPresentationManager.getInstance()
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.k2.codeinsight.hints
|
||||
|
||||
import com.intellij.codeInsight.hints.declarative.InlayActionData
|
||||
import com.intellij.codeInsight.hints.declarative.PresentationTreeBuilder
|
||||
import com.intellij.codeInsight.hints.declarative.PsiPointerInlayActionNavigationHandler
|
||||
import com.intellij.codeInsight.hints.declarative.PsiPointerInlayActionPayload
|
||||
import com.intellij.codeInsight.hints.declarative.StringInlayActionPayload
|
||||
import com.intellij.codeInsight.hints.declarative.*
|
||||
import com.intellij.codeInsight.hints.declarative.impl.PresentationTreeBuilderImpl
|
||||
import com.intellij.psi.createSmartPointer
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
@@ -13,21 +9,7 @@ import org.jetbrains.kotlin.analysis.api.KaSession
|
||||
import org.jetbrains.kotlin.analysis.api.components.DefaultTypeClassIds
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KaClassKind
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KaNamedClassSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaCapturedType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaClassType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaDefinitelyNotNullType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaDynamicType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaErrorType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaFlexibleType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaFunctionType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaIntersectionType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaStarTypeProjection
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaTypeArgumentWithVariance
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaTypeNullability
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaTypeParameterType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaTypeProjection
|
||||
import org.jetbrains.kotlin.analysis.api.types.KaUsualClassType
|
||||
import org.jetbrains.kotlin.analysis.api.types.*
|
||||
import org.jetbrains.kotlin.idea.codeInsight.hints.KotlinFqnDeclarativeInlayActionHandler
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
Reference in New Issue
Block a user