@@ -44,13 +44,16 @@ import Language.LSP.Protocol.Message
44
44
import Language.LSP.Protocol.Types
45
45
import Language.LSP.Server hiding (defaultConfig )
46
46
import Ormolu
47
- import qualified Paths_fourmolu as Fourmolu
48
47
import System.Exit
49
48
import System.FilePath
50
49
import System.Process.Run (cwd , proc )
51
50
import System.Process.Text (readCreateProcessWithExitCode )
52
51
import Text.Read (readMaybe )
53
52
53
+ #if MIN_VERSION_fourmolu(0,12,0)
54
+ import qualified Paths_fourmolu as Fourmolu
55
+ #endif
56
+
54
57
descriptor :: Recorder (WithPriority LogEvent ) -> PluginId -> PluginDescriptor IdeState
55
58
descriptor recorder plId =
56
59
(defaultPluginDescriptor plId)
@@ -78,7 +81,11 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
78
81
(pure . Left . PluginInternalError . T. pack . show )
79
82
$ runExceptT $ cliHandler fileOpts
80
83
else do
81
- logWith recorder Info $ LogBuiltinVersion Fourmolu. version
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
82
89
let format fourmoluConfig = ExceptT $
83
90
bimap (PluginInternalError . T. pack . show ) (InL . makeDiffTextEdit contents)
84
91
#if MIN_VERSION_fourmolu(0,11,0)
@@ -139,6 +146,7 @@ provider recorder plId ideState typ contents fp fo = ExceptT $ withIndefinitePro
139
146
{ noCabal = v >= [0 , 7 ]
140
147
}
141
148
Nothing -> do
149
+ logWith recorder Info $ LogExternalVersion []
142
150
logWith recorder Warning $ NoVersion out
143
151
pure CLIVersionInfo
144
152
{ noCabal = True
@@ -167,7 +175,7 @@ data LogEvent
167
175
| ConfigPath FilePath
168
176
| NoConfigPath [FilePath ]
169
177
| StdErr Text
170
- | LogBuiltinVersion Version
178
+ | LogBuiltinVersion ( Maybe Version )
171
179
| LogExternalVersion [Int ]
172
180
deriving (Show )
173
181
@@ -178,8 +186,8 @@ instance Pretty LogEvent where
178
186
NoConfigPath ps -> " No " <> pretty configFileName <> " found in any of:"
179
187
<> line <> indent 2 (vsep (map (pretty . show ) ps))
180
188
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)
189
+ LogBuiltinVersion v -> " Using builtin fourmolu" <> pretty (maybe " " showVersion v)
190
+ LogExternalVersion v -> " Using external fourmolu" <> pretty (intercalate " ." $ map show v)
183
191
184
192
convertDynFlags :: DynFlags -> [String ]
185
193
convertDynFlags df =
0 commit comments