diff --git a/docs/configuration/config.md b/docs/configuration/config.md index 52120ac9..7596e098 100644 --- a/docs/configuration/config.md +++ b/docs/configuration/config.md @@ -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. diff --git a/packages/runtime/src/App.ce.vue b/packages/runtime/src/App.ce.vue index 8a663049..078f71cd 100644 --- a/packages/runtime/src/App.ce.vue +++ b/packages/runtime/src/App.ce.vue @@ -51,6 +51,8 @@ const toggle = () => { } const collapsed = computed(() => userCollapsed.value ?? initialCollapsed.value) + +const orderedByMessageGravity = computed(() => props?.overlayConfig?.messageOrder === 'gravity') diff --git a/packages/runtime/src/components/Checker.ce.vue b/packages/runtime/src/components/Checker.ce.vue index fd177a85..f75d2899 100644 --- a/packages/runtime/src/components/Checker.ce.vue +++ b/packages/runtime/src/components/Checker.ce.vue @@ -4,6 +4,7 @@ import Diagnostic from './Diagnostic.ce.vue' defineProps<{ diagnostics?: any[] base: string + order: boolean }>() const key = (diagnostic: any): string => { @@ -17,13 +18,15 @@ const key = (diagnostic: any): string => {