lsp

package
v0.11.48 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: GPL-3.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ErrCodeInternal               = -32603
	ErrCodeJSONUnmarshalReqParams = -32602
)
View Source
const (
	SkipHidden string = "<.hidden>"
)

Variables

View Source
var (
	// ErrUnsupportedURIScheme is returned by uriToPath when the URI has a scheme
	// that the LSP server does not handle (e.g. "git", "untitled"). Callers
	// that receive this error from a notification handler should silently ignore
	// the request rather than terminating the server.
	ErrUnsupportedURIScheme = errors.New("unsupported URI scheme")
	ErrMessageJsonParse     = errors.New("json parse failure")
)
View Source
var (
	ErrFailedToStartTCP   = errors.New(name + ": Failed to start TCP server")
	ErrFailedToStartStdio = errors.New(name + ": Failed to start stdio server")
)
View Source
var (
	RPCMessageFormatter = func(length int, payload []byte) string {
		return fmt.Sprintf("Content-Length: %d\r\n\r\n%s", length, payload)
	}
)

Functions

func HoverMarkdown

func HoverMarkdown(hover analyze.Hover) string

HoverMarkdown formats the hover information into a markdown string suitable for display in the LSP client - i.e. an IDE

NOTE: more formatting options may be added in the future.

func Init

func Init(ctx context.Context, log zerolog.Logger, config Config) error

func PathToURI

func PathToURI(path string) string

func ReadMessage

func ReadMessage(reader *bufio.Reader) ([]byte, error)

func UriToPath

func UriToPath(value string) (string, error)

Types

type Config

type Config struct {
	UseTCP   bool
	Host     string
	Port     int
	SkipDirs []string
	Stdio    io.Reader
	Stdout   io.Writer
	// OnListen is invoked with the bound address once the TCP listener is
	// ready. Primarily used by tests binding to an ephemeral port (Port: 0).
	OnListen func(addr net.Addr)
}

type Server

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

Server defines the language server that implements the Language Server Protocol (LSP) for eirctl.

func NewServer

func NewServer(in io.Reader, out io.Writer, opts ...ServerOpt) (*Server, error)

func (*Server) Close

func (s *Server) Close() error

func (*Server) RootPath

func (s *Server) RootPath() string

func (*Server) Serve

func (s *Server) Serve() error

type ServerOpt

type ServerOpt func(*Server)

func WithConfig

func WithConfig(config Config) ServerOpt

func WithJsonUnMarshalReq

func WithJsonUnMarshalReq(jsonUnMarshalReq func(data []byte, v any) error) ServerOpt

func WithJsonUnMarshalReqParams

func WithJsonUnMarshalReqParams(jsonUnMarshalReqParams func(data []byte, v any) error) ServerOpt

func WithLogger

func WithLogger(logger zerolog.Logger) ServerOpt

Jump to

Keyboard shortcuts

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