mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
[gh] Add margins around inlay comment threads in PR review and in-editor view
#IJPL-200018 Fixed GitOrigin-RevId: b9214ec1d48dea2589a471ff2441f43fd5bdf276
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2cc154e09b
commit
394b68bc5c
@@ -396,6 +396,7 @@ f:com.intellij.collaboration.api.json.JsonHttpApiHelperKt
|
||||
- f:isCombinedDiffEnabled():Z
|
||||
*f:com.intellij.collaboration.ui.codereview.CodeReviewChatItemUIUtil
|
||||
- sf:INSTANCE:com.intellij.collaboration.ui.codereview.CodeReviewChatItemUIUtil
|
||||
- sf:THREAD_TOP_MARGIN:I
|
||||
- f:actionsVisibleOnHover(javax.swing.JComponent,javax.swing.JComponent):V
|
||||
- f:build(com.intellij.collaboration.ui.codereview.CodeReviewChatItemUIUtil$ComponentType,kotlin.jvm.functions.Function1,javax.swing.JComponent,kotlin.jvm.functions.Function1):javax.swing.JComponent
|
||||
- f:buildDynamic(com.intellij.collaboration.ui.codereview.CodeReviewChatItemUIUtil$ComponentType,kotlin.jvm.functions.Function1,javax.swing.JComponent,kotlin.jvm.functions.Function1):javax.swing.JComponent
|
||||
|
||||
@@ -223,6 +223,8 @@ advanced.settings.collab.tools=Code Review Tools
|
||||
advanced.setting.enable.combined.diff.for.codereview=All-in-one Diff for Code Reviews
|
||||
advanced.setting.enable.combined.diff.for.codereview.description=If enabled, all changed files in code reviews are shown in a single scrollable Diff view
|
||||
|
||||
advanced.setting.show.review.threads.with.increased.margins=Keep increased margins for Diff threads
|
||||
|
||||
### Path mode related messages, used in the create snippet dialog
|
||||
snippet.create.path-mode=Path handling mode:
|
||||
snippet.create.path-mode.unavailable.tooltip=This naming scheme causes conflicts
|
||||
|
||||
@@ -35,6 +35,7 @@ object CodeReviewChatItemUIUtil {
|
||||
*/
|
||||
val TEXT_CONTENT_WIDTH: Int
|
||||
get() = (JBUIScale.DEF_SYSTEM_FONT_SIZE * 42).roundToInt()
|
||||
const val THREAD_TOP_MARGIN: Int = 8
|
||||
|
||||
// we use unscaled insets, bc they will be scaled when we create the border
|
||||
@Suppress("UseDPIAwareInsets")
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.collaboration.ui.codereview.editor
|
||||
|
||||
import com.intellij.codeInsight.documentation.render.DocRenderer
|
||||
import com.intellij.collaboration.async.launchNow
|
||||
import com.intellij.collaboration.ui.codereview.CodeReviewChatItemUIUtil.THREAD_TOP_MARGIN
|
||||
import com.intellij.diff.util.DiffDrawUtil
|
||||
import com.intellij.diff.util.DiffUtil
|
||||
import com.intellij.icons.AllIcons
|
||||
@@ -29,6 +30,7 @@ import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.ui.ExperimentalUI
|
||||
import com.intellij.ui.scale.JBUIScale
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.intellij.util.ui.JBUI
|
||||
import icons.CollaborationToolsIcons
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -147,7 +149,7 @@ private constructor(
|
||||
val lastThread = editor.inlayModel.getBlockElementsForVisualLine(visualLine, false).lastOrNull()
|
||||
|
||||
// makes sure that icons don't overlap
|
||||
y = maxOf(y, lastThread?.bounds?.y?.minus(iconPadding) ?: y)
|
||||
y = maxOf(y, lastThread?.bounds?.y?.minus(iconPadding) ?: y) + JBUI.scale(THREAD_TOP_MARGIN)
|
||||
}
|
||||
|
||||
val range = y + iconPadding..y + iconPadding + iconHeight
|
||||
|
||||
@@ -95,6 +95,12 @@
|
||||
<registryKey defaultValue="30"
|
||||
description="Seconds between checking the ETag for the PR list"
|
||||
key="github.pr.list.automatic.refresh.seconds"/>
|
||||
<advancedSetting
|
||||
id="show.review.threads.with.increased.margins"
|
||||
default="true"
|
||||
bundle="messages.CollaborationToolsBundle"
|
||||
groupKey="advanced.settings.collab.tools"
|
||||
/>
|
||||
|
||||
<vcs.github.gistContentsCollector
|
||||
implementation="org.jetbrains.plugins.github.DefaultGithubGistContentsCollector"
|
||||
|
||||
@@ -21,8 +21,10 @@ import com.intellij.collaboration.ui.codereview.timeline.thread.CodeReviewResolv
|
||||
import com.intellij.collaboration.ui.codereview.timeline.thread.TimelineThreadCommentsPanel
|
||||
import com.intellij.collaboration.ui.util.*
|
||||
import com.intellij.openapi.actionSystem.UiDataProvider
|
||||
import com.intellij.openapi.options.advanced.AdvancedSettings
|
||||
import com.intellij.openapi.ui.MessageDialogBuilder
|
||||
import com.intellij.ui.components.ActionLink
|
||||
import com.intellij.ui.components.panels.Wrapper
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.launchOnShow
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -40,6 +42,10 @@ import javax.swing.Action
|
||||
import javax.swing.JComponent
|
||||
|
||||
internal object GHPRReviewEditorComponentsFactory {
|
||||
private const val VERTICAL_INLAY_MARGIN = 8
|
||||
private const val LEFT_INLAY_MARGIN = 34
|
||||
private const val RIGHT_INLAY_MARGIN = 0
|
||||
|
||||
fun createThreadIn(cs: CoroutineScope, vm: GHPRCompactReviewThreadViewModel): JComponent {
|
||||
val commentsPanel = ComponentListPanelFactory.createVertical(cs, vm.comments) { item ->
|
||||
val itemCs = this
|
||||
@@ -82,7 +88,11 @@ internal object GHPRReviewEditorComponentsFactory {
|
||||
CodeReviewCommentUIUtil.createEditorInlayPanel(it)
|
||||
}, UiDataProvider { sink ->
|
||||
sink[GHPRReviewThreadViewModel.THREAD_VM_DATA_KEY] = vm
|
||||
})
|
||||
}).apply {
|
||||
if (AdvancedSettings.getBoolean("show.review.threads.with.increased.margins")) {
|
||||
border = JBUI.Borders.empty(VERTICAL_INLAY_MARGIN, LEFT_INLAY_MARGIN, VERTICAL_INLAY_MARGIN, RIGHT_INLAY_MARGIN)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun CoroutineScope.createReplyActionsPanel(vm: GHPRCompactReviewThreadViewModel): JComponent {
|
||||
@@ -160,7 +170,14 @@ internal object GHPRReviewEditorComponentsFactory {
|
||||
border = JBUI.Borders.empty(itemType.inputPaddingInsets)
|
||||
}
|
||||
|
||||
return CodeReviewCommentUIUtil.createEditorInlayPanel(editor)
|
||||
return if (AdvancedSettings.getBoolean("show.review.threads.with.increased.margins")) {
|
||||
Wrapper(CodeReviewCommentUIUtil.createEditorInlayPanel(editor)).apply {
|
||||
border = JBUI.Borders.empty(VERTICAL_INLAY_MARGIN, LEFT_INLAY_MARGIN, VERTICAL_INLAY_MARGIN, RIGHT_INLAY_MARGIN)
|
||||
}
|
||||
}
|
||||
else {
|
||||
CodeReviewCommentUIUtil.createEditorInlayPanel(editor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun CoroutineScope.createUiAction(
|
||||
|
||||
Reference in New Issue
Block a user