, parser-combinators:Control.Applicative.Combinators
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
- , haskell-lsp >= 0.5
+ , haskell-lsp >= 0.6
, aeson
, aeson-pretty
, ansi-terminal
, hspec
, lens
, data-default
- , haskell-lsp >= 0.5
+ , haskell-lsp >= 0.6
, lsp-test
, aeson
, unordered-containers
-- | Returns all the code actions in a document by
-- querying the code actions at each of the current
-- diagnostics' positions.
-getAllCodeActions :: TextDocumentIdentifier -> Session [CommandOrCodeAction]
+getAllCodeActions :: TextDocumentIdentifier -> Session [CAResult]
getAllCodeActions doc = do
curDiags <- fromMaybe [] . Map.lookup (doc ^. uri) . curDiagnostics <$> get
let ctx = CodeActionContext (List curDiags) Nothing
foldM (go ctx) [] curDiags
where
- go :: CodeActionContext -> [CommandOrCodeAction] -> Diagnostic -> Session [CommandOrCodeAction]
+ go :: CodeActionContext -> [CAResult] -> Diagnostic -> Session [CAResult]
go ctx acc diag = do
ResponseMessage _ rspLid mRes mErr <- request TextDocumentCodeAction (CodeActionParams doc (diag ^. range) ctx)
fromServerMsg (NotPublishDiagnostics n) = NotPublishDiagnostics $ swapUri params n
fromServerMsg (RspDocumentSymbols r) =
- let newSymbols = fmap (fmap (swapUri location)) $ r ^. result
+ let newSymbols = case r ^. result of
+ Just (DSSymbolInformation si) -> Just (DSSymbolInformation (fmap (swapUri location) si))
+ x -> x
in RspDocumentSymbols $ result .~ newSymbols $ r
fromServerMsg (RspRename r) =