Skip to content

Commit

Permalink
Display errors before warnings inside devtools. Fixes #800
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed May 21, 2021
1 parent 2c19c81 commit 24425ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion IHP/IDE/StatusServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ renderErrorView standardOutput errorOutput isCompiling = [hsx|
errorContainer = [hsx|
<div id="ihp-error-container">
<h1 style="margin-bottom: 2rem; margin-top: 20%; font-size: 1rem; font-weight: 400; border-bottom: 1px solid white; padding-bottom: 0.25rem; border-color: hsla(196, 13%, 60%, 1); color: hsla(196, 13%, 80%, 1)">{inner}</h1>
<pre style="font-family: Menlo, monospace; width: 100%" id="stderr">{forEach (parseErrorOutput errorOutput) renderError}</pre>
<pre style="font-family: Menlo, monospace; width: 100%" id="stderr">{forEach errors renderError}</pre>

<div class="ihp-error-other-solutions">
<a href="https://gitter.im/digitallyinduced/ihp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge" target="_blank">Ask the IHP Community on Gitter</a>
Expand All @@ -208,6 +208,12 @@ renderErrorView standardOutput errorOutput isCompiling = [hsx|
<pre style="font-family: Menlo, monospace; font-size: 10px" id="stdout">{ByteString.unlines (reverse standardOutput)}</pre>
</div>
|]
where
-- Errors are reordered here as we want to display the most important compile errors first
-- Warnings should come after the actual errors.
errors = errorOutput
|> parseErrorOutput
|> sortBy (comparing (get #isWarning))
parseErrorOutput :: [ByteString] -> [CompilerError]
parseErrorOutput output =
splitToSections (reverse output) []
Expand Down

0 comments on commit 24425ba

Please sign in to comment.