From c6249e40bdb012f4f79f2e22062e0183e705989c Mon Sep 17 00:00:00 2001 From: Sakana <15715093608@163.com> Date: Tue, 1 Dec 2026 21:46:44 +0800 Subject: [PATCH] fix(oxc): show each lint rule when markers share a column Keep each label with its diagnostic while sorting the markers. Matching a label by column made unrelated diagnostics at the same position share a rule name, severity, tooltip and documentation link. --- packages/oxc/src/app/components/LineError.vue | 52 +++++-------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/packages/oxc/src/app/components/LineError.vue b/packages/oxc/src/app/components/LineError.vue index 213265a04..da3cec0d9 100644 --- a/packages/oxc/src/app/components/LineError.vue +++ b/packages/oxc/src/app/components/LineError.vue @@ -23,34 +23,14 @@ const fileExt = computed(() => getFileExt(props.filename)) // Compute the error marker height const errorHeight = computed(() => calculateErrorHeight(props.lineData.messages)) -// Get the sorted labels -const sortedLabels = computed(() => { +const sortedMarkers = computed(() => { return props.lineData.messages - .flatMap(m => m.labels || []) - .sort((a, b) => a.span.column - b.span.column) + .flatMap(message => (message.labels ?? []).map(label => ({ label, message }))) + .sort((a, b) => a.label.span.column - b.label.span.column) }) -// Get the message associated with a label -function getMessageForLabel(column: number) { - for (const message of props.lineData.messages) { - if (message.labels) { - for (const label of message.labels) { - if (label.span.column === column) { - return message - } - } - } - } - return null -} - // Compute the label's vertical position style -function getLabelVerticalStyle(labelIndex: number, baseLeft = 0) { - const label = sortedLabels.value[labelIndex] - if (!label) { - return { left: '0ch' } - } - +function getLabelVerticalStyle(label: Label, baseLeft = 0) { return { left: `calc(${Math.floor((label.span.length - 1) / 2) + baseLeft}ch)`, } @@ -87,10 +67,10 @@ function severityClass(severity: string | undefined) {
│
-
+
╰─
-
- {{ getMessageForLabel(label.span.column)?.code }} +
+ {{ message.code }}