ls

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package ls provides test utilities used when testing the Terramate Language Server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultInitializeResult

func DefaultInitializeResult() lsp.InitializeResult

DefaultInitializeResult is the default server response for the initialization request.

Types

type Editor

type Editor struct {

	// Requests that arrived at the editor.
	Requests chan jsonrpc2.Request
	// contains filtered or unexported fields
}

Editor is the editor server.

func NewEditor

func NewEditor(t *testing.T, s sandbox.S, conn jsonrpc2.Conn) *Editor

NewEditor creates a new editor server.

func (*Editor) Change

func (e *Editor) Change(path, content string)

Change sends a didChange request to the language server.

func (*Editor) CheckInitialize

func (e *Editor) CheckInitialize(workspace string)

CheckInitialize sends an initialize request to the language server and checks if the response is the expected default response (See DefaultInitializeResult).

func (*Editor) Command added in v0.4.4

func (e *Editor) Command(cmd lsp.ExecuteCommandParams) (interface{}, error)

Command invokes the provided command in the LSP server.

func (*Editor) Handler

func (e *Editor) Handler(ctx context.Context, reply jsonrpc2.Replier, r jsonrpc2.Request) error

Handler is the default editor request handler.

func (*Editor) Initialize

func (e *Editor) Initialize(workspace string) lsp.InitializeResult

Initialize sends a initialize request to the language server and return its result.

func (*Editor) Open

func (e *Editor) Open(path string)

Open sends a didOpen request to the language server.

type Fixture

type Fixture struct {
	Sandbox sandbox.S
	Editor  *Editor
}

Fixture is the default test fixture.

func Setup

func Setup(t *testing.T, layout ...string) Fixture

Setup a new fixture.

Jump to

Keyboard shortcuts

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