lsp

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package lsp implements a Language Server Protocol server for ELPS. It provides diagnostics, hover, go-to-definition, references, completion, document symbols, and rename support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	URI     string
	Version int32
	Content string
	// contains filtered or unexported fields
}

Document represents an open text document tracked by the LSP server.

func (*Document) Snapshot added in v1.40.0

func (d *Document) Snapshot() DocumentSnapshot

Snapshot returns an immutable copy of the document's current state. Slice fields are copied so the snapshot is safe to use after the document's lock is released.

type DocumentSnapshot added in v1.40.0

type DocumentSnapshot struct {
	URI         string
	Version     int32
	Content     string
	AST         []*lisp.LVal
	ParseErrors []error
}

DocumentSnapshot is an immutable copy of a document's state at a point in time. Slice fields are shallow-copied so the snapshot remains safe even if the document's slices are replaced by a concurrent parse().

type DocumentStore

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

DocumentStore manages open documents with thread-safe access.

func NewDocumentStore

func NewDocumentStore() *DocumentStore

NewDocumentStore creates an empty document store.

func (*DocumentStore) All added in v1.27.0

func (s *DocumentStore) All() []*Document

All returns a snapshot of all open documents.

func (*DocumentStore) Change

func (s *DocumentStore) Change(uri string, version int32, content string) *Document

Change updates a document's content (full sync) and re-parses it.

func (*DocumentStore) Close

func (s *DocumentStore) Close(uri string)

Close removes a document from the store.

func (*DocumentStore) Get

func (s *DocumentStore) Get(uri string) *Document

Get retrieves a document by URI. Returns nil if not found.

func (*DocumentStore) Open

func (s *DocumentStore) Open(uri string, version int32, content string) *Document

Open adds a document to the store and parses it.

type InlayHint added in v1.32.0

type InlayHint struct {
	Position     protocol.Position `json:"position"`
	Label        string            `json:"label"`
	Kind         int               `json:"kind"` // 1=Type, 2=Parameter
	PaddingLeft  bool              `json:"paddingLeft,omitempty"`
	PaddingRight bool              `json:"paddingRight,omitempty"`
}

InlayHint is a single inlay hint returned to the client.

type InlayHintParams added in v1.32.0

type InlayHintParams struct {
	TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
	Range        protocol.Range                  `json:"range"`
}

InlayHintParams is the parameter for textDocument/inlayHint.

type Option

type Option func(*Server)

Option configures the LSP server.

func WithEnv

func WithEnv(env *lisp.LEnv) Option

WithEnv injects a fully initialized ELPS environment.

func WithExcludes added in v1.40.0

func WithExcludes(patterns []string) Option

WithExcludes sets glob patterns for files to skip during workspace scanning. Patterns are matched against the full path, base name, and each directory component using filepath.Match semantics.

func WithIncludes added in v1.45.0

func WithIncludes(dirs []string) Option

WithIncludes sets directory names that override ShouldSkipDir during workspace scanning. Directories matching any entry will be walked even if they would normally be skipped (e.g. "_examples").

func WithMaxDocumentBytes added in v1.40.0

func WithMaxDocumentBytes(n int) Option

WithMaxDocumentBytes sets the maximum document size for semantic analysis. Documents exceeding this limit receive an informational diagnostic instead. A value <= 0 disables the limit (default).

func WithMaxWorkspaceFiles added in v1.40.0

func WithMaxWorkspaceFiles(n int) Option

WithMaxWorkspaceFiles sets the maximum number of .lisp files scanned during workspace indexing. A value <= 0 uses the default (5000).

func WithRegistry

func WithRegistry(reg *lisp.PackageRegistry) Option

WithRegistry injects an embedder's package registry for stdlib exports.

type Server

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

Server is the ELPS language server.

func New

func New(opts ...Option) *Server

New creates a new ELPS LSP server.

func (*Server) RunStdio

func (s *Server) RunStdio() error

RunStdio starts the server using stdio transport.

func (*Server) RunTCP

func (s *Server) RunTCP(addr string) error

RunTCP starts the server listening on the given address.

Jump to

Keyboard shortcuts

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