lsp-types-1.0.0.0: Haskell library for the Microsoft Language Server Protocol, data types

Safe HaskellNone
LanguageHaskell2010

Language.LSP.VFS

Contents

Description

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

Documentation

data VFS Source #

Constructors

VFS 

Fields

Instances
Show VFS Source # 
Instance details

Defined in Language.LSP.VFS

Methods

showsPrec :: Int -> VFS -> ShowS #

show :: VFS -> String #

showList :: [VFS] -> ShowS #

data VirtualFile Source #

Constructors

VirtualFile 

Fields

Instances
Show VirtualFile Source # 
Instance details

Defined in Language.LSP.VFS

Managing the VFS

initVFS :: (VFS -> IO r) -> IO r Source #

openVFS :: VFS -> Message TextDocumentDidOpen -> (VFS, [String]) Source #

Applies a DidChangeTextDocumentNotification to the VFS

Applies the changes from a DidOpenTextDocument to the VFS

persistFileVFS :: VFS -> NormalizedUri -> Maybe (FilePath, IO ()) Source #

Write a virtual file to a temporary file if it exists in the VFS.

updateVFS :: (VFSMap -> VFSMap) -> VFS -> VFS Source #

Applies the changes from a ApplyWorkspaceEditRequest to the VFS

manipulating the file contents

data PosPrefixInfo Source #

Describes the line at the current cursor position

Constructors

PosPrefixInfo 

Fields

  • fullLine :: Text

    The full contents of the line the cursor is at

  • prefixModule :: Text

    If any, the module name that was typed right before the cursor position. For example, if the user has typed "Data.Maybe.from", then this property will be Data.Maybe

  • prefixText :: Text

    The word right before the cursor position, after removing the module part. For example if the user has typed "Data.Maybe.from", then this property will be "from"

  • cursorPos :: Position

    The cursor position

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.