proxy

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package proxy implements the protocol between acme-lsp and L commands.

Index

Constants

View Source
const Debug = false
View Source
const Version = 1

Version is used to detect if acme-lsp and L are speaking the same protocol.

Variables

This section is empty.

Functions

func WithClient

func WithClient(ctx context.Context, client Client) context.Context

Types

type CancelParams

type CancelParams struct {
	/**
	 * The request id to cancel.
	 */
	ID jsonrpc2.ID `json:"id"`
}

type Client

type Client interface{}

func NewServer

func NewServer(ctx context.Context, stream jsonrpc2.Stream, server Server) (context.Context, *jsonrpc2.Conn, Client)

type DocumentUri

type DocumentUri = string

type ExecuteCommandOnDocumentParams

type ExecuteCommandOnDocumentParams struct {
	TextDocument         protocol.TextDocumentIdentifier
	ExecuteCommandParams protocol.ExecuteCommandParams
}

type Message

type Message struct {
	Data string
	Attr map[string]string
}

type Server

type Server interface {
	// Version returns the protocol version.
	Version(context.Context) (int, error)

	// WorkspaceFolders returns the workspace folders currently being managed by acme-lsp.
	// In LSP, this method is implemented by the client, but in our case acme-lsp is managing
	// the workspace folders, so this has to be implemented by the acme-lsp proxy server.
	WorkspaceFolders(context.Context) ([]protocol.WorkspaceFolder, error)

	// InitializeResult returns the initialize response from the LSP server.
	// This is useful for L command to get initialization results (e.g. server capabilities)
	// of an already initialized LSP server.
	InitializeResult(context.Context, *protocol.TextDocumentIdentifier) (*protocol.InitializeResult, error)

	// ExecuteCommandOnDocument is the same as ExecuteCommand, but
	// params contain the TextDocumentIdentifier of the original
	// CodeAction so that the server implemention can multiplex
	// ExecuteCommand request to the right server.
	ExecuteCommandOnDocument(context.Context, *ExecuteCommandOnDocumentParams) (interface{}, error)

	DidChange(context.Context, *protocol.DidChangeTextDocumentParams) error
	DidChangeWorkspaceFolders(context.Context, *protocol.DidChangeWorkspaceFoldersParams) error
	Completion(context.Context, *protocol.CompletionParams) (*protocol.CompletionList, error)
	Definition(context.Context, *protocol.DefinitionParams) ([]protocol.Location, error)
	Formatting(context.Context, *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error)
	CodeAction(context.Context, *protocol.CodeActionParams) ([]protocol.CodeAction, error)
	Hover(context.Context, *protocol.HoverParams) (*protocol.Hover, error)
	Implementation(context.Context, *protocol.ImplementationParams) ([]protocol.Location, error)
	References(context.Context, *protocol.ReferenceParams) ([]protocol.Location, error)
	Rename(context.Context, *protocol.RenameParams) (*protocol.WorkspaceEdit, error)
	SignatureHelp(context.Context, *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error)
	DocumentSymbol(context.Context, *protocol.DocumentSymbolParams) ([]protocol.DocumentSymbol, error)
	TypeDefinition(context.Context, *protocol.TypeDefinitionParams) ([]protocol.Location, error)
}

Server implements a subset of an LSP protocol server as defined by protocol.Server and some custom acme-lsp specific methods.

func NewClient

func NewClient(ctx context.Context, stream jsonrpc2.Stream, client Client) (context.Context, *jsonrpc2.Conn, Server)

Jump to

Keyboard shortcuts

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