haskell-lsp-0.21.0.0: Haskell library for the Microsoft Language Server Protocol

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.LSP.VFS

Contents

Description

Handles the Language.Haskell.LSP.Types.TextDocumentDidChange / Language.Haskell.LSP.Types.TextDocumentDidOpen / Language.Haskell.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.Haskell.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.Haskell.LSP.VFS

Managing the VFS

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

Applies the changes from a DidOpenTextDocumentNotification to the VFS

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

Applies a DidChangeTextDocumentNotification 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.