server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package server implements the luascript language server: the concrete protocol.Server that drives the compiler front-end (lex -> parse -> typecheck -> analyze) to serve diagnostics, hover, completion, formatting and a document outline to any LSP-speaking editor over stdio.

The name "proxy" is historical — an earlier design proxied to an external tool. Today the server answers every request itself; there is nothing to proxy to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, logger *slog.Logger, in io.ReadCloser, out io.WriteCloser) error

Run serves the language server over the supplied stdio streams until the connection closes (client disconnect or exit notification). It blocks.

Types

type Server

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

Server is the luascript LSP server. It keeps the set of open documents and re-derives everything else (diagnostics, symbols, hover) on demand from the current text — there is no persistent AST cache, because a full recompile of a single file is cheap.

func NewServer

func NewServer(logger *slog.Logger) *Server

NewServer builds a server with an empty document store.

func (Server) CodeAction

func (Server) CodeAction(context.Context, *protocol.CodeActionParams) ([]protocol.CodeAction, error)

func (Server) CodeLens

func (Server) CodeLens(context.Context, *protocol.CodeLensParams) ([]protocol.CodeLens, error)

func (Server) CodeLensRefresh

func (Server) CodeLensRefresh(context.Context) error

func (Server) CodeLensResolve

func (Server) CodeLensResolve(context.Context, *protocol.CodeLens) (*protocol.CodeLens, error)

func (Server) ColorPresentation

func (*Server) Completion

Completion returns member completions after `namespace.` (e.g. `math.` -> floor, ceil, ...), otherwise the static keyword / global / module set. In the bare case it ignores finer context — the client filters by prefix.

func (Server) CompletionResolve

func (Server) CompletionResolve(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error)

func (Server) Declaration

func (Server) Declaration(context.Context, *protocol.DeclarationParams) ([]protocol.Location, error)

func (Server) Definition

func (Server) Definition(context.Context, *protocol.DefinitionParams) ([]protocol.Location, error)

func (*Server) DidChange

func (s *Server) DidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) error

func (Server) DidChangeConfiguration

func (Server) DidChangeConfiguration(context.Context, *protocol.DidChangeConfigurationParams) error

func (Server) DidChangeWatchedFiles

func (Server) DidChangeWatchedFiles(context.Context, *protocol.DidChangeWatchedFilesParams) error

func (Server) DidChangeWorkspaceFolders

func (Server) DidChangeWorkspaceFolders(context.Context, *protocol.DidChangeWorkspaceFoldersParams) error

func (*Server) DidClose

func (Server) DidCreateFiles

func (Server) DidCreateFiles(context.Context, *protocol.CreateFilesParams) error

func (Server) DidDeleteFiles

func (Server) DidDeleteFiles(context.Context, *protocol.DeleteFilesParams) error

func (*Server) DidOpen

func (s *Server) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error

func (Server) DidRenameFiles

func (Server) DidRenameFiles(context.Context, *protocol.RenameFilesParams) error

func (*Server) DidSave

func (s *Server) DidSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) error

func (Server) DocumentColor

func (Server) DocumentHighlight

func (Server) DocumentLinkResolve

func (Server) DocumentLinkResolve(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error)

func (*Server) DocumentSymbol

DocumentSymbol returns the top-level declarations for the outline view.

func (Server) ExecuteCommand

func (Server) ExecuteCommand(context.Context, *protocol.ExecuteCommandParams) (any, error)

func (Server) Exit

func (Server) Exit(context.Context) error

func (Server) FoldingRanges

func (Server) FoldingRanges(context.Context, *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error)

func (*Server) Formatting

Formatting reformats the whole document via the shared formatter and returns a single full-range replacement edit.

func (*Server) Hover

func (s *Server) Hover(_ context.Context, params *protocol.HoverParams) (*protocol.Hover, error)

Hover returns documentation for the builtin identifier under the cursor.

func (Server) Implementation

func (Server) Implementation(context.Context, *protocol.ImplementationParams) ([]protocol.Location, error)

func (*Server) Initialize

Initialize advertises the capabilities the server actually implements.

func (*Server) Initialized

Initialized is a no-op today; the client is already captured in Initialize.

func (Server) LogTrace

func (Server) LogTrace(context.Context, *protocol.LogTraceParams) error

func (Server) Moniker

func (Server) Moniker(context.Context, *protocol.MonikerParams) ([]protocol.Moniker, error)

func (Server) OnTypeFormatting

func (Server) PrepareCallHierarchy

func (Server) PrepareRename

func (Server) PrepareRename(context.Context, *protocol.PrepareRenameParams) (*protocol.Range, error)

func (Server) RangeFormatting

func (Server) References

func (Server) References(context.Context, *protocol.ReferenceParams) ([]protocol.Location, error)

func (Server) Rename

func (Server) Request

func (Server) Request(context.Context, string, any) (any, error)

func (Server) SemanticTokensFull

func (Server) SemanticTokensFull(context.Context, *protocol.SemanticTokensParams) (*protocol.SemanticTokens, error)

func (Server) SemanticTokensFullDelta

func (Server) SemanticTokensFullDelta(context.Context, *protocol.SemanticTokensDeltaParams) (any, error)

func (Server) SemanticTokensRange

func (Server) SemanticTokensRefresh

func (Server) SemanticTokensRefresh(context.Context) error

func (Server) SetTrace

func (Server) SetTrace(context.Context, *protocol.SetTraceParams) error

func (Server) ShowDocument

func (*Server) Shutdown

func (s *Server) Shutdown(context.Context) error

Shutdown / Exit round out the lifecycle. Exit terminates the process; the serve loop's connection is closed by the client immediately afterwards.

func (Server) SignatureHelp

func (Server) TypeDefinition

func (Server) TypeDefinition(context.Context, *protocol.TypeDefinitionParams) ([]protocol.Location, error)

func (Server) WillCreateFiles

func (Server) WillCreateFiles(context.Context, *protocol.CreateFilesParams) (*protocol.WorkspaceEdit, error)

func (Server) WillDeleteFiles

func (Server) WillDeleteFiles(context.Context, *protocol.DeleteFilesParams) (*protocol.WorkspaceEdit, error)

func (Server) WillRenameFiles

func (Server) WillRenameFiles(context.Context, *protocol.RenameFilesParams) (*protocol.WorkspaceEdit, error)

func (Server) WillSave

func (Server) WillSaveWaitUntil

func (Server) WillSaveWaitUntil(context.Context, *protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error)

func (Server) WorkDoneProgressCancel

func (Server) WorkDoneProgressCancel(context.Context, *protocol.WorkDoneProgressCancelParams) error

type SourceMapCache

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

SourceMapCache is a cache of .templ file URIs to the source map.

func NewSourceMapCache

func NewSourceMapCache() *SourceMapCache

func (*SourceMapCache) Delete

func (fc *SourceMapCache) Delete(uri string)

func (*SourceMapCache) Get

func (fc *SourceMapCache) Get(uri string) (*parser.SourceMap, bool)

func (*SourceMapCache) Set

func (fc *SourceMapCache) Set(uri string, m *parser.SourceMap)

func (*SourceMapCache) URIs

func (fc *SourceMapCache) URIs() (uris []string)

Jump to

Keyboard shortcuts

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