hls-plugin-api 0.4.1.0 → 0.5.0.0
raw patch · 2 files changed
+75/−60 lines, 2 filesdep +hashabledep ~ghcidePVP ok
version bump matches the API change (PVP)
Dependencies added: hashable
Dependency ranges changed: ghcide
API changes (from Hackage documentation)
+ Ide.Plugin: getClientConfig :: LspFuncs Config -> IO Config
+ Ide.Plugin: getClientConfigAction :: Action Config
+ Ide.Plugin: mkLspCmdId :: Text -> PluginId -> CommandId -> Text
Files
- hls-plugin-api.cabal +61/−60
- src/Ide/Plugin.hs +14/−0
hls-plugin-api.cabal view
@@ -1,60 +1,61 @@-cabal-version: 2.2-name: hls-plugin-api-version: 0.4.1.0-synopsis: Haskell Language Server API for plugin communication-description:- Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>-homepage: https://github.com/haskell/haskell-language-server/hls-plugin-api-bug-reports: https://github.com/haskell/haskell-language-server/issues-license: Apache-2.0-license-file: LICENSE-author: Many,TBD when we release-maintainer: alan.zimm@gmail.com (for now)-copyright: Alan Zimmerman-category: Web-build-type: Simple--flag pedantic- description: Enable -Werror- default: False- manual: True--source-repository head- type: git- location: https://github.com/haskell/haskell-language-0'3lk--library- exposed-modules:- Ide.Logger- Ide.Plugin- Ide.Plugin.Config- Ide.Plugin.Formatter- Ide.Plugin.GhcIde- Ide.PluginUtils- Ide.Types-- hs-source-dirs: src- build-depends:- , aeson- , base >=4.12 && <5- , containers- , data-default- , Diff- , ghc- , ghc-boot-th- , ghcide >=0.4- , haskell-lsp ^>=0.22- , hslogger- , lens- , process- , regex-tdfa >=1.3.1.0- , shake >=0.17.5- , text- , unordered-containers-- ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing-- if flag(pedantic)- ghc-options: -Werror-- default-language: Haskell2010+cabal-version: 2.2 +name: hls-plugin-api +version: 0.5.0.0 +synopsis: Haskell Language Server API for plugin communication +description: + Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme> +homepage: https://github.com/haskell/haskell-language-server/hls-plugin-api +bug-reports: https://github.com/haskell/haskell-language-server/issues +license: Apache-2.0 +license-file: LICENSE +author: Many,TBD when we release +maintainer: alan.zimm@gmail.com (for now) +copyright: Alan Zimmerman +category: Web +build-type: Simple + +flag pedantic + description: Enable -Werror + default: False + manual: True + +source-repository head + type: git + location: https://github.com/haskell/haskell-language-server + +library + exposed-modules: + Ide.Logger + Ide.Plugin + Ide.Plugin.Config + Ide.Plugin.Formatter + Ide.Plugin.GhcIde + Ide.PluginUtils + Ide.Types + + hs-source-dirs: src + build-depends: + , aeson + , base >=4.12 && <5 + , containers + , data-default + , Diff + , ghc + , ghc-boot-th + , ghcide >=0.5 + , haskell-lsp ^>=0.22 + , hashable + , hslogger + , lens + , process + , regex-tdfa >=1.3.1.0 + , shake >=0.17.5 + , text + , unordered-containers + + ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing + + if flag(pedantic) + ghc-options: -Werror + + default-language: Haskell2010
src/Ide/Plugin.hs view
@@ -12,10 +12,13 @@ asGhcIdePlugin , pluginDescToIdePlugins , mkLspCommand + , mkLspCmdId , allLspCmdIds , allLspCmdIds' , getPid , responseError + , getClientConfig + , getClientConfigAction ) where import Control.Exception(SomeException, catch) @@ -24,6 +27,7 @@ import qualified Data.Aeson as J import qualified Data.Default import Data.Either +import Data.Hashable (unhashed) import qualified Data.List as List import qualified Data.Map as Map import Data.Maybe @@ -31,6 +35,7 @@ import Development.IDE hiding (pluginRules) import Development.IDE.LSP.Server import GHC.Generics +import Ide.Logger import Ide.Plugin.Config import Ide.Plugin.Formatter import Ide.Types @@ -587,4 +592,13 @@ getClientConfig :: LSP.LspFuncs Config -> IO Config getClientConfig lf = fromMaybe Data.Default.def <$> LSP.config lf +-- | Returns the client configurarion stored in the IdeState. +-- You can use this function to access it from shake Rules +getClientConfigAction :: Action Config +getClientConfigAction = do + mbVal <- unhashed <$> useNoFile_ GetClientSettings + logm $ "getClientConfigAction:clientSettings:" ++ show mbVal + case J.fromJSON <$> mbVal of + Just (J.Success c) -> return c + _ -> return Data.Default.def -- ---------------------------------------------------------------------