packages feed

hls-haddock-comments-plugin 0.1.1.0 → 1.0.0.0

raw patch · 2 files changed

+16/−12 lines, 2 filesdep +lsp-typesdep −haskell-lsp-typesdep ~ghcidedep ~hls-plugin-api

Dependencies added: lsp-types

Dependencies removed: haskell-lsp-types

Dependency ranges changed: ghcide, hls-plugin-api

Files

hls-haddock-comments-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name:          hls-haddock-comments-plugin-version:       0.1.1.0+version:       1.0.0.0 synopsis:      Haddock comments plugin for Haskell Language Server description:   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server>@@ -17,16 +17,17 @@ library   exposed-modules:  Ide.Plugin.HaddockComments   hs-source-dirs:   src-  ghc-options:      -Wall -Wno-name-shadowing -Wredundant-constraints+  ghc-options:      -Wall -Wno-name-shadowing -Wredundant-constraints -Wno-unticked-promoted-constructors   build-depends:     , base                  >=4.12 && <5     , containers     , ghc     , ghc-exactprint-    , ghcide-    , haskell-lsp-types-    , hls-plugin-api+    , ghcide                ^>= 1.0.0.0+    , lsp-types+    , hls-plugin-api        ^>= 1.0.0.0     , text     , unordered-containers    default-language: Haskell2010+  default-extensions: DataKinds, TypeOperators
src/Ide/Plugin/HaddockComments.hs view
@@ -11,32 +11,33 @@ import qualified Data.HashMap.Strict as HashMap import qualified Data.Map as Map import qualified Data.Text as T-import Development.IDE+import Development.IDE hiding (pluginHandlers) import Development.IDE.GHC.Compat import Development.IDE.GHC.ExactPrint (GetAnnotatedParsedSource (..), annsA, astA) import Ide.Types import Language.Haskell.GHC.ExactPrint import Language.Haskell.GHC.ExactPrint.Types hiding (GhcPs) import Language.Haskell.GHC.ExactPrint.Utils-import Language.Haskell.LSP.Types+import Language.LSP.Types+import Control.Monad.IO.Class  ----------------------------------------------------------------------------- descriptor :: PluginId -> PluginDescriptor IdeState descriptor plId =   (defaultPluginDescriptor plId)-    { pluginCodeActionProvider = Just codeActionProvider+    { pluginHandlers = mkPluginHandler STextDocumentCodeAction codeActionProvider     } -codeActionProvider :: CodeActionProvider IdeState-codeActionProvider _lspFuncs ideState _pId (TextDocumentIdentifier uri) range CodeActionContext {_diagnostics = List diags} =+codeActionProvider :: PluginMethodHandler IdeState TextDocumentCodeAction+codeActionProvider ideState _pId (CodeActionParams _ _ (TextDocumentIdentifier uri) range CodeActionContext {_diagnostics = List diags}) =   do     let noErr = and $ (/= Just DsError) . _severity <$> diags         nfp = uriToNormalizedFilePath $ toNormalizedUri uri-    (join -> pm) <- runAction "HaddockComments.GetAnnotatedParsedSource" ideState $ use GetAnnotatedParsedSource `traverse` nfp+    (join -> pm) <- liftIO $ runAction "HaddockComments.GetAnnotatedParsedSource" ideState $ use GetAnnotatedParsedSource `traverse` nfp     let locDecls = hsmodDecls . unLoc . astA <$> pm         anns = annsA <$> pm         edits = [runGenComments gen locDecls anns range | noErr, gen <- genList]-    return $ Right $ List [CACodeAction $ toAction title uri edit | (Just (title, edit)) <- edits]+    return $ Right $ List [InR $ toAction title uri edit | (Just (title, edit)) <- edits]  genList :: [GenComments] genList =@@ -121,6 +122,8 @@     _changes = Just $ HashMap.singleton uri $ List [edit]     _documentChanges = Nothing     _edit = Just WorkspaceEdit {..}+    _isPreferred = Nothing+    _disabled = Nothing  toRange :: SrcSpan -> Maybe Range toRange src