Skip to content

Commit 4c42571

Browse files
committed
Stan: Avoid terminal colors in messages
Solves #3089
1 parent df77e7d commit 4c42571

File tree

1 file changed

+4
-5
lines changed
  • plugins/hls-stan-plugin/src/Ide/Plugin

1 file changed

+4
-5
lines changed

plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,10 @@ import Ide.Types (PluginDescriptor (..),
4343
defaultPluginDescriptor)
4444
import qualified Language.LSP.Types as LSP
4545
import Stan.Analysis (Analysis (..), runAnalysis)
46-
import Stan.Category (prettyShowCategory)
4746
import Stan.Core.Id (Id (..))
4847
import Stan.Inspection (Inspection (..))
4948
import Stan.Inspection.All (inspectionsIds, inspectionsMap)
5049
import Stan.Observation (Observation (..))
51-
import Stan.Severity (prettyShowSeverity)
5250

5351
descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
5452
descriptor recorder plId = (defaultPluginDescriptor plId) {pluginRules = rules recorder}
@@ -94,15 +92,16 @@ rules recorder = do
9492
let
9593
-- Looking similar to Stan CLI output
9694
-- We do not use `prettyShowInspection` cuz Id is redundant here
95+
-- `prettyShowSeverity` and `prettyShowCategory` would contain color
96+
-- codes and are replaced, too
9797
message :: T.Text
9898
message =
9999
T.unlines $
100100
[ " ✲ Name: " <> inspectionName inspection,
101101
" ✲ Description: " <> inspectionDescription inspection,
102-
" ✲ Severity: " <> (prettyShowSeverity $
103-
inspectionSeverity inspection),
102+
" ✲ Severity: " <> (show $ inspectionSeverity inspection),
104103
" ✲ Category: " <> T.intercalate " "
105-
(map prettyShowCategory $ toList $ inspectionCategory inspection),
104+
(map (("#" <>) . unCategory) $ toList $ inspectionCategory inspection),
106105
"Possible solutions:"
107106
]
108107
++ map (" - " <>) (inspectionSolution inspection)

0 commit comments

Comments
 (0)