@@ -24,9 +24,11 @@ import Control.Monad.Trans.Except (ExceptT (..), mapExceptT,
24
24
import Control.Monad.IO.Class (MonadIO (liftIO ))
25
25
import Control.Monad.Trans.Class (MonadTrans (lift ))
26
26
import Data.Bifunctor (bimap )
27
+ import Data.List (intercalate )
27
28
import Data.Maybe (catMaybes )
28
29
import Data.Text (Text )
29
30
import qualified Data.Text as T
31
+ import Data.Version (Version , showVersion )
30
32
import Development.IDE hiding (pluginHandlers )
31
33
import Development.IDE.GHC.Compat as Compat hiding (Cpp , Warning ,
32
34
hang , vcat )
@@ -42,6 +44,7 @@ import Language.LSP.Protocol.Message
42
44
import Language.LSP.Protocol.Types
43
45
import Language.LSP.Server hiding (defaultConfig )
44
46
import Ormolu
47
+ import qualified Paths_fourmolu as Fourmolu
45
48
import System.Exit
46
49
import System.FilePath
47
50
import System.Process.Run (cwd , proc )
@@ -75,6 +78,7 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
75
78
(pure . Left . PluginInternalError . T. pack . show )
76
79
$ runExceptT $ cliHandler fileOpts
77
80
else do
81
+ logWith recorder Info $ LogBuiltinVersion Fourmolu. version
78
82
let format fourmoluConfig = ExceptT $
79
83
bimap (PluginInternalError . T. pack . show ) (InL . makeDiffTextEdit contents)
80
84
#if MIN_VERSION_fourmolu(0,11,0)
@@ -129,9 +133,11 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
129
133
" fourmolu" : v : _ <- pure $ T. words out
130
134
traverse (readMaybe @ Int . T. unpack) $ T. splitOn " ." v
131
135
case version of
132
- Just v -> pure CLIVersionInfo
133
- { noCabal = v >= [0 , 7 ]
134
- }
136
+ Just v -> do
137
+ logWith recorder Info $ LogExternalVersion v
138
+ pure CLIVersionInfo
139
+ { noCabal = v >= [0 , 7 ]
140
+ }
135
141
Nothing -> do
136
142
logWith recorder Warning $ NoVersion out
137
143
pure CLIVersionInfo
@@ -161,6 +167,8 @@ data LogEvent
161
167
| ConfigPath FilePath
162
168
| NoConfigPath [FilePath ]
163
169
| StdErr Text
170
+ | LogBuiltinVersion Version
171
+ | LogExternalVersion [Int ]
164
172
deriving (Show )
165
173
166
174
instance Pretty LogEvent where
@@ -170,6 +178,8 @@ instance Pretty LogEvent where
170
178
NoConfigPath ps -> " No " <> pretty configFileName <> " found in any of:"
171
179
<> line <> indent 2 (vsep (map (pretty . show ) ps))
172
180
StdErr t -> " Fourmolu stderr:" <> line <> indent 2 (pretty t)
181
+ LogBuiltinVersion v -> " Using builtin fourmolu-" <> pretty (showVersion v)
182
+ LogExternalVersion v -> " Using external fourmolu-" <> pretty (intercalate " ." $ map show v)
173
183
174
184
convertDynFlags :: DynFlags -> [String ]
175
185
convertDynFlags df =
0 commit comments