@@ -28,7 +28,6 @@ import Data.List (intercalate)
28
28
import Data.Maybe (catMaybes )
29
29
import Data.Text (Text )
30
30
import qualified Data.Text as T
31
- import Data.Version (Version , showVersion )
32
31
import Development.IDE hiding (pluginHandlers )
33
32
import Development.IDE.GHC.Compat as Compat hiding (Cpp , Warning ,
34
33
hang , vcat )
@@ -50,10 +49,6 @@ import System.Process.Run (cwd, proc)
50
49
import System.Process.Text (readCreateProcessWithExitCode )
51
50
import Text.Read (readMaybe )
52
51
53
- #if MIN_VERSION_fourmolu(0,12,0)
54
- import qualified Paths_fourmolu as Fourmolu
55
- #endif
56
-
57
52
descriptor :: Recorder (WithPriority LogEvent ) -> PluginId -> PluginDescriptor IdeState
58
53
descriptor recorder plId =
59
54
(defaultPluginDescriptor plId)
@@ -81,11 +76,7 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
81
76
(pure . Left . PluginInternalError . T. pack . show )
82
77
$ runExceptT $ cliHandler fileOpts
83
78
else do
84
- #if MIN_VERSION_fourmolu(0,12,0)
85
- logWith recorder Info $ LogBuiltinVersion $ Just Fourmolu. version
86
- #else
87
- logWith recorder Info $ LogBuiltinVersion Nothing
88
- #endif
79
+ logWith recorder Debug $ LogCompiledInVersion VERSION_fourmolu
89
80
let format fourmoluConfig = ExceptT $
90
81
bimap (PluginInternalError . T. pack . show ) (InL . makeDiffTextEdit contents)
91
82
#if MIN_VERSION_fourmolu(0,11,0)
@@ -141,12 +132,12 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
141
132
traverse (readMaybe @ Int . T. unpack) $ T. splitOn " ." v
142
133
case version of
143
134
Just v -> do
144
- logWith recorder Info $ LogExternalVersion v
135
+ logWith recorder Debug $ LogExternalVersion v
145
136
pure CLIVersionInfo
146
137
{ noCabal = v >= [0 , 7 ]
147
138
}
148
139
Nothing -> do
149
- logWith recorder Info $ LogExternalVersion []
140
+ logWith recorder Debug $ LogExternalVersion []
150
141
logWith recorder Warning $ NoVersion out
151
142
pure CLIVersionInfo
152
143
{ noCabal = True
@@ -175,7 +166,7 @@ data LogEvent
175
166
| ConfigPath FilePath
176
167
| NoConfigPath [FilePath ]
177
168
| StdErr Text
178
- | LogBuiltinVersion ( Maybe Version )
169
+ | LogCompiledInVersion String
179
170
| LogExternalVersion [Int ]
180
171
deriving (Show )
181
172
@@ -186,8 +177,11 @@ instance Pretty LogEvent where
186
177
NoConfigPath ps -> " No " <> pretty configFileName <> " found in any of:"
187
178
<> line <> indent 2 (vsep (map (pretty . show ) ps))
188
179
StdErr t -> " Fourmolu stderr:" <> line <> indent 2 (pretty t)
189
- LogBuiltinVersion v -> " Using builtin fourmolu" <> pretty (maybe " " showVersion v)
190
- LogExternalVersion v -> " Using external fourmolu" <> pretty (intercalate " ." $ map show v)
180
+ LogCompiledInVersion v -> " Using compiled in fourmolu-" <> pretty v
181
+ LogExternalVersion v ->
182
+ " Using external fourmolu"
183
+ <> if null v then " " else " -"
184
+ <> pretty (intercalate " ." $ map show v)
191
185
192
186
convertDynFlags :: DynFlags -> [String ]
193
187
convertDynFlags df =
0 commit comments