diff --git a/client/src/webview/views/diagnostics/errors.ts b/client/src/webview/views/diagnostics/errors.ts index 037d542..ff4758b 100644 --- a/client/src/webview/views/diagnostics/errors.ts +++ b/client/src/webview/views/diagnostics/errors.ts @@ -30,13 +30,11 @@ export function renderErrors(errors: LJError[], expandedErrors: Set): st const errorContentRenderers: Partial string>> = { 'refinement-error': (e: RefinementError) => /*html*/` - ${e.customMessage ? renderSection('Message', e.customMessage) : ''} ${renderCustomSection('Expected', renderDerivationNode(e, e.expected, 'expected'))} ${renderCustomSection('Found', renderDerivationNode(e, e.found, 'found'))} ${e.counterexample ? renderSection('Counterexample', e.counterexample) : ''} `, 'state-refinement-error': (e: StateRefinementError) => /*html*/` - ${e.customMessage ? renderSection('Message', e.customMessage) : ''} ${renderSection('Expected', e.expected)} ${renderSection('Found', e.found)} `, @@ -58,8 +56,9 @@ const errorContentRenderers: Partial }; export function renderError(error: LJError, errorIndex: number, isExpanded: boolean): string { - const header = renderDiagnosticHeader(error); - const content = errorContentRenderers[error.type]?.(error) ?? ''; + const message = error.type === 'refinement-error' || error.type === 'state-refinement-error' ? error.customMessage : error.message; + const header = renderDiagnosticHeader(error.title, message || ''); + const content = errorContentRenderers[error.type]?.(error) || ''; const location = renderLocation(error); const extra = renderExtra(error, errorIndex, isExpanded); return /*html*/`${header}${content}${location}${extra}`; @@ -77,4 +76,4 @@ function renderExtra(error: LJError, errorIndex: number, isExpanded: boolean): s extra += renderTranslationTable((error as any).translationTable as TranslationTable); } return extra ? isExpanded ? /*html*/`${button}
${extra}
` : button : ""; -} \ No newline at end of file +} diff --git a/client/src/webview/views/diagnostics/warnings.ts b/client/src/webview/views/diagnostics/warnings.ts index dde140e..d32178c 100644 --- a/client/src/webview/views/diagnostics/warnings.ts +++ b/client/src/webview/views/diagnostics/warnings.ts @@ -24,7 +24,7 @@ const warningContentRenderers: Partial `; -export const renderDiagnosticHeader = (diagnostic: LJDiagnostic): string => /*html*/ - `

${diagnostic.title}

${diagnostic.message}

`; +export const renderDiagnosticHeader = (title: string, message: string): string => /*html*/ + `

${title}

${message}

`; export const renderLocation = (diagnostic: LJDiagnostic): string => { if (!diagnostic.position || !diagnostic.file) return "";