lsp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MPL-2.0 Imports: 1 Imported by: 1

Documentation

Overview

Package lsp contains some sugar for setting up language server protocol servers for vidar to interact with.

Plugins should usually impelement builtin/language.LanguageHook.

For an example implementation, check out the gopls hook in the official golang plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call[U, T any](ctx context.Context, c Conn, method string, params T) (U, error)

Call may be used as a more type-safe method of using Conn.Call. The U and T types may be used to define the method request/response types.

The param type is defined later because it can be inferred from parameters, so that you only need to explicitly define the return type.

Types

type Conn

type Conn interface {
	// Call will be used to call language server methods on the connection.
	Call(ctx context.Context, method string, params, result any) error

	// Notify will be used to send a notification to the server that requires no
	// response.
	Notify(ctx context.Context, method string, params any) error

	// Reset should reconnect to the language server.
	//
	// If the language server was launched by vidar (or any input.Action within
	// vidar), Reset should shut down the server and launch it again.
	Reset(context.Context) error

	// Close should disconnect from the language server.
	//
	// If the language server was launched by vidar (or any input.Action within
	// vidar), Close should shut down the server.
	Close(context.Context) error
}

Conn represents a connection to an LSP server. In addition to standard language server semantics, it needs to be able to reset itself, in case the server is acting up.

Jump to

Keyboard shortcuts

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