Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/MainHie.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import qualified GhcMod.Types as GM
import Haskell.Ide.Engine.MonadFunctions
import Haskell.Ide.Engine.MonadTypes
import Haskell.Ide.Engine.Options
import Haskell.Ide.Engine.PluginDescriptor
import Haskell.Ide.Engine.Scheduler
import Haskell.Ide.Engine.Transport.LspStdio
import Haskell.Ide.Engine.Transport.JsonStdio
Expand Down
2 changes: 1 addition & 1 deletion haskell-ide-engine.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ library
Haskell.Ide.Engine.Channel
Haskell.Ide.Engine.Scheduler
Haskell.Ide.Engine.LSP.CodeActions
Haskell.Ide.Engine.LSP.Config
Haskell.Ide.Engine.LSP.Reactor
Haskell.Ide.Engine.Options
Haskell.Ide.Engine.Plugin.ApplyRefact
Expand Down Expand Up @@ -172,6 +171,7 @@ test-suite unit-test
, hoogle > 5.0.11
, hspec
, quickcheck-instances
, stm
, text
, unordered-containers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{-# LANGUAGE OverloadedStrings #-}
module Haskell.Ide.Engine.LSP.Config where
module Haskell.Ide.Engine.Config where

import Data.Aeson
import qualified Data.Map as Map
import Data.Default
import qualified Data.Text as T
import Haskell.Ide.Engine.PluginsIdeMonads
import Language.Haskell.LSP.Types

-- ---------------------------------------------------------------------
Expand All @@ -25,16 +24,28 @@ data Config =
, maxNumberOfProblems :: Int
, liquidOn :: Bool
, completionSnippetsOn :: Bool
, formatOnImportOn :: Bool
} deriving (Show,Eq)

instance Default Config where
def = Config
{ hlintOn = True
, maxNumberOfProblems = 100
, liquidOn = False
, completionSnippetsOn = True
, formatOnImportOn = True
}

-- TODO: Add API for plugins to expose their own LSP config options
instance FromJSON Config where
parseJSON = withObject "Config" $ \v -> do
s <- v .: "languageServerHaskell"
flip (withObject "Config.settings") s $ \o -> Config
<$> o .:? "hlintOn" .!= True
<*> o .:? "maxNumberOfProblems" .!= 100
<*> o .:? "liquidOn" .!= False
<*> o .:? "completionSnippetsOn" .!= True
<$> o .:? "hlintOn" .!= hlintOn def
<*> o .:? "maxNumberOfProblems" .!= maxNumberOfProblems def
<*> o .:? "liquidOn" .!= liquidOn def
<*> o .:? "completionSnippetsOn" .!= completionSnippetsOn def
<*> o .:? "formatOnImportOn" .!= formatOnImportOn def

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

instance ToJSON Config where
toJSON (Config h m l c) = object [ "languageServerHaskell" .= r ]
toJSON (Config h m l c f) = object [ "languageServerHaskell" .= r ]
where
r = object [ "hlintOn" .= h
, "maxNumberOfProblems" .= m
, "liquidOn" .= l
, "completionSnippetsOn" .= c
, "formatOnImportOn" .= f
]

-- ---------------------------------------------------------------------

-- | For the diagnostic providers in the config, return a map of
-- current enabled state, indexed by the plugin id.
getDiagnosticProvidersConfig :: Config -> Map.Map PluginId Bool
getDiagnosticProvidersConfig c = Map.fromList [("applyrefact",hlintOn c)
,("liquid", liquidOn c)
]
13 changes: 0 additions & 13 deletions hie-plugin-api/Haskell/Ide/Engine/IdeFunctions.hs

This file was deleted.

19 changes: 0 additions & 19 deletions hie-plugin-api/Haskell/Ide/Engine/Monad.hs

This file was deleted.

62 changes: 0 additions & 62 deletions hie-plugin-api/Haskell/Ide/Engine/PluginDescriptor.hs

This file was deleted.

2 changes: 1 addition & 1 deletion hie-plugin-api/Haskell/Ide/Engine/PluginUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ fileInfo tfileName =

clientSupportsDocumentChanges :: IdeM Bool
clientSupportsDocumentChanges = do
ClientCapabilities mwCaps _ _ <- ask
ClientCapabilities mwCaps _ _ <- getClientCapabilities
let supports = do
wCaps <- mwCaps
WorkspaceEditClientCapabilities mDc <- _workspaceEdit wCaps
Expand Down
Loading