Documentation ¶
Overview ¶
package lsp simplifies the process of creating a language server. It provides a high-level framework for creating a language server. The included Server handles communication with the client and delegates the actual language server implementation to the Handler.
For users who need more flexibility, see the low-level jsonrpc and types packages. These provide the core types needed to fully customize the server implementation to your heart's content.
Index ¶
- func UTF16Len(s []byte) int
- type File
- type Handler
- type NopHandler
- func (NopHandler) Capabilities() types.ServerCapabilities
- func (NopHandler) HandleChange(types.DidChangeTextDocumentParams) error
- func (NopHandler) HandleClose(types.DidCloseTextDocumentParams) error
- func (NopHandler) HandleDefinition(types.DefinitionParams) ([]types.Location, error)
- func (NopHandler) HandleOpen(types.DidOpenTextDocumentParams) error
- func (NopHandler) HandleReferences(types.ReferenceParams) ([]types.Location, error)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a representation of a text file that can be modified by LSP text document change events. It keeps track of line breaks to allow for efficient conversion between byte offsets and LSP positions.
func (*File) ApplyChange ¶
func (f *File) ApplyChange(change types.TextDocumentContentChangeEvent) error
ApplyChange applies the given change to the file content.
func (*File) GetPosition ¶
GetPosition returns the LSP protocol position for the given byte offset.
type Handler ¶
type Handler interface { Capabilities() types.ServerCapabilities HandleOpen(params types.DidOpenTextDocumentParams) error HandleClose(params types.DidCloseTextDocumentParams) error HandleChange(params types.DidChangeTextDocumentParams) error HandleDefinition(params types.DefinitionParams) ([]types.Location, error) HandleReferences(params types.ReferenceParams) ([]types.Location, error) }
Handler is an interface for handling LSP requests.
type NopHandler ¶
type NopHandler struct{}
NopHandler can be embedded in a struct to provide no-op implementations of ununsed Handler methods.
func (NopHandler) Capabilities ¶
func (NopHandler) Capabilities() types.ServerCapabilities
Capabilities implements Handler.
func (NopHandler) HandleChange ¶
func (NopHandler) HandleChange(types.DidChangeTextDocumentParams) error
HandleChange implements Handler.
func (NopHandler) HandleClose ¶
func (NopHandler) HandleClose(types.DidCloseTextDocumentParams) error
HandleClose implements Handler.
func (NopHandler) HandleDefinition ¶
func (NopHandler) HandleDefinition(types.DefinitionParams) ([]types.Location, error)
HandleDefinition implements Handler.
func (NopHandler) HandleOpen ¶
func (NopHandler) HandleOpen(types.DidOpenTextDocumentParams) error
HandleOpen implements Handler.
func (NopHandler) HandleReferences ¶
func (NopHandler) HandleReferences(types.ReferenceParams) ([]types.Location, error)
HandleReferences implements Handler.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
Package jsonrpc provides utilities for working with the JSON-RPC protocol.
|
Package jsonrpc provides utilities for working with the JSON-RPC protocol. |
Package types contains the [Language Server Protocol specification] types.
|
Package types contains the [Language Server Protocol specification] types. |