Skip to content

Commit 3b2f9f6

Browse files
authored
Stan: Avoid terminal colors in messages (#3090)
1 parent 0e74593 commit 3b2f9f6

File tree

1 file changed

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

1 file changed

+5
-5
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ 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)
46+
import Stan.Category (Category (..))
4747
import Stan.Core.Id (Id (..))
4848
import Stan.Inspection (Inspection (..))
4949
import Stan.Inspection.All (inspectionsIds, inspectionsMap)
5050
import Stan.Observation (Observation (..))
51-
import Stan.Severity (prettyShowSeverity)
5251

5352
descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
5453
descriptor recorder plId = (defaultPluginDescriptor plId) {pluginRules = rules recorder}
@@ -94,15 +93,16 @@ rules recorder = do
9493
let
9594
-- Looking similar to Stan CLI output
9695
-- We do not use `prettyShowInspection` cuz Id is redundant here
96+
-- `prettyShowSeverity` and `prettyShowCategory` would contain color
97+
-- codes and are replaced, too
9798
message :: T.Text
9899
message =
99100
T.unlines $
100101
[ " ✲ Name: " <> inspectionName inspection,
101102
" ✲ Description: " <> inspectionDescription inspection,
102-
" ✲ Severity: " <> (prettyShowSeverity $
103-
inspectionSeverity inspection),
103+
" ✲ Severity: " <> (T.pack $ show $ inspectionSeverity inspection),
104104
" ✲ Category: " <> T.intercalate " "
105-
(map prettyShowCategory $ toList $ inspectionCategory inspection),
105+
(map (("#" <>) . unCategory) $ toList $ inspectionCategory inspection),
106106
"Possible solutions:"
107107
]
108108
++ map (" - " <>) (inspectionSolution inspection)

0 commit comments

Comments
 (0)