Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 8514a5b

Browse files
authored
Merge pull request #783 from bubba/brittany-hsimport
Use Brittany with hsimport when needed
2 parents fb980e4 + c0dd689 commit 8514a5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+424
-373
lines changed

app/MainHie.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import qualified GhcMod.Types as GM
99
import Haskell.Ide.Engine.MonadFunctions
1010
import Haskell.Ide.Engine.MonadTypes
1111
import Haskell.Ide.Engine.Options
12-
import Haskell.Ide.Engine.PluginDescriptor
1312
import Haskell.Ide.Engine.Scheduler
1413
import Haskell.Ide.Engine.Transport.LspStdio
1514
import Haskell.Ide.Engine.Transport.JsonStdio

haskell-ide-engine.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ library
2323
Haskell.Ide.Engine.Channel
2424
Haskell.Ide.Engine.Scheduler
2525
Haskell.Ide.Engine.LSP.CodeActions
26-
Haskell.Ide.Engine.LSP.Config
2726
Haskell.Ide.Engine.LSP.Reactor
2827
Haskell.Ide.Engine.Options
2928
Haskell.Ide.Engine.Plugin.ApplyRefact
@@ -172,6 +171,7 @@ test-suite unit-test
172171
, hoogle > 5.0.11
173172
, hspec
174173
, quickcheck-instances
174+
, stm
175175
, text
176176
, unordered-containers
177177

src/Haskell/Ide/Engine/LSP/Config.hs renamed to hie-plugin-api/Haskell/Ide/Engine/Config.hs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{-# LANGUAGE OverloadedStrings #-}
2-
module Haskell.Ide.Engine.LSP.Config where
2+
module Haskell.Ide.Engine.Config where
33

44
import Data.Aeson
5-
import qualified Data.Map as Map
5+
import Data.Default
66
import qualified Data.Text as T
7-
import Haskell.Ide.Engine.PluginsIdeMonads
87
import Language.Haskell.LSP.Types
98

109
-- ---------------------------------------------------------------------
@@ -25,16 +24,28 @@ data Config =
2524
, maxNumberOfProblems :: Int
2625
, liquidOn :: Bool
2726
, completionSnippetsOn :: Bool
27+
, formatOnImportOn :: Bool
2828
} deriving (Show,Eq)
2929

30+
instance Default Config where
31+
def = Config
32+
{ hlintOn = True
33+
, maxNumberOfProblems = 100
34+
, liquidOn = False
35+
, completionSnippetsOn = True
36+
, formatOnImportOn = True
37+
}
38+
39+
-- TODO: Add API for plugins to expose their own LSP config options
3040
instance FromJSON Config where
3141
parseJSON = withObject "Config" $ \v -> do
3242
s <- v .: "languageServerHaskell"
3343
flip (withObject "Config.settings") s $ \o -> Config
34-
<$> o .:? "hlintOn" .!= True
35-
<*> o .:? "maxNumberOfProblems" .!= 100
36-
<*> o .:? "liquidOn" .!= False
37-
<*> o .:? "completionSnippetsOn" .!= True
44+
<$> o .:? "hlintOn" .!= hlintOn def
45+
<*> o .:? "maxNumberOfProblems" .!= maxNumberOfProblems def
46+
<*> o .:? "liquidOn" .!= liquidOn def
47+
<*> o .:? "completionSnippetsOn" .!= completionSnippetsOn def
48+
<*> o .:? "formatOnImportOn" .!= formatOnImportOn def
3849

3950
-- 2017-10-09 23:22:00.710515298 [ThreadId 11] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"languageServerHaskell":{"maxNumberOfProblems":100,"hlintOn":true}}}}
4051
-- 2017-10-09 23:22:00.710667381 [ThreadId 15] - reactor:got didChangeConfiguration notification:
@@ -46,19 +57,11 @@ instance FromJSON Config where
4657
-- ,("maxNumberOfProblems",Number 100.0)]))])}}
4758

4859
instance ToJSON Config where
49-
toJSON (Config h m l c) = object [ "languageServerHaskell" .= r ]
60+
toJSON (Config h m l c f) = object [ "languageServerHaskell" .= r ]
5061
where
5162
r = object [ "hlintOn" .= h
5263
, "maxNumberOfProblems" .= m
5364
, "liquidOn" .= l
5465
, "completionSnippetsOn" .= c
66+
, "formatOnImportOn" .= f
5567
]
56-
57-
-- ---------------------------------------------------------------------
58-
59-
-- | For the diagnostic providers in the config, return a map of
60-
-- current enabled state, indexed by the plugin id.
61-
getDiagnosticProvidersConfig :: Config -> Map.Map PluginId Bool
62-
getDiagnosticProvidersConfig c = Map.fromList [("applyrefact",hlintOn c)
63-
,("liquid", liquidOn c)
64-
]

hie-plugin-api/Haskell/Ide/Engine/IdeFunctions.hs

Lines changed: 0 additions & 13 deletions
This file was deleted.

hie-plugin-api/Haskell/Ide/Engine/Monad.hs

Lines changed: 0 additions & 19 deletions
This file was deleted.

hie-plugin-api/Haskell/Ide/Engine/PluginDescriptor.hs

Lines changed: 0 additions & 62 deletions
This file was deleted.

hie-plugin-api/Haskell/Ide/Engine/PluginUtils.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fileInfo tfileName =
232232

233233
clientSupportsDocumentChanges :: IdeM Bool
234234
clientSupportsDocumentChanges = do
235-
ClientCapabilities mwCaps _ _ <- ask
235+
ClientCapabilities mwCaps _ _ <- getClientCapabilities
236236
let supports = do
237237
wCaps <- mwCaps
238238
WorkspaceEditClientCapabilities mDc <- _workspaceEdit wCaps

0 commit comments

Comments
 (0)