handlers

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelRequest

func CancelRequest(ctx context.Context, req *jrpc2.Request) error

CancelRequest will be called on "$/cancelRequest"

func Initialized

func Initialized(_ context.Context, _ *jrpc2.Request) error

Initialized is the callback that runs on the "initialized" method

func NewSession

func NewSession(ctx context.Context) session.ServiceSession

NewSession instantiates a new session

func TextDocumentCompletion

func TextDocumentCompletion(ctx context.Context, _ *jrpc2.Request) ([]lsp.CompletionItem, error)

TextDocumentCompletion is the callback that runs on the "textDocument/completion" method

Types

type MethodHandler

type MethodHandler struct {
	// contains filtered or unexported fields
}

MethodHandler is a struct that contains a logger, as well as methods to individual method handlers

func NewMethodHandler

func NewMethodHandler(logger *log.Logger) *MethodHandler

NewMethodHandler will instantiate a handler that contains callbacks to the server's methods

func (*MethodHandler) Initialize

func (mh *MethodHandler) Initialize(ctx context.Context, _ *jrpc2.Request) (lsp.InitializeResult, error)

Initialize is the callback that runs on the "initialize" method

func (*MethodHandler) TSCResetConfig

func (mh *MethodHandler) TSCResetConfig(ctx context.Context, _ *jrpc2.Request) error

TSCResetConfig is the callback that runs on the "tsc/setConfig" method.

func (*MethodHandler) TSCSetConfig

func (mh *MethodHandler) TSCSetConfig(ctx context.Context, req *jrpc2.Request) error

TSCSetConfig is the callback that runs on the "tsc/setConfig" method.

func (*MethodHandler) TextDocumentDidChange

func (mh *MethodHandler) TextDocumentDidChange(ctx context.Context, req *jrpc2.Request) error

TextDocumentDidChange is the callback that runs on the "textDocument/didChange" method

func (*MethodHandler) TextDocumentDidClose

func (mh *MethodHandler) TextDocumentDidClose(ctx context.Context, req *jrpc2.Request) error

TextDocumentDidClose is the callback that runs on the "textDocument/didClose" method

func (*MethodHandler) TextDocumentDidOpen

func (mh *MethodHandler) TextDocumentDidOpen(ctx context.Context, req *jrpc2.Request) error

TextDocumentDidOpen is the callback that runs on the "textDocument/didOpen" method

func (*MethodHandler) TextDocumentFoldingRange added in v0.1.3

func (mh *MethodHandler) TextDocumentFoldingRange(ctx context.Context, req *jrpc2.Request) ([]lsp.FoldingRange, error)

TextDocumentFoldingRange is the callback that runs on the "textDocument/foldingRange" method.

func (*MethodHandler) TextDocumentHover

func (mh *MethodHandler) TextDocumentHover(ctx context.Context, params lsp.TextDocumentPositionParams) (lsp.Hover, error)

TextDocumentHover is the callback that runs on the "textDocument/hover" method.

func (*MethodHandler) TextDocumentSymbol added in v0.1.4

func (mh *MethodHandler) TextDocumentSymbol(ctx context.Context, req *jrpc2.Request) ([]lsp.DocumentSymbol, error)

TextDocumentSymbol is the callback that runs on the "textDocument/documentSymbol" method.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a handler service for sessions

func (*Service) Assigner

func (service *Service) Assigner() (jrpc2.Assigner, error)

Assigner will create the session and set up the service method/handler map

func (*Service) Finish

func (service *Service) Finish(_ jrpc2.Assigner, status jrpc2.ServerStatus)

Finish will terminate the service

func (*Service) SetLogger

func (service *Service) SetLogger(logger *log.Logger)

SetLogger overwrites the current logger of the service

Jump to

Keyboard shortcuts

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