Skip to content

Commit b2a4f6d

Browse files
committed
Disable stan plugin by default
1 parent 74466a9 commit b2a4f6d

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import Ide.Types (PluginDescriptor (..),
3434
PluginId, configHasDiagnostics,
3535
defaultConfigDescriptor,
3636
defaultPluginDescriptor,
37-
pluginEnabledConfig)
37+
pluginEnabledConfig,
38+
configInitialGenericConfig)
3839
import qualified Language.LSP.Protocol.Types as LSP
3940
import Stan.Analysis (Analysis (..), runAnalysis)
4041
import Stan.Category (Category (..))
@@ -46,11 +47,17 @@ import Stan.Observation (Observation (..))
4647
descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
4748
descriptor recorder plId = (defaultPluginDescriptor plId desc)
4849
{ pluginRules = rules recorder plId
49-
, pluginConfigDescriptor = defaultConfigDescriptor
50+
, pluginConfigDescriptor = defConfigDescriptor
5051
{ configHasDiagnostics = True
52+
-- We disable this plugin by default because users have been complaining about
53+
-- the diagnostics, see https://github.com/haskell/haskell-language-server/issues/3916
54+
, configInitialGenericConfig = (configInitialGenericConfig defConfigDescriptor)
55+
{ plcGlobalOn = False
56+
}
5157
}
5258
}
5359
where
60+
defConfigDescriptor = defaultConfigDescriptor
5461
desc = "Provides stan diagnostics. Built with stan-" <> VERSION_stan
5562

5663
newtype Log = LogShake Shake.Log deriving (Show)

plugins/hls-stan-plugin/test/Main.hs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import qualified Ide.Plugin.Stan as Stan
1313
import qualified Language.LSP.Protocol.Lens as L
1414
import System.FilePath
1515
import Test.Hls
16+
import Ide.Types
1617

1718
main :: IO ()
1819
main = defaultTestRunner tests
@@ -39,7 +40,20 @@ testDir :: FilePath
3940
testDir = "test/testdata"
4041

4142
stanPlugin :: PluginTestDescriptor Stan.Log
42-
stanPlugin = mkPluginTestDescriptor Stan.descriptor "stan"
43+
stanPlugin = mkPluginTestDescriptor enabledStanDescriptor "stan"
44+
where
45+
-- We have to explicitly enable the plugin as it is disabled by default as
46+
-- per request: https://github.com/haskell/haskell-language-server/issues/3916
47+
--
48+
enabledStanDescriptor recorder plId =
49+
let stanPluginDescriptor = Stan.descriptor recorder plId
50+
in stanPluginDescriptor
51+
{ pluginConfigDescriptor = (pluginConfigDescriptor stanPluginDescriptor)
52+
{ configInitialGenericConfig = (configInitialGenericConfig (pluginConfigDescriptor stanPluginDescriptor))
53+
{ plcGlobalOn = True
54+
}
55+
}
56+
}
4357

4458
runStanSession :: FilePath -> Session a -> IO a
4559
runStanSession subdir =

0 commit comments

Comments
 (0)