lsp

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package lsp implements `sonde lsp`, a Language Server Protocol server over stdio for .hurl and .sonde files: diagnostics, completion, hover and formatting. It never sends HTTP requests and reads files only inside the workspace folders.

Index

Constants

This section is empty.

Variables

View Source
var ErrExitWithoutShutdown = errors.New("lsp: exit without shutdown")

ErrExitWithoutShutdown is returned by Run when the client sent exit without shutdown first; the process should exit with status 1.

Functions

This section is empty.

Types

type CompletionItem

type CompletionItem struct {
	Label            string         `json:"label"`
	Kind             int            `json:"kind,omitempty"`
	Detail           string         `json:"detail,omitempty"`
	Documentation    *MarkupContent `json:"documentation,omitempty"`
	SortText         string         `json:"sortText,omitempty"`
	FilterText       string         `json:"filterText,omitempty"`
	InsertText       string         `json:"insertText,omitempty"`
	InsertTextFormat int            `json:"insertTextFormat,omitempty"`
	TextEdit         *TextEdit      `json:"textEdit,omitempty"`
	Tags             []int          `json:"tags,omitempty"`
}

CompletionItem is one completion proposal.

type Diagnostic

type Diagnostic struct {
	Range    Range  `json:"range"`
	Severity int    `json:"severity"`
	Code     string `json:"code,omitempty"`
	Source   string `json:"source"`
	Message  string `json:"message"`
	Tags     []int  `json:"tags,omitempty"`
}

Diagnostic is one problem in a document.

type Hover

type Hover struct {
	Contents MarkupContent `json:"contents"`
	Range    *Range        `json:"range,omitempty"`
}

Hover is the result of textDocument/hover.

type MarkupContent

type MarkupContent struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

MarkupContent is hover or documentation text.

type Options

type Options struct {
	// Version is reported in serverInfo.
	Version string
	// Environ is the process environment: SONDE_ENV selects the default
	// environment and HURL_VARIABLE_*/SONDE_VARIABLE_* define variables.
	Environ config.Env
}

Options configures a Server.

type Position

type Position struct {
	Line      uint32 `json:"line"`
	Character uint32 `json:"character"`
}

Position is a zero-based line and a character offset counted in the negotiated position encoding.

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

Range is a half-open [Start, End) span.

type Server

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

Server is a language server bound to one client connection. Messages are handled one at a time in arrival order.

func NewServer

func NewServer(opt Options) (*Server, error)

NewServer returns a server; call Run to serve a connection.

func (*Server) Run

func (s *Server) Run(ctx context.Context, in io.Reader, out io.Writer) error

Run serves the client on in/out until the client sends exit, the input ends or ctx is cancelled. It returns nil after a clean shutdown and exit.

type TextEdit

type TextEdit struct {
	Range   Range  `json:"range"`
	NewText string `json:"newText"`
}

TextEdit replaces Range with NewText.

Jump to

Keyboard shortcuts

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