Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/configuration/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ Shared configuration to control the checker behaviors of the plugin.
* @default no default value
*/
panelStyle?: string
/**
* The sort order of the messages in overlay:
* - Set `gravity` to sort by message gravity (errors first, warnings second, suggestions third & messages fourth).
* - Set nothing to keep default sort order.
* @default no default value
*/
messageOrder?: 'gravity'
}
/**
* stdout in terminal which starts the Vite server in dev mode.
Expand Down
4 changes: 3 additions & 1 deletion packages/runtime/src/App.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const toggle = () => {
}

const collapsed = computed<boolean>(() => userCollapsed.value ?? initialCollapsed.value)

const orderedByMessageGravity = computed<boolean>(() => props?.overlayConfig?.messageOrder === 'gravity')
</script>

<template>
Expand All @@ -68,7 +70,7 @@ const collapsed = computed<boolean>(() => userCollapsed.value ?? initialCollapse
:style="overlayConfig?.panelStyle"
>
<div class="list-scroll">
<List :checkerResults="checkerResults" :base="base" ulStyle="margin-bottom: 36px;" />
<List :checkerResults="checkerResults" :base="base" :order="orderedByMessageGravity" ulStyle="margin-bottom: 36px;" />
</div>
</main>
</template>
Expand Down
5 changes: 4 additions & 1 deletion packages/runtime/src/components/Checker.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Diagnostic from './Diagnostic.ce.vue'
defineProps<{
diagnostics?: any[]
base: string
order: boolean
}>()

const key = (diagnostic: any): string => {
Expand All @@ -17,13 +18,15 @@ const key = (diagnostic: any): string => {

<template>
<ul>
<Diagnostic v-for="d in diagnostics" :diagnostic="d" :base="base" :key="key(d)" />
<Diagnostic v-for="d in diagnostics" :diagnostic="d" :base="base" :order="order" :key="key(d)" />
</ul>
</template>

<style>
ul {
list-style: none;
display: flex;
flex-direction: column;
}

ul {
Expand Down
23 changes: 20 additions & 3 deletions packages/runtime/src/components/Diagnostic.ce.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { computed } from 'vue'
const { diagnostic, base } = defineProps<{
const { diagnostic, base, order } = defineProps<{
diagnostic: any
base: string
order: boolean
}>()

interface Link {
Expand Down Expand Up @@ -65,7 +66,7 @@ const errorSource = computed(() => {
</script>

<template>
<li class="message-item">
<li :class="`${order ? 'ordered-' : ''}message-item`">
<pre class="message">
<!-- @vue-ignore -->
<span class="plugin" :style="{ color: checkerColorMap[diagnostic.checkerId] }"
Expand All @@ -85,11 +86,27 @@ li {
list-style: none;
}

.message-item {
.message-item, .ordered-message-item {
border-bottom: 1px dotted #666;
padding: 12px 0 0 0;
}

.ordered-message-item:has(.message-body-0) {
order: 1;
}

.ordered-message-item:has(.message-body-1) {
order: 0;
}

.ordered-message-item:has(.message-body-2) {
order: 2;
}

.ordered-message-item:has(.message-body-3) {
order: 3;
}

.message {
white-space: initial;
font-weight: 600;
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime/src/components/List.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ withDefaults(
ulStyle?: string
base: string
checkerResults: any[]
order: boolean
}>(),
{
ulStyle: '',
Expand All @@ -16,7 +17,7 @@ withDefaults(
<template>
<ul :style="ulStyle">
<li v-for="(checkerResult, index) in checkerResults" :key="index">
<Checker :diagnostics="checkerResult.diagnostics" :base="base" :index="index" />
<Checker :diagnostics="checkerResult.diagnostics" :base="base" :order="order" :index="index" />
</li>
</ul>
</template>
Expand Down
Loading