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) OverLimit ¶ added in v1.61.2
OverLimit reports whether the document exceeded the store's size limit at the last Open or Change, and so was stored without being parsed (see Document.parse). Every request handler whose cost is linear in the document content -- the AST walkers, the raw-text fallbacks that scan or split the whole content, and the formatter, which parses it again -- checks this first and returns its documented empty result, so the limit bounds the work a single document can cost the server on any request, not only on analysis.
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.
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 WithExcludes ¶ added in v1.40.0
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
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
WithMaxDocumentBytes sets the maximum document size the server will parse, analyze or format. Documents exceeding this limit are not parsed at all -- so AST-based features (hover, definition, completion, symbols, folding, semantic tokens, selection ranges, highlights, call hierarchy) return nothing for them and formatting is a no-op -- and receive an informational diagnostic instead of analysis. The limit has to cover parsing to bound anything: the AST costs far more than the source text and is rebuilt on every edit (see Document.parse).
The limit applies to document text the client sends; the didSave path, which re-reads the saved file from disk, and workspace scanning are both bounded by analysis.ScanConfig.MaxFileBytes instead. A value <= 0 disables the limit (default).
func WithMaxWorkspaceFiles ¶ added in v1.40.0
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.
Source Files
¶
- call_hierarchy.go
- code_actions.go
- completion.go
- definition.go
- diagnostics.go
- document.go
- folding.go
- formatting.go
- handler_wrapper.go
- highlight.go
- hover.go
- inlay_hints.go
- linked_editing.go
- position.go
- position_encoding.go
- references.go
- rename.go
- selection_range.go
- semantic_tokens.go
- server.go
- signature.go
- symbols.go
- virtual.go
- watched_files.go
- workspace_symbols.go