Safe Haskell | None |
---|---|
Language | Haskell2010 |
Handles the Language.LSP.Types.TextDocumentDidChange /
Language.LSP.Types.TextDocumentDidOpen /
Language.LSP.Types.TextDocumentDidClose messages to keep an in-memory
filesystem
of the current client workspace. The server can access and edit
files in the client workspace by operating on the VFS in LspFuncs.
Synopsis
- data VFS = VFS {}
- data VirtualFile = VirtualFile {
- _lsp_version :: !Int
- _file_version :: !Int
- _text :: Rope
- virtualFileText :: VirtualFile -> Text
- virtualFileVersion :: VirtualFile -> Int
- initVFS :: (VFS -> IO r) -> IO r
- openVFS :: VFS -> Message 'TextDocumentDidOpen -> (VFS, [String])
- changeFromClientVFS :: VFS -> Message 'TextDocumentDidChange -> (VFS, [String])
- changeFromServerVFS :: VFS -> Message 'WorkspaceApplyEdit -> IO VFS
- persistFileVFS :: VFS -> NormalizedUri -> Maybe (FilePath, IO ())
- closeVFS :: VFS -> Message 'TextDocumentDidClose -> (VFS, [String])
- updateVFS :: (VFSMap -> VFSMap) -> VFS -> VFS
- rangeLinesFromVfs :: VirtualFile -> Range -> Text
- data PosPrefixInfo = PosPrefixInfo {
- fullLine :: Text
- prefixModule :: Text
- prefixText :: Text
- cursorPos :: Position
- getCompletionPrefix :: Monad m => Position -> VirtualFile -> m (Maybe PosPrefixInfo)
- applyChanges :: Rope -> [TextDocumentContentChangeEvent] -> Rope
- applyChange :: Rope -> TextDocumentContentChangeEvent -> Rope
- changeChars :: Rope -> Int -> Int -> Text -> Rope
Documentation
VFS | |
|
data VirtualFile Source #
VirtualFile | |
|
Instances
Show VirtualFile Source # | |
Defined in Language.LSP.VFS showsPrec :: Int -> VirtualFile -> ShowS # show :: VirtualFile -> String # showList :: [VirtualFile] -> ShowS # |
virtualFileText :: VirtualFile -> Text Source #
virtualFileVersion :: VirtualFile -> Int Source #
Managing the VFS
openVFS :: VFS -> Message 'TextDocumentDidOpen -> (VFS, [String]) Source #
Applies a DidChangeTextDocumentNotification
to the VFS
Applies the changes from a DidOpenTextDocument
to the VFS
changeFromClientVFS :: VFS -> Message 'TextDocumentDidChange -> (VFS, [String]) Source #
changeFromServerVFS :: VFS -> Message 'WorkspaceApplyEdit -> IO VFS Source #
persistFileVFS :: VFS -> NormalizedUri -> Maybe (FilePath, IO ()) Source #
Write a virtual file to a temporary file if it exists in the VFS.
manipulating the file contents
rangeLinesFromVfs :: VirtualFile -> Range -> Text Source #
data PosPrefixInfo Source #
Describes the line at the current cursor position
PosPrefixInfo | |
|
Instances
Eq PosPrefixInfo Source # | |
Defined in Language.LSP.VFS (==) :: PosPrefixInfo -> PosPrefixInfo -> Bool # (/=) :: PosPrefixInfo -> PosPrefixInfo -> Bool # | |
Show PosPrefixInfo Source # | |
Defined in Language.LSP.VFS showsPrec :: Int -> PosPrefixInfo -> ShowS # show :: PosPrefixInfo -> String # showList :: [PosPrefixInfo] -> ShowS # |
getCompletionPrefix :: Monad m => Position -> VirtualFile -> m (Maybe PosPrefixInfo) Source #
for tests
applyChanges :: Rope -> [TextDocumentContentChangeEvent] -> Rope Source #
Apply the list of changes. Changes should be applied in the order that they are received from the client.
applyChange :: Rope -> TextDocumentContentChangeEvent -> Rope Source #