Skip to content

Commit

Permalink
Fix getOptions to honor LSP config overrides
Browse files Browse the repository at this point in the history
This is a bit ugly, but we already do it in defaultMain

I also realized I don't really understand the HLS config options anymore.
  • Loading branch information
pepeiborra committed Nov 26, 2021
1 parent 8dfb998 commit a218779
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecursiveDo #-}
Expand Down Expand Up @@ -163,6 +164,7 @@ import Debug.Trace.Flags (userTracingEnabled)
import qualified Development.IDE.Types.Exports as ExportsMap
import HieDb.Types
import Ide.Plugin.Config
import Ide.Plugin.Properties (useProperty)
import qualified Ide.PluginUtils as HLS
import Ide.Types (PluginId)

Expand Down Expand Up @@ -308,7 +310,14 @@ instance IsIdeGlobal GlobalIdeOptions
getIdeOptions :: Action IdeOptions
getIdeOptions = do
GlobalIdeOptions x <- getIdeGlobalAction
return x
env <- lspEnv <$> getShakeExtras
case env of
Nothing -> return x
Just env -> do
config <- liftIO $ LSP.runLspT env HLS.getClientConfig
return x{optCheckProject = pure $ checkProject config,
optCheckParents = pure $ checkParents config
}

getIdeOptionsIO :: ShakeExtras -> IO IdeOptions
getIdeOptionsIO ide = do
Expand Down

0 comments on commit a218779

Please sign in to comment.