Skip to content

Commit 6680505

Browse files
committed
Fix rendering of extension flags for Ormolu
1 parent d286ae8 commit 6680505

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ library
7171
, filepath
7272
, floskell == 0.10.*
7373
, ghc
74+
, ghc-boot-th
7475
, ghcide >= 0.1
7576
, gitrev
7677
, hashable

src/Ide/Plugin/Ormolu.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Development.IDE.Types.Location
1919
import qualified DynFlags as D
2020
import qualified EnumSet as S
2121
import GHC
22+
import GHC.LanguageExtensions.Type
2223
import Ide.Types
2324
import Ide.PluginUtils
2425
import Ide.Plugin.Formatter
@@ -46,7 +47,7 @@ provider _lf ideState typ contents fp _ = do
4647
let p = D.sPgm_F $ D.settings df
4748
in if null p then [] else ["-pgmF=" <> p]
4849
pm = map (("-fplugin=" <>) . moduleNameString) $ D.pluginModNames df
49-
ex = map (("-X" <>) . show) $ S.toList $ D.extensionFlags df
50+
ex = map showExtension $ S.toList $ D.extensionFlags df
5051
in
5152
return $ map DynOption $ pp <> pm <> ex
5253

@@ -75,3 +76,7 @@ provider _lf ideState typ contents fp _ = do
7576
ret (Left err) = Left
7677
(responseError (T.pack $ "ormoluCmd: " ++ show err) )
7778
ret (Right new) = Right (makeDiffTextEdit contents new)
79+
80+
showExtension :: Extension -> String
81+
showExtension Cpp = "-XCPP"
82+
showExtension other = "-X" ++ show other

0 commit comments

Comments
 (0)