filehandler

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHandler

type FileHandler struct {
	URI   string
	IsDir bool
}

FileHandler is a type that makes it easy to access files from within the language server.

func FromDirPath

func FromDirPath(path string) *FileHandler

FromDirPath will return a FileHandler with IsDir set to true from a given path.

func FromDirURI

func FromDirURI(uri lsp.DocumentURI) *FileHandler

FromDirURI will return a FileHandler with IsDir set to true from a given LSP document URI. It will also normalize the path before passing it onto the struct field.

func FromDocumentURI

func FromDocumentURI(uri lsp.DocumentURI) *FileHandler

FromDocumentURI will return a FileHandler from a given LSP document URI.

func FromPath

func FromPath(path string) *FileHandler

FromPath will return a FileHandler from a given path.

func (*FileHandler) Dir

func (fh *FileHandler) Dir() (string, error)

Dir will return the path of filehandler's directory.

func (*FileHandler) DocumentURI

func (fh *FileHandler) DocumentURI() lsp.DocumentURI

DocumentURI will convert the filehandler's URI into a valid LSP-compatible Document URI

func (*FileHandler) Filename

func (fh *FileHandler) Filename() (string, error)

Filename will return the path of the filehandler's file.

func (*FileHandler) FullPath

func (fh *FileHandler) FullPath() (string, error)

FullPath will attempt to parse and create a full path from the given file handler.

func (*FileHandler) ParsePath

func (fh *FileHandler) ParsePath() (string, error)

ParsePath will parse the file handler's URI and return it if it's valid.

func (*FileHandler) Valid

func (fh *FileHandler) Valid() bool

Valid is a slim wrapper around FileHandler#ParsePath.

type VersionedFileHandler

type VersionedFileHandler struct {
	FileHandler
	Version int
}

VersionedFileHandler is an extension of FileHandler with added support for a version parameter.

func VersionedFileHandlerFromDocument

func VersionedFileHandlerFromDocument(document lsp.VersionedTextDocumentIdentifier) *VersionedFileHandler

VersionedFileHandlerFromDocument will return a file handler from a given LSP document.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL