hls-plugin-api 1.2.0.1 → 1.2.0.2
raw patch · 4 files changed
+32/−40 lines, 4 filesdep −ghc-api-compatdep ~hls-graphPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: ghc-api-compat
Dependency ranges changed: hls-graph
API changes (from Hackage documentation)
- Ide.Plugin.Config: CheckOnClose :: CheckParents
- Ide.Plugin.Config: CheckOnSaveAndClose :: CheckParents
- Ide.Plugin.Config: [diagnosticsDebounceDuration] :: Config -> !Int
+ Ide.Plugin.Config: CheckOnSave :: CheckParents
+ Ide.PluginUtils: idePluginsToPluginDesc :: IdePlugins ideState -> [PluginDescriptor ideState]
+ Ide.Types: instance Ide.Types.PluginMethod 'Language.LSP.Types.Method.CustomMethod
- Ide.Plugin.Config: Config :: CheckParents -> !Bool -> !Bool -> !Bool -> !Int -> !Bool -> !Bool -> !Text -> !Int -> !Map Text PluginConfig -> Config
+ Ide.Plugin.Config: Config :: CheckParents -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Text -> !Int -> !Map Text PluginConfig -> Config
Files
- hls-plugin-api.cabal +2/−18
- src/Ide/Plugin/Config.hs +11/−16
- src/Ide/PluginUtils.hs +5/−1
- src/Ide/Types.hs +14/−5
hls-plugin-api.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-plugin-api-version: 1.2.0.1+version: 1.2.0.2 synopsis: Haskell Language Server API for plugin communication description: Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -45,7 +45,7 @@ , dlist , ghc , hashable- , hls-graph ^>=1.4+ , hls-graph >=1.4 && < 1.6 , hslogger , lens , lsp ^>=1.2.0.1@@ -55,22 +55,6 @@ , regex-tdfa >=1.3.1.0 , text , unordered-containers-- if impl(ghc < 8.10.5)- build-depends:- ghc-api-compat ==8.6- elif impl(ghc == 8.10.5)- build-depends:- ghc-api-compat ==8.10.5- elif impl(ghc == 8.10.6)- build-depends:- ghc-api-compat ==8.10.6- elif impl(ghc == 8.10.7)- build-depends:- ghc-api-compat ==8.10.7- elif impl(ghc == 9.0.1)- build-depends:- ghc-api-compat ==9.0.1 if os(windows) build-depends: Win32
src/Ide/Plugin/Config.hs view
@@ -37,8 +37,7 @@ -- Note that ordering of constructors is meaningful and must be monotonically -- increasing in the scenarios where parents are checked = NeverCheck- | CheckOnClose- | CheckOnSaveAndClose+ | CheckOnSave | AlwaysCheck deriving stock (Eq, Ord, Show, Generic) deriving anyclass (FromJSON, ToJSON)@@ -48,25 +47,23 @@ -- will be surprises relating to config options being ignored, initially though. data Config = Config- { checkParents :: CheckParents- , checkProject :: !Bool- , hlintOn :: !Bool- , diagnosticsOnChange :: !Bool- , diagnosticsDebounceDuration :: !Int- , liquidOn :: !Bool- , formatOnImportOn :: !Bool- , formattingProvider :: !T.Text- , maxCompletions :: !Int- , plugins :: !(Map.Map T.Text PluginConfig)+ { checkParents :: CheckParents+ , checkProject :: !Bool+ , hlintOn :: !Bool+ , diagnosticsOnChange :: !Bool+ , liquidOn :: !Bool+ , formatOnImportOn :: !Bool+ , formattingProvider :: !T.Text+ , maxCompletions :: !Int+ , plugins :: !(Map.Map T.Text PluginConfig) } deriving (Show,Eq) instance Default Config where def = Config- { checkParents = CheckOnSaveAndClose+ { checkParents = CheckOnSave , checkProject = True , hlintOn = True , diagnosticsOnChange = True- , diagnosticsDebounceDuration = 350000 , liquidOn = False , formatOnImportOn = True -- , formattingProvider = "brittany"@@ -90,7 +87,6 @@ <*> (o .:? "checkProject" <|> v .:? "checkProject") .!= checkProject defValue <*> o .:? "hlintOn" .!= hlintOn defValue <*> o .:? "diagnosticsOnChange" .!= diagnosticsOnChange defValue- <*> o .:? "diagnosticsDebounceDuration" .!= diagnosticsDebounceDuration defValue <*> o .:? "liquidOn" .!= liquidOn defValue <*> o .:? "formatOnImportOn" .!= formatOnImportOn defValue <*> o .:? "formattingProvider" .!= formattingProvider defValue@@ -105,7 +101,6 @@ , "checkProject" .= checkProject , "hlintOn" .= hlintOn , "diagnosticsOnChange" .= diagnosticsOnChange- , "diagnosticsDebounceDuration" .= diagnosticsDebounceDuration , "liquidOn" .= liquidOn , "formatOnImportOn" .= formatOnImportOn , "formattingProvider" .= formattingProvider
src/Ide/PluginUtils.hs view
@@ -10,6 +10,7 @@ diffText, diffText', pluginDescToIdePlugins,+ idePluginsToPluginDesc, responseError, getClientConfig, getPluginConfig,@@ -24,7 +25,8 @@ allLspCmdIds', installSigUsr1Handler, subRange,- usePropertyLsp)+ usePropertyLsp,+ ) where @@ -149,6 +151,8 @@ pluginDescToIdePlugins plugins = IdePlugins $ map (\p -> (pluginId p, p)) $ nubOrdOn pluginId plugins +idePluginsToPluginDesc :: IdePlugins ideState -> [PluginDescriptor ideState]+idePluginsToPluginDesc (IdePlugins pp) = map snd pp -- --------------------------------------------------------------------- -- | Returns the current client configuration. It is not wise to permanently
src/Ide/Types.hs view
@@ -9,8 +9,10 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PolyKinds #-}+{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-}@@ -41,12 +43,15 @@ import qualified Data.Text as T import Data.Text.Encoding (encodeUtf8) import Development.IDE.Graph-import DynFlags (DynFlags)+import GHC (DynFlags) import GHC.Generics import Ide.Plugin.Config import Ide.Plugin.Properties import Language.LSP.Server (LspM, getVirtualFile)-import Language.LSP.Types hiding (SemanticTokenAbsolute(length, line), SemanticTokenRelative(length), SemanticTokensEdit(_start))+import Language.LSP.Types hiding+ (SemanticTokenAbsolute (length, line),+ SemanticTokenRelative (length),+ SemanticTokensEdit (_start)) import Language.LSP.Types.Capabilities (ClientCapabilities (ClientCapabilities), TextDocumentClientCapabilities (_codeAction, _documentSymbol)) import Language.LSP.Types.Lens as J (HasChildren (children),@@ -285,6 +290,10 @@ instance PluginMethod CallHierarchyOutgoingCalls where pluginEnabled _ = pluginEnabledConfig plcCallHierarchyOn +instance PluginMethod CustomMethod where+ pluginEnabled _ _ _ = True+ combineResponses _ _ _ _ (x :| _) = x+ -- --------------------------------------------------------------------- -- | Methods which have a PluginMethod instance@@ -475,7 +484,9 @@ instance HasTracing Value instance HasTracing ExecuteCommandParams-instance HasTracing DidChangeWatchedFilesParams+instance HasTracing DidChangeWatchedFilesParams where+ traceWithSpan sp DidChangeWatchedFilesParams{_changes} =+ setTag sp "changes" (encodeUtf8 $ fromString $ show _changes) instance HasTracing DidChangeWorkspaceFoldersParams instance HasTracing DidChangeConfigurationParams instance HasTracing InitializeParams@@ -488,8 +499,6 @@ -- --------------------------------------------------------------------- {-# NOINLINE pROCESS_ID #-}-{-# LANGUAGE DerivingStrategies #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-} pROCESS_ID :: T.Text pROCESS_ID = unsafePerformIO getPid