packages feed

hls-pragmas-plugin 1.0.2.0 → 1.0.2.1

raw patch · 3 files changed

+16/−11 lines, 3 filesdep ~ghcidedep ~hls-test-utilsnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ghcide, hls-test-utils

API changes (from Hackage documentation)

Files

hls-pragmas-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               hls-pragmas-plugin-version:            1.0.2.0+version:            1.0.2.1 synopsis:           Pragmas plugin for Haskell Language Server description:   Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>@@ -25,8 +25,8 @@     , extra     , fuzzy     , ghc-    , ghcide                ^>=1.6-    , hls-plugin-api        ^>=1.3+    , ghcide                ^>=1.6 || ^>=1.7+    , hls-plugin-api        ^>=1.3 || ^>=1.4     , lens     , lsp     , text@@ -46,7 +46,7 @@     , base     , filepath     , hls-pragmas-plugin-    , hls-test-utils      ^>=1.2+    , hls-test-utils      ^>=1.3     , lens     , lsp-types     , text
src/Ide/Plugin/Pragmas.hs view
@@ -42,7 +42,7 @@                                                         Range (Range), Uri,                                                         getFileContents,                                                         getParsedModule,-                                                        prettyPrint, runAction,+                                                        printOutputable, runAction,                                                         srcSpanToRange,                                                         toNormalizedUri,                                                         uriToFilePath',@@ -151,7 +151,7 @@     disabled       | Just dynFlags <- mDynflags =         -- GHC does not export 'OnOff', so we have to view it as string-        catMaybes $ T.stripPrefix "Off " . T.pack . prettyPrint <$> extensions dynFlags+        catMaybes $ T.stripPrefix "Off " . printOutputable <$> extensions dynFlags       | otherwise =         -- When the module failed to parse, we don't have access to its         -- dynFlags. In that case, simply don't disable any pragmas.
test/Main.hs view
@@ -3,7 +3,8 @@   ( main   ) where -import           Control.Lens            ((^.))+import           Control.Lens            ((^.), (^..), traversed)+import           Data.Foldable           (find) import qualified Data.Text               as T import qualified Ide.Plugin.Pragmas      as Pragmas import qualified Language.LSP.Types.Lens as L@@ -74,7 +75,10 @@     _ <- waitForDiagnosticsFrom doc     cas <- map fromAction <$> getAllCodeActions doc     mapM_ (\(action, contains) -> go action contains cas) actions-    executeCodeAction $ head cas+    action <- case cas of+      (a:_) -> pure a+      [] -> liftIO $ assertFailure "Expected non-empty list of code actions"+    executeCodeAction action     where       go action contains cas = liftIO $ action `elem` map (^. L.title) cas @? contains @@ -85,8 +89,9 @@     goldenWithPragmas "no duplication" "NamedFieldPuns" $ \doc -> do       _ <- waitForDiagnosticsFrom doc       cas <- map fromAction <$> getCodeActions doc (Range (Position 8 9) (Position 8 9))-      liftIO $ length cas == 1 @? "Expected one code action, but got: " <> show cas-      let ca = head cas+      ca <- liftIO $ case cas of+        [ca] -> pure ca+        _ -> assertFailure $ "Expected one code action, but got: " <> show cas       liftIO $ (ca ^. L.title == "Add \"NamedFieldPuns\"") @? "NamedFieldPuns code action"       executeCodeAction ca   , goldenWithPragmas "doesn't suggest disabling type errors" "DeferredTypeErrors" $ \doc -> do@@ -119,7 +124,7 @@     let te = TextEdit (Range (Position a b) (Position c d)) te'     _ <- applyEdit doc te     compls <- getCompletions doc (Position x y)-    let item = head $ filter ((== label) . (^. L.label)) compls+    item <- getCompletionByLabel label compls     liftIO $ do       item ^. L.label @?= label       item ^. L.kind @?= Just CiKeyword