when shouldSend $
sendNotification WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
- List [ FileEvent (filePathToUri file) FcCreated ]
+ List [ FileEvent (filePathToUri (rootDir </> file)) FcCreated ]
openDoc' file languageId contents
-- | Opens a text document that /exists on disk/, and sends a
getTypeDefinitions :: TextDocumentIdentifier -- ^ The document the term is in.
-> Position -- ^ The position the term is at.
-> Session [Location] -- ^ The location(s) of the definitions
-getTypeDefinitions doc pos =
+getTypeDefinitions doc pos = do
let params = TextDocumentPositionParams doc pos Nothing
- in getResponseResult <$> request TextDocumentTypeDefinition params
+ rsp <- request TextDocumentTypeDefinition params :: Session TypeDefinitionResponse
+ case getResponseResult rsp of
+ SingleLoc loc -> pure [loc]
+ MultiLoc locs -> pure locs
-- | Renames the term at the specified position.
rename :: TextDocumentIdentifier -> Position -> String -> Session ()
applyTextEdits :: TextDocumentIdentifier -> List TextEdit -> Session ()
applyTextEdits doc edits =
let wEdit = WorkspaceEdit (Just (HashMap.singleton (doc ^. uri) edits)) Nothing
+ -- Send a dummy message to updateState so it can do bookkeeping
req = RequestMessage "" (IdInt 0) WorkspaceApplyEdit (ApplyWorkspaceEditParams wEdit)
in updateState (ReqApplyWorkspaceEdit req)