Documentation
¶
Overview ¶
Package lsp provides LSP query operations for the type system.
Index ¶
- Variables
- func FormatType(t any) string
- func IsLuaBuiltin(name string) bool
- func IsLuaKeyword(name string) bool
- type DefinitionResult
- type DocumentSymbol
- type HoverResult
- type ManifestRegistry
- func (r *ManifestRegistry) All() []*io.Manifest
- func (r *ManifestRegistry) Clear()
- func (r *ManifestRegistry) FindType(name string) (*io.Manifest, typ.Type)
- func (r *ManifestRegistry) Lookup(path string) *io.Manifest
- func (r *ManifestRegistry) Register(manifest *io.Manifest)
- func (r *ManifestRegistry) Remove(path string)
- func (r *ManifestRegistry) SearchSymbols(query string) []*index.WorkspaceSymbol
- type ReferenceKind
- type ReferenceResult
- type Service
- func (s *Service) Cache() *index.DB
- func (s *Service) CallGraph() *index.CallGraph
- func (s *Service) CalleesOf(file string, line, col int) []*index.CallEdge
- func (s *Service) CallersOf(file string, line, col int) []*index.CallEdge
- func (s *Service) Clear()
- func (s *Service) DefinitionAt(file string, line, col int) *DefinitionResult
- func (s *Service) DocumentSymbols(file string) []*DocumentSymbol
- func (s *Service) HoverAt(file string, line, col int) *HoverResult
- func (s *Service) InvalidateFile(file string)
- func (s *Service) Manifests() *ManifestRegistry
- func (s *Service) ReferencesAt(file string, line, col int, includeDecl bool) []ReferenceResult
- func (s *Service) RegisterManifest(manifest *io.Manifest)
- func (s *Service) Symbols() *index.SymbolIndex
- func (s *Service) WorkspaceSymbols(query string) []*index.WorkspaceSymbol
Constants ¶
This section is empty.
Variables ¶
var LuaBuiltins = map[string]bool{ "_G": true, "_ENV": true, "_VERSION": true, "print": true, "error": true, "assert": true, "type": true, "pairs": true, "ipairs": true, "next": true, "select": true, "tonumber": true, "tostring": true, "pcall": true, "xpcall": true, "require": true, "load": true, "loadfile": true, "dofile": true, "rawget": true, "rawset": true, "rawequal": true, "rawlen": true, "setmetatable": true, "getmetatable": true, "collectgarbage": true, }
LuaBuiltins contains standard Lua built-in functions.
var LuaKeywordSet = func() map[string]bool { m := make(map[string]bool, len(LuaKeywords)) for _, kw := range LuaKeywords { m[kw] = true } return m }()
LuaKeywordSet provides O(1) keyword lookup.
var LuaKeywords = []string{
"and", "break", "do", "else", "elseif", "end",
"false", "for", "function", "goto", "if", "in",
"local", "nil", "not", "or", "repeat", "return",
"then", "true", "until", "while",
}
LuaKeywords contains all Lua reserved words.
Functions ¶
func FormatType ¶
FormatType formats a type for display in hover/completion.
func IsLuaBuiltin ¶
IsLuaBuiltin returns true if name is a Lua built-in.
func IsLuaKeyword ¶
IsLuaKeyword returns true if name is a Lua reserved word.
Types ¶
type DefinitionResult ¶
DefinitionResult contains go-to-definition target.
type DocumentSymbol ¶
type DocumentSymbol struct {
Name string
Kind index.SymbolKind
Span diag.Span
Children []*DocumentSymbol
}
DocumentSymbol represents a symbol for document outline.
type HoverResult ¶
type HoverResult struct {
Type any // The type at the position (core.Type)
Signature string
Symbol *index.Symbol
Span diag.Span
}
HoverResult contains information for hover display.
type ManifestRegistry ¶
type ManifestRegistry struct {
// contains filtered or unexported fields
}
ManifestRegistry stores type manifests for cross-module resolution.
func NewManifestRegistry ¶
func NewManifestRegistry() *ManifestRegistry
NewManifestRegistry creates an empty manifest registry.
func (*ManifestRegistry) All ¶
func (r *ManifestRegistry) All() []*io.Manifest
All returns all registered manifests.
func (*ManifestRegistry) FindType ¶
FindType searches for a type by name across all manifests. Supports both "TypeName" and "module.TypeName" formats.
func (*ManifestRegistry) Lookup ¶
func (r *ManifestRegistry) Lookup(path string) *io.Manifest
Lookup retrieves a manifest by module path.
func (*ManifestRegistry) Register ¶
func (r *ManifestRegistry) Register(manifest *io.Manifest)
Register adds a manifest to the registry.
func (*ManifestRegistry) Remove ¶
func (r *ManifestRegistry) Remove(path string)
Remove removes a manifest by path.
func (*ManifestRegistry) SearchSymbols ¶
func (r *ManifestRegistry) SearchSymbols(query string) []*index.WorkspaceSymbol
SearchSymbols searches for symbols across all manifests.
type ReferenceKind ¶
type ReferenceKind int
ReferenceKind indicates the type of reference.
const ( RefRead ReferenceKind = iota RefWrite RefDefinition )
type ReferenceResult ¶
type ReferenceResult struct {
File string
Span diag.Span
Kind ReferenceKind
}
ReferenceResult contains find-references results.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides LSP query operations.
func NewService ¶
NewService creates a new LSP service with the given indexes.
func (*Service) CalleesOf ¶
CalleesOf returns all functions called by the function at the given position.
func (*Service) DefinitionAt ¶
func (s *Service) DefinitionAt(file string, line, col int) *DefinitionResult
DefinitionAt returns the definition location for symbol at position.
func (*Service) DocumentSymbols ¶
func (s *Service) DocumentSymbols(file string) []*DocumentSymbol
DocumentSymbols returns all symbols in a file for document outline.
func (*Service) HoverAt ¶
func (s *Service) HoverAt(file string, line, col int) *HoverResult
HoverAt returns type information at the given position.
func (*Service) InvalidateFile ¶
InvalidateFile invalidates cache, symbols, and call graph for a file.
func (*Service) Manifests ¶
func (s *Service) Manifests() *ManifestRegistry
Manifests returns the manifest registry.
func (*Service) ReferencesAt ¶
func (s *Service) ReferencesAt(file string, line, col int, includeDecl bool) []ReferenceResult
ReferencesAt returns all references to the symbol at position.
func (*Service) RegisterManifest ¶
RegisterManifest adds a manifest to the service.
func (*Service) Symbols ¶
func (s *Service) Symbols() *index.SymbolIndex
Symbols returns the symbol index.
func (*Service) WorkspaceSymbols ¶
func (s *Service) WorkspaceSymbols(query string) []*index.WorkspaceSymbol
WorkspaceSymbols searches for symbols matching a query across all files.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package completion provides code completion for LSP.
|
Package completion provides code completion for LSP. |
|
Package edit provides text editing utilities for the language server.
|
Package edit provides text editing utilities for the language server. |
|
Package index provides per-function indexing for type checking results.
|
Package index provides per-function indexing for type checking results. |
|
Package refactor provides code refactoring operations for the language server.
|
Package refactor provides code refactoring operations for the language server. |
|
Package semantic provides semantic token analysis for syntax highlighting.
|
Package semantic provides semantic token analysis for syntax highlighting. |
|
Package signature provides function signature help for the language server.
|
Package signature provides function signature help for the language server. |