mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gh] IJPL-214108 Add FUS logging for multiline comments
#IJPL-214108 Fixed (cherry picked from commit 71f3bb7591ba8e5517e814a5604d4420ebc86a72) IJ-CR-179838 GitOrigin-RevId: 1ea4cac39df8e300c2a595810bfc7b30abffce5b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4bfdbf65dd
commit
b0245713cb
+13
-1
@@ -26,7 +26,7 @@ import java.util.*
|
||||
|
||||
// TODO: Fix or replace a whole bunch of these statistics as they're no longer being collected since generalizing to Collab Tools
|
||||
internal object GHPRStatisticsCollector : CounterUsagesCollector() {
|
||||
private val COUNTERS_GROUP = EventLogGroup("vcs.github.pullrequest.counters", 10)
|
||||
private val COUNTERS_GROUP = EventLogGroup("vcs.github.pullrequest.counters", 11)
|
||||
|
||||
private val LOG = logger<GHPRStatisticsCollector>()
|
||||
|
||||
@@ -45,6 +45,18 @@ internal object GHPRStatisticsCollector : CounterUsagesCollector() {
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region: Multiline comments
|
||||
private val COMMENTS_RESIZED_EVENT = COUNTERS_GROUP.registerEvent("comments.resized", "The user resized range of a new comment by dragging its outline across the text")
|
||||
private val MULTILINE_COMMENTS_CREATED = COUNTERS_GROUP.registerEvent("multiline.comments.created", "The user created a new comment that spans multiple lines")
|
||||
fun logResizedComments(project: Project) {
|
||||
COMMENTS_RESIZED_EVENT.log(project)
|
||||
}
|
||||
|
||||
fun logMultilineCommentsCreated(project: Project) {
|
||||
MULTILINE_COMMENTS_CREATED.log(project)
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region: Filters
|
||||
private val FILTER_SEARCH_PRESENT = EventFields.Boolean("has_search")
|
||||
private val FILTER_STATE_PRESENT = EventFields.Boolean("has_state")
|
||||
|
||||
+8
-4
@@ -27,6 +27,7 @@ import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.ai.GHPRAICommentViewModel
|
||||
import org.jetbrains.plugins.github.ai.GHPRAIReviewExtension
|
||||
import org.jetbrains.plugins.github.api.data.pullrequest.isViewed
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRStatisticsCollector
|
||||
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext
|
||||
import org.jetbrains.plugins.github.pullrequest.data.provider.GHPRDataProvider
|
||||
import org.jetbrains.plugins.github.pullrequest.data.provider.viewedStateComputationState
|
||||
@@ -59,7 +60,7 @@ interface GHPRDiffReviewViewModel {
|
||||
}
|
||||
|
||||
internal class GHPRDiffReviewViewModelImpl(
|
||||
project: Project,
|
||||
private val project: Project,
|
||||
parentCs: CoroutineScope,
|
||||
private val dataContext: GHPRDataContext,
|
||||
private val dataProvider: GHPRDataProvider,
|
||||
@@ -133,13 +134,16 @@ internal class GHPRDiffReviewViewModelImpl(
|
||||
threadsVms.cancelNewComment(change, side, lineIdx)
|
||||
|
||||
|
||||
override fun updateCommentLines(oldLineRange: LineRange, newLineRange: LineRange) =
|
||||
threadsVms.newComments.value.firstOrNull {
|
||||
override fun updateCommentLines(oldLineRange: LineRange, newLineRange: LineRange) {
|
||||
val newComment = threadsVms.newComments.value.firstOrNull {
|
||||
when (val loc = it.position.value.location) {
|
||||
is GHPRReviewCommentLocation.SingleLine -> loc.lineIdx == oldLineRange.end
|
||||
is GHPRReviewCommentLocation.MultiLine -> loc.startLineIdx == oldLineRange.start && loc.lineIdx == oldLineRange.end
|
||||
}
|
||||
}?.updateLineRange(newLineRange) ?: Unit
|
||||
} ?: return
|
||||
newComment.updateLineRange(newLineRange)
|
||||
GHPRStatisticsCollector.logResizedComments(project)
|
||||
}
|
||||
|
||||
override val isViewedState: StateFlow<ComputedResult<Boolean>> =
|
||||
dataProvider.viewedStateData.viewedStateComputationState
|
||||
|
||||
+8
-5
@@ -24,6 +24,7 @@ import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.plugins.github.api.data.GHUser
|
||||
import org.jetbrains.plugins.github.api.data.pullrequest.isViewed
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRStatisticsCollector
|
||||
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext
|
||||
import org.jetbrains.plugins.github.pullrequest.data.provider.GHPRDataProvider
|
||||
import org.jetbrains.plugins.github.pullrequest.data.provider.viewedStateComputationState
|
||||
@@ -80,7 +81,7 @@ interface GHPRReviewFileEditorViewModel {
|
||||
private val LOG = logger<GHPRReviewFileEditorViewModelImpl>()
|
||||
|
||||
internal class GHPRReviewFileEditorViewModelImpl(
|
||||
project: Project,
|
||||
private val project: Project,
|
||||
parentCs: CoroutineScope,
|
||||
private val dataContext: GHPRDataContext,
|
||||
private val dataProvider: GHPRDataProvider,
|
||||
@@ -205,14 +206,16 @@ internal class GHPRReviewFileEditorViewModelImpl(
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateCommentLines(oldLineRange: LineRange, newLineRange: LineRange) =
|
||||
threadsVm.newComments.value.firstOrNull {
|
||||
override fun updateCommentLines(oldLineRange: LineRange, newLineRange: LineRange) {
|
||||
val newComment = threadsVm.newComments.value.firstOrNull {
|
||||
when (val loc = it.position.value.location) {
|
||||
is GHPRReviewCommentLocation.SingleLine -> loc.lineIdx == oldLineRange.end
|
||||
is GHPRReviewCommentLocation.MultiLine -> loc.startLineIdx == oldLineRange.start && loc.lineIdx == oldLineRange.end
|
||||
}
|
||||
}?.updateLineRange(newLineRange) ?: Unit
|
||||
|
||||
} ?: return
|
||||
newComment.updateLineRange(newLineRange)
|
||||
GHPRStatisticsCollector.logResizedComments(project)
|
||||
}
|
||||
|
||||
override fun cancelNewComment(lineIdx: Int) =
|
||||
threadsVm.cancelNewComment(change, Side.RIGHT, lineIdx)
|
||||
|
||||
+4
@@ -22,6 +22,7 @@ import kotlinx.coroutines.flow.combine
|
||||
import org.jetbrains.plugins.github.api.data.GHActor
|
||||
import org.jetbrains.plugins.github.api.data.GHPullRequestReviewEvent
|
||||
import org.jetbrains.plugins.github.api.data.request.GHPullRequestDraftReviewThread
|
||||
import org.jetbrains.plugins.github.pullrequest.GHPRStatisticsCollector
|
||||
import org.jetbrains.plugins.github.pullrequest.config.GithubPullRequestsProjectUISettings
|
||||
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestPendingReview
|
||||
import org.jetbrains.plugins.github.pullrequest.data.provider.GHPRDataProvider
|
||||
@@ -135,6 +136,9 @@ internal class GHPRReviewNewCommentEditorViewModelImpl(
|
||||
if (isCumulative) {
|
||||
val startLine = location.asSafely<GHPRReviewCommentLocation.MultiLine>()?.startLineIdx?.inc() ?: line
|
||||
reviewDataProvider.createThread(reviewId, it, line, location.side, startLine, filePath)
|
||||
if (startLine < line) {
|
||||
GHPRStatisticsCollector.logMultilineCommentsCreated(project)
|
||||
}
|
||||
}
|
||||
else {
|
||||
val commitSha = position.value.change.revisionNumberAfter.asString()
|
||||
|
||||
Reference in New Issue
Block a user