Documentation
¶
Index ¶
- func NewDefaultBinder(sc *service.Container) jsonrpc2.Binder
- func NewDefaultLanguageServer(sc *service.Container) lsp.Server
- func NewSlogHandler(sc *service.Container) slog.Handler
- func SetupDefaultServices(sc *service.Container)
- func StartLanguageServer(ctx context.Context, sc *service.Container) error
- func SymbolKind(node core.AstNode) lsp.SymbolKind
- type Connection
- type DefaultBinder
- type DefaultDefinitionProvider
- type DefaultDocumentSymbolFilter
- type DefaultDocumentSymbolProvider
- type DefaultDocumentSyncher
- func (s *DefaultDocumentSyncher) DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams)
- func (s *DefaultDocumentSyncher) DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams)
- func (s *DefaultDocumentSyncher) DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams)
- func (s *DefaultDocumentSyncher) DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams)
- func (s *DefaultDocumentSyncher) WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams)
- func (s *DefaultDocumentSyncher) WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
- type DefaultFoldingRangeFilter
- type DefaultFoldingRangeProvider
- type DefaultLanguageServer
- func (s *DefaultLanguageServer) CodeAction(ctx context.Context, params *lsp.CodeActionParams) ([]lsp.CodeAction, error)
- func (s *DefaultLanguageServer) CodeLens(ctx context.Context, params *lsp.CodeLensParams) ([]lsp.CodeLens, error)
- func (s *DefaultLanguageServer) ColorPresentation(ctx context.Context, params *lsp.ColorPresentationParams) ([]lsp.ColorPresentation, error)
- func (s *DefaultLanguageServer) Completion(ctx context.Context, params *lsp.CompletionParams) (*lsp.CompletionList, error)
- func (s *DefaultLanguageServer) Declaration(ctx context.Context, params *lsp.DeclarationParams) ([]lsp.DefinitionLink, error)
- func (s *DefaultLanguageServer) Definition(ctx context.Context, params *lsp.DefinitionParams) ([]lsp.DefinitionLink, error)
- func (s *DefaultLanguageServer) Diagnostic(ctx context.Context, params *lsp.DocumentDiagnosticParams) (*lsp.DocumentDiagnosticReport, error)
- func (s *DefaultLanguageServer) DiagnosticWorkspace(ctx context.Context, params *lsp.WorkspaceDiagnosticParams) (*lsp.WorkspaceDiagnosticReport, error)
- func (s *DefaultLanguageServer) DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams) error
- func (s *DefaultLanguageServer) DidChangeConfiguration(ctx context.Context, params *lsp.DidChangeConfigurationParams) error
- func (s *DefaultLanguageServer) DidChangeNotebookDocument(ctx context.Context, params *lsp.DidChangeNotebookDocumentParams) error
- func (s *DefaultLanguageServer) DidChangeWatchedFiles(ctx context.Context, params *lsp.DidChangeWatchedFilesParams) error
- func (s *DefaultLanguageServer) DidChangeWorkspaceFolders(ctx context.Context, params *lsp.DidChangeWorkspaceFoldersParams) error
- func (s *DefaultLanguageServer) DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams) error
- func (s *DefaultLanguageServer) DidCloseNotebookDocument(ctx context.Context, params *lsp.DidCloseNotebookDocumentParams) error
- func (s *DefaultLanguageServer) DidCreateFiles(ctx context.Context, params *lsp.CreateFilesParams) error
- func (s *DefaultLanguageServer) DidDeleteFiles(ctx context.Context, params *lsp.DeleteFilesParams) error
- func (s *DefaultLanguageServer) DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams) error
- func (s *DefaultLanguageServer) DidOpenNotebookDocument(ctx context.Context, params *lsp.DidOpenNotebookDocumentParams) error
- func (s *DefaultLanguageServer) DidRenameFiles(ctx context.Context, params *lsp.RenameFilesParams) error
- func (s *DefaultLanguageServer) DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams) error
- func (s *DefaultLanguageServer) DidSaveNotebookDocument(ctx context.Context, params *lsp.DidSaveNotebookDocumentParams) error
- func (s *DefaultLanguageServer) DocumentColor(ctx context.Context, params *lsp.DocumentColorParams) ([]lsp.ColorInformation, error)
- func (s *DefaultLanguageServer) DocumentHighlight(ctx context.Context, params *lsp.DocumentHighlightParams) ([]lsp.DocumentHighlight, error)
- func (s *DefaultLanguageServer) DocumentLink(ctx context.Context, params *lsp.DocumentLinkParams) ([]lsp.DocumentLink, error)
- func (s *DefaultLanguageServer) DocumentSymbol(ctx context.Context, params *lsp.DocumentSymbolParams) ([]any, error)
- func (s *DefaultLanguageServer) ExecuteCommand(ctx context.Context, params *lsp.ExecuteCommandParams) (any, error)
- func (s *DefaultLanguageServer) Exit(ctx context.Context) error
- func (s *DefaultLanguageServer) FoldingRange(ctx context.Context, params *lsp.FoldingRangeParams) ([]lsp.FoldingRange, error)
- func (s *DefaultLanguageServer) Formatting(ctx context.Context, params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, error)
- func (s *DefaultLanguageServer) Hover(ctx context.Context, params *lsp.HoverParams) (*lsp.Hover, error)
- func (s *DefaultLanguageServer) Implementation(ctx context.Context, params *lsp.ImplementationParams) ([]lsp.DefinitionLink, error)
- func (s *DefaultLanguageServer) IncomingCalls(ctx context.Context, params *lsp.CallHierarchyIncomingCallsParams) ([]lsp.CallHierarchyIncomingCall, error)
- func (s *DefaultLanguageServer) Initialize(ctx context.Context, params *lsp.ParamInitialize) (*lsp.InitializeResult, error)
- func (s *DefaultLanguageServer) Initialized(ctx context.Context, params *lsp.InitializedParams) error
- func (s *DefaultLanguageServer) InlayHint(ctx context.Context, params *lsp.InlayHintParams) ([]lsp.InlayHint, error)
- func (s *DefaultLanguageServer) InlineCompletion(ctx context.Context, params *lsp.InlineCompletionParams) (*lsp.Or_Result_textDocument_inlineCompletion, error)
- func (s *DefaultLanguageServer) InlineValue(ctx context.Context, params *lsp.InlineValueParams) ([]lsp.InlineValue, error)
- func (s *DefaultLanguageServer) LinkedEditingRange(ctx context.Context, params *lsp.LinkedEditingRangeParams) (*lsp.LinkedEditingRanges, error)
- func (s *DefaultLanguageServer) Moniker(ctx context.Context, params *lsp.MonikerParams) ([]lsp.Moniker, error)
- func (s *DefaultLanguageServer) OnTypeFormatting(ctx context.Context, params *lsp.DocumentOnTypeFormattingParams) ([]lsp.TextEdit, error)
- func (s *DefaultLanguageServer) OutgoingCalls(ctx context.Context, params *lsp.CallHierarchyOutgoingCallsParams) ([]lsp.CallHierarchyOutgoingCall, error)
- func (s *DefaultLanguageServer) PrepareCallHierarchy(ctx context.Context, params *lsp.CallHierarchyPrepareParams) ([]lsp.CallHierarchyItem, error)
- func (s *DefaultLanguageServer) PrepareRename(ctx context.Context, params *lsp.PrepareRenameParams) (*lsp.PrepareRenameResult, error)
- func (s *DefaultLanguageServer) PrepareTypeHierarchy(ctx context.Context, params *lsp.TypeHierarchyPrepareParams) ([]lsp.TypeHierarchyItem, error)
- func (s *DefaultLanguageServer) Progress(ctx context.Context, params *lsp.ProgressParams) error
- func (s *DefaultLanguageServer) RangeFormatting(ctx context.Context, params *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, error)
- func (s *DefaultLanguageServer) RangesFormatting(ctx context.Context, params *lsp.DocumentRangesFormattingParams) ([]lsp.TextEdit, error)
- func (s *DefaultLanguageServer) References(ctx context.Context, params *lsp.ReferenceParams) ([]lsp.Location, error)
- func (s *DefaultLanguageServer) Rename(ctx context.Context, params *lsp.RenameParams) (*lsp.WorkspaceEdit, error)
- func (s *DefaultLanguageServer) Resolve(ctx context.Context, params *lsp.InlayHint) (*lsp.InlayHint, error)
- func (s *DefaultLanguageServer) ResolveCodeAction(ctx context.Context, params *lsp.CodeAction) (*lsp.CodeAction, error)
- func (s *DefaultLanguageServer) ResolveCodeLens(ctx context.Context, params *lsp.CodeLens) (*lsp.CodeLens, error)
- func (s *DefaultLanguageServer) ResolveCompletionItem(ctx context.Context, params *lsp.CompletionItem) (*lsp.CompletionItem, error)
- func (s *DefaultLanguageServer) ResolveDocumentLink(ctx context.Context, params *lsp.DocumentLink) (*lsp.DocumentLink, error)
- func (s *DefaultLanguageServer) ResolveWorkspaceSymbol(ctx context.Context, params *lsp.WorkspaceSymbol) (*lsp.WorkspaceSymbol, error)
- func (s *DefaultLanguageServer) SelectionRange(ctx context.Context, params *lsp.SelectionRangeParams) ([]lsp.SelectionRange, error)
- func (s *DefaultLanguageServer) SemanticTokensFull(ctx context.Context, params *lsp.SemanticTokensParams) (*lsp.SemanticTokens, error)
- func (s *DefaultLanguageServer) SemanticTokensFullDelta(ctx context.Context, params *lsp.SemanticTokensDeltaParams) (any, error)
- func (s *DefaultLanguageServer) SemanticTokensRange(ctx context.Context, params *lsp.SemanticTokensRangeParams) (*lsp.SemanticTokens, error)
- func (s *DefaultLanguageServer) SetTrace(ctx context.Context, params *lsp.SetTraceParams) error
- func (s *DefaultLanguageServer) Shutdown(ctx context.Context) error
- func (s *DefaultLanguageServer) SignatureHelp(ctx context.Context, params *lsp.SignatureHelpParams) (*lsp.SignatureHelp, error)
- func (s *DefaultLanguageServer) Subtypes(ctx context.Context, params *lsp.TypeHierarchySubtypesParams) ([]lsp.TypeHierarchyItem, error)
- func (s *DefaultLanguageServer) Supertypes(ctx context.Context, params *lsp.TypeHierarchySupertypesParams) ([]lsp.TypeHierarchyItem, error)
- func (s *DefaultLanguageServer) Symbol(ctx context.Context, params *lsp.WorkspaceSymbolParams) ([]lsp.SymbolInformation, error)
- func (s *DefaultLanguageServer) TextDocumentContent(ctx context.Context, params *lsp.TextDocumentContentParams) (*lsp.TextDocumentContentResult, error)
- func (s *DefaultLanguageServer) TypeDefinition(ctx context.Context, params *lsp.TypeDefinitionParams) ([]lsp.DefinitionLink, error)
- func (s *DefaultLanguageServer) WillCreateFiles(ctx context.Context, params *lsp.CreateFilesParams) (*lsp.WorkspaceEdit, error)
- func (s *DefaultLanguageServer) WillDeleteFiles(ctx context.Context, params *lsp.DeleteFilesParams) (*lsp.WorkspaceEdit, error)
- func (s *DefaultLanguageServer) WillRenameFiles(ctx context.Context, params *lsp.RenameFilesParams) (*lsp.WorkspaceEdit, error)
- func (s *DefaultLanguageServer) WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams) error
- func (s *DefaultLanguageServer) WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
- func (s *DefaultLanguageServer) WorkDoneProgressCancel(ctx context.Context, params *lsp.WorkDoneProgressCancelParams) error
- type DefaultNameFinder
- type DefaultReferencesFinder
- type DefaultReferencesProvider
- type DefaultRenameProvider
- type DefinitionProvider
- type DocumentSymbolFilter
- type DocumentSymbolProvider
- type DocumentSyncher
- type FindReferencesOptions
- type FoldingRangeFilter
- type FoldingRangeProvider
- type FoundName
- type NameFinder
- type ReferencesFinder
- type ReferencesProvider
- type RenameProvider
- type StdioDialer
- type SymbolKindNode
- type TextDocumentChangeEvent
- type TextDocumentChangeHandler
- type TextDocumentWillSaveEvent
- type TextDocumentWillSaveHandler
- type TextDocumentWillSaveWaitUntilHandler
- type WorkspaceFolders
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultBinder ¶
NewDefaultBinder creates a new default binder.
func NewDefaultLanguageServer ¶
NewDefaultLanguageServer creates a new default language server.
func NewSlogHandler ¶
NewSlogHandler creates a new slog handler that writes to the LSP connection.
func SetupDefaultServices ¶
SetupDefaultServices sets up the default services for the language server. If any service is already set, it's not overwritten.
func StartLanguageServer ¶
StartLanguageServer starts a language server using the service container. It sets up JSON-RPC communication over stdio and handles the essential LSP messages.
func SymbolKind ¶
func SymbolKind(node core.AstNode) lsp.SymbolKind
SymbolKind returns the LSP symbol kind for a node. If the node implements SymbolKindNode, uses that. Otherwise returns lsp.Field as default.
Language-specific implementations can be provided by implementing the SymbolKindNode interface.
Types ¶
type Connection ¶
type Connection struct {
Value *jsonrpc2.Connection
}
Connection is assigned by ConnectionBinder when the language server is started.
type DefaultBinder ¶
type DefaultBinder struct {
// contains filtered or unexported fields
}
DefaultBinder implements the jsonrpc2.Binder interface
func (*DefaultBinder) Bind ¶
func (b *DefaultBinder) Bind(ctx context.Context, conn *jsonrpc2.Connection) (jsonrpc2.ConnectionOptions, error)
type DefaultDefinitionProvider ¶
type DefaultDefinitionProvider struct {
// contains filtered or unexported fields
}
DefaultDefinitionProvider is the default implementation of DefinitionProvider.
func (*DefaultDefinitionProvider) HandleDefinitionRequest ¶
func (s *DefaultDefinitionProvider) HandleDefinitionRequest(ctx context.Context, params *lsp.DefinitionParams) ([]lsp.DefinitionLink, error)
type DefaultDocumentSymbolFilter ¶
type DefaultDocumentSymbolFilter struct{}
DefaultDocumentSymbolFilter provides standard symbol filtering behavior.
func (*DefaultDocumentSymbolFilter) ShouldInclude ¶
func (f *DefaultDocumentSymbolFilter) ShouldInclude(node core.AstNode) bool
type DefaultDocumentSymbolProvider ¶
type DefaultDocumentSymbolProvider struct {
// contains filtered or unexported fields
}
DefaultDocumentSymbolProvider implements the DocumentSymbolProvider interface.
func (*DefaultDocumentSymbolProvider) HandleDocumentSymbolRequest ¶
func (p *DefaultDocumentSymbolProvider) HandleDocumentSymbolRequest(ctx context.Context, params *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, error)
type DefaultDocumentSyncher ¶
type DefaultDocumentSyncher struct {
// contains filtered or unexported fields
}
DefaultDocumentSyncher is the default implementation of DocumentSyncher.
func (*DefaultDocumentSyncher) DidChange ¶
func (s *DefaultDocumentSyncher) DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams)
func (*DefaultDocumentSyncher) DidClose ¶
func (s *DefaultDocumentSyncher) DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams)
func (*DefaultDocumentSyncher) DidOpen ¶
func (s *DefaultDocumentSyncher) DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams)
func (*DefaultDocumentSyncher) DidSave ¶
func (s *DefaultDocumentSyncher) DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams)
DidSave does nothing by default.
func (*DefaultDocumentSyncher) WillSave ¶
func (s *DefaultDocumentSyncher) WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams)
WillSave does nothing by default.
func (*DefaultDocumentSyncher) WillSaveWaitUntil ¶
func (s *DefaultDocumentSyncher) WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
WillSaveWaitUntil does nothing by default.
type DefaultFoldingRangeFilter ¶
type DefaultFoldingRangeFilter struct{}
DefaultFoldingRangeFilter provides the standard folding behavior: Processes all nodes, excludes last line for nodes ending with closing brackets, and includes last line for comments.
func (*DefaultFoldingRangeFilter) IncludeLastFoldingLine ¶
func (f *DefaultFoldingRangeFilter) IncludeLastFoldingLine(node core.AstNode) bool
func (*DefaultFoldingRangeFilter) IncludeLastFoldingLineForComment ¶
func (f *DefaultFoldingRangeFilter) IncludeLastFoldingLineForComment() bool
func (*DefaultFoldingRangeFilter) ShouldProcess ¶
func (f *DefaultFoldingRangeFilter) ShouldProcess(node core.AstNode) bool
type DefaultFoldingRangeProvider ¶
type DefaultFoldingRangeProvider struct {
// contains filtered or unexported fields
}
func (*DefaultFoldingRangeProvider) HandleFoldingRangeRequest ¶
func (p *DefaultFoldingRangeProvider) HandleFoldingRangeRequest(ctx context.Context, params *lsp.FoldingRangeParams) ([]lsp.FoldingRange, error)
type DefaultLanguageServer ¶
type DefaultLanguageServer struct {
// contains filtered or unexported fields
}
DefaultLanguageServer implements the lsp.Server interface
func (*DefaultLanguageServer) CodeAction ¶
func (s *DefaultLanguageServer) CodeAction(ctx context.Context, params *lsp.CodeActionParams) ([]lsp.CodeAction, error)
func (*DefaultLanguageServer) CodeLens ¶
func (s *DefaultLanguageServer) CodeLens(ctx context.Context, params *lsp.CodeLensParams) ([]lsp.CodeLens, error)
func (*DefaultLanguageServer) ColorPresentation ¶
func (s *DefaultLanguageServer) ColorPresentation(ctx context.Context, params *lsp.ColorPresentationParams) ([]lsp.ColorPresentation, error)
func (*DefaultLanguageServer) Completion ¶
func (s *DefaultLanguageServer) Completion(ctx context.Context, params *lsp.CompletionParams) (*lsp.CompletionList, error)
func (*DefaultLanguageServer) Declaration ¶
func (s *DefaultLanguageServer) Declaration(ctx context.Context, params *lsp.DeclarationParams) ([]lsp.DefinitionLink, error)
func (*DefaultLanguageServer) Definition ¶
func (s *DefaultLanguageServer) Definition(ctx context.Context, params *lsp.DefinitionParams) ([]lsp.DefinitionLink, error)
func (*DefaultLanguageServer) Diagnostic ¶
func (s *DefaultLanguageServer) Diagnostic(ctx context.Context, params *lsp.DocumentDiagnosticParams) (*lsp.DocumentDiagnosticReport, error)
func (*DefaultLanguageServer) DiagnosticWorkspace ¶
func (s *DefaultLanguageServer) DiagnosticWorkspace(ctx context.Context, params *lsp.WorkspaceDiagnosticParams) (*lsp.WorkspaceDiagnosticReport, error)
func (*DefaultLanguageServer) DidChange ¶
func (s *DefaultLanguageServer) DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams) error
func (*DefaultLanguageServer) DidChangeConfiguration ¶
func (s *DefaultLanguageServer) DidChangeConfiguration(ctx context.Context, params *lsp.DidChangeConfigurationParams) error
func (*DefaultLanguageServer) DidChangeNotebookDocument ¶
func (s *DefaultLanguageServer) DidChangeNotebookDocument(ctx context.Context, params *lsp.DidChangeNotebookDocumentParams) error
func (*DefaultLanguageServer) DidChangeWatchedFiles ¶
func (s *DefaultLanguageServer) DidChangeWatchedFiles(ctx context.Context, params *lsp.DidChangeWatchedFilesParams) error
func (*DefaultLanguageServer) DidChangeWorkspaceFolders ¶
func (s *DefaultLanguageServer) DidChangeWorkspaceFolders(ctx context.Context, params *lsp.DidChangeWorkspaceFoldersParams) error
func (*DefaultLanguageServer) DidClose ¶
func (s *DefaultLanguageServer) DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams) error
func (*DefaultLanguageServer) DidCloseNotebookDocument ¶
func (s *DefaultLanguageServer) DidCloseNotebookDocument(ctx context.Context, params *lsp.DidCloseNotebookDocumentParams) error
func (*DefaultLanguageServer) DidCreateFiles ¶
func (s *DefaultLanguageServer) DidCreateFiles(ctx context.Context, params *lsp.CreateFilesParams) error
func (*DefaultLanguageServer) DidDeleteFiles ¶
func (s *DefaultLanguageServer) DidDeleteFiles(ctx context.Context, params *lsp.DeleteFilesParams) error
func (*DefaultLanguageServer) DidOpen ¶
func (s *DefaultLanguageServer) DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams) error
func (*DefaultLanguageServer) DidOpenNotebookDocument ¶
func (s *DefaultLanguageServer) DidOpenNotebookDocument(ctx context.Context, params *lsp.DidOpenNotebookDocumentParams) error
func (*DefaultLanguageServer) DidRenameFiles ¶
func (s *DefaultLanguageServer) DidRenameFiles(ctx context.Context, params *lsp.RenameFilesParams) error
func (*DefaultLanguageServer) DidSave ¶
func (s *DefaultLanguageServer) DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams) error
func (*DefaultLanguageServer) DidSaveNotebookDocument ¶
func (s *DefaultLanguageServer) DidSaveNotebookDocument(ctx context.Context, params *lsp.DidSaveNotebookDocumentParams) error
func (*DefaultLanguageServer) DocumentColor ¶
func (s *DefaultLanguageServer) DocumentColor(ctx context.Context, params *lsp.DocumentColorParams) ([]lsp.ColorInformation, error)
func (*DefaultLanguageServer) DocumentHighlight ¶
func (s *DefaultLanguageServer) DocumentHighlight(ctx context.Context, params *lsp.DocumentHighlightParams) ([]lsp.DocumentHighlight, error)
func (*DefaultLanguageServer) DocumentLink ¶
func (s *DefaultLanguageServer) DocumentLink(ctx context.Context, params *lsp.DocumentLinkParams) ([]lsp.DocumentLink, error)
func (*DefaultLanguageServer) DocumentSymbol ¶
func (s *DefaultLanguageServer) DocumentSymbol(ctx context.Context, params *lsp.DocumentSymbolParams) ([]any, error)
func (*DefaultLanguageServer) ExecuteCommand ¶
func (s *DefaultLanguageServer) ExecuteCommand(ctx context.Context, params *lsp.ExecuteCommandParams) (any, error)
func (*DefaultLanguageServer) Exit ¶
func (s *DefaultLanguageServer) Exit(ctx context.Context) error
func (*DefaultLanguageServer) FoldingRange ¶
func (s *DefaultLanguageServer) FoldingRange(ctx context.Context, params *lsp.FoldingRangeParams) ([]lsp.FoldingRange, error)
func (*DefaultLanguageServer) Formatting ¶
func (s *DefaultLanguageServer) Formatting(ctx context.Context, params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, error)
func (*DefaultLanguageServer) Hover ¶
func (s *DefaultLanguageServer) Hover(ctx context.Context, params *lsp.HoverParams) (*lsp.Hover, error)
func (*DefaultLanguageServer) Implementation ¶
func (s *DefaultLanguageServer) Implementation(ctx context.Context, params *lsp.ImplementationParams) ([]lsp.DefinitionLink, error)
func (*DefaultLanguageServer) IncomingCalls ¶
func (s *DefaultLanguageServer) IncomingCalls(ctx context.Context, params *lsp.CallHierarchyIncomingCallsParams) ([]lsp.CallHierarchyIncomingCall, error)
func (*DefaultLanguageServer) Initialize ¶
func (s *DefaultLanguageServer) Initialize(ctx context.Context, params *lsp.ParamInitialize) (*lsp.InitializeResult, error)
func (*DefaultLanguageServer) Initialized ¶
func (s *DefaultLanguageServer) Initialized(ctx context.Context, params *lsp.InitializedParams) error
func (*DefaultLanguageServer) InlayHint ¶
func (s *DefaultLanguageServer) InlayHint(ctx context.Context, params *lsp.InlayHintParams) ([]lsp.InlayHint, error)
func (*DefaultLanguageServer) InlineCompletion ¶
func (s *DefaultLanguageServer) InlineCompletion(ctx context.Context, params *lsp.InlineCompletionParams) (*lsp.Or_Result_textDocument_inlineCompletion, error)
func (*DefaultLanguageServer) InlineValue ¶
func (s *DefaultLanguageServer) InlineValue(ctx context.Context, params *lsp.InlineValueParams) ([]lsp.InlineValue, error)
func (*DefaultLanguageServer) LinkedEditingRange ¶
func (s *DefaultLanguageServer) LinkedEditingRange(ctx context.Context, params *lsp.LinkedEditingRangeParams) (*lsp.LinkedEditingRanges, error)
func (*DefaultLanguageServer) Moniker ¶
func (s *DefaultLanguageServer) Moniker(ctx context.Context, params *lsp.MonikerParams) ([]lsp.Moniker, error)
func (*DefaultLanguageServer) OnTypeFormatting ¶
func (s *DefaultLanguageServer) OnTypeFormatting(ctx context.Context, params *lsp.DocumentOnTypeFormattingParams) ([]lsp.TextEdit, error)
func (*DefaultLanguageServer) OutgoingCalls ¶
func (s *DefaultLanguageServer) OutgoingCalls(ctx context.Context, params *lsp.CallHierarchyOutgoingCallsParams) ([]lsp.CallHierarchyOutgoingCall, error)
func (*DefaultLanguageServer) PrepareCallHierarchy ¶
func (s *DefaultLanguageServer) PrepareCallHierarchy(ctx context.Context, params *lsp.CallHierarchyPrepareParams) ([]lsp.CallHierarchyItem, error)
func (*DefaultLanguageServer) PrepareRename ¶
func (s *DefaultLanguageServer) PrepareRename(ctx context.Context, params *lsp.PrepareRenameParams) (*lsp.PrepareRenameResult, error)
func (*DefaultLanguageServer) PrepareTypeHierarchy ¶
func (s *DefaultLanguageServer) PrepareTypeHierarchy(ctx context.Context, params *lsp.TypeHierarchyPrepareParams) ([]lsp.TypeHierarchyItem, error)
func (*DefaultLanguageServer) Progress ¶
func (s *DefaultLanguageServer) Progress(ctx context.Context, params *lsp.ProgressParams) error
func (*DefaultLanguageServer) RangeFormatting ¶
func (s *DefaultLanguageServer) RangeFormatting(ctx context.Context, params *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, error)
func (*DefaultLanguageServer) RangesFormatting ¶
func (s *DefaultLanguageServer) RangesFormatting(ctx context.Context, params *lsp.DocumentRangesFormattingParams) ([]lsp.TextEdit, error)
func (*DefaultLanguageServer) References ¶
func (s *DefaultLanguageServer) References(ctx context.Context, params *lsp.ReferenceParams) ([]lsp.Location, error)
func (*DefaultLanguageServer) Rename ¶
func (s *DefaultLanguageServer) Rename(ctx context.Context, params *lsp.RenameParams) (*lsp.WorkspaceEdit, error)
func (*DefaultLanguageServer) ResolveCodeAction ¶
func (s *DefaultLanguageServer) ResolveCodeAction(ctx context.Context, params *lsp.CodeAction) (*lsp.CodeAction, error)
func (*DefaultLanguageServer) ResolveCodeLens ¶
func (*DefaultLanguageServer) ResolveCompletionItem ¶
func (s *DefaultLanguageServer) ResolveCompletionItem(ctx context.Context, params *lsp.CompletionItem) (*lsp.CompletionItem, error)
func (*DefaultLanguageServer) ResolveDocumentLink ¶
func (s *DefaultLanguageServer) ResolveDocumentLink(ctx context.Context, params *lsp.DocumentLink) (*lsp.DocumentLink, error)
func (*DefaultLanguageServer) ResolveWorkspaceSymbol ¶
func (s *DefaultLanguageServer) ResolveWorkspaceSymbol(ctx context.Context, params *lsp.WorkspaceSymbol) (*lsp.WorkspaceSymbol, error)
func (*DefaultLanguageServer) SelectionRange ¶
func (s *DefaultLanguageServer) SelectionRange(ctx context.Context, params *lsp.SelectionRangeParams) ([]lsp.SelectionRange, error)
func (*DefaultLanguageServer) SemanticTokensFull ¶
func (s *DefaultLanguageServer) SemanticTokensFull(ctx context.Context, params *lsp.SemanticTokensParams) (*lsp.SemanticTokens, error)
func (*DefaultLanguageServer) SemanticTokensFullDelta ¶
func (s *DefaultLanguageServer) SemanticTokensFullDelta(ctx context.Context, params *lsp.SemanticTokensDeltaParams) (any, error)
func (*DefaultLanguageServer) SemanticTokensRange ¶
func (s *DefaultLanguageServer) SemanticTokensRange(ctx context.Context, params *lsp.SemanticTokensRangeParams) (*lsp.SemanticTokens, error)
func (*DefaultLanguageServer) SetTrace ¶
func (s *DefaultLanguageServer) SetTrace(ctx context.Context, params *lsp.SetTraceParams) error
func (*DefaultLanguageServer) Shutdown ¶
func (s *DefaultLanguageServer) Shutdown(ctx context.Context) error
func (*DefaultLanguageServer) SignatureHelp ¶
func (s *DefaultLanguageServer) SignatureHelp(ctx context.Context, params *lsp.SignatureHelpParams) (*lsp.SignatureHelp, error)
func (*DefaultLanguageServer) Subtypes ¶
func (s *DefaultLanguageServer) Subtypes(ctx context.Context, params *lsp.TypeHierarchySubtypesParams) ([]lsp.TypeHierarchyItem, error)
func (*DefaultLanguageServer) Supertypes ¶
func (s *DefaultLanguageServer) Supertypes(ctx context.Context, params *lsp.TypeHierarchySupertypesParams) ([]lsp.TypeHierarchyItem, error)
func (*DefaultLanguageServer) Symbol ¶
func (s *DefaultLanguageServer) Symbol(ctx context.Context, params *lsp.WorkspaceSymbolParams) ([]lsp.SymbolInformation, error)
func (*DefaultLanguageServer) TextDocumentContent ¶
func (s *DefaultLanguageServer) TextDocumentContent(ctx context.Context, params *lsp.TextDocumentContentParams) (*lsp.TextDocumentContentResult, error)
func (*DefaultLanguageServer) TypeDefinition ¶
func (s *DefaultLanguageServer) TypeDefinition(ctx context.Context, params *lsp.TypeDefinitionParams) ([]lsp.DefinitionLink, error)
func (*DefaultLanguageServer) WillCreateFiles ¶
func (s *DefaultLanguageServer) WillCreateFiles(ctx context.Context, params *lsp.CreateFilesParams) (*lsp.WorkspaceEdit, error)
func (*DefaultLanguageServer) WillDeleteFiles ¶
func (s *DefaultLanguageServer) WillDeleteFiles(ctx context.Context, params *lsp.DeleteFilesParams) (*lsp.WorkspaceEdit, error)
func (*DefaultLanguageServer) WillRenameFiles ¶
func (s *DefaultLanguageServer) WillRenameFiles(ctx context.Context, params *lsp.RenameFilesParams) (*lsp.WorkspaceEdit, error)
func (*DefaultLanguageServer) WillSave ¶
func (s *DefaultLanguageServer) WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams) error
func (*DefaultLanguageServer) WillSaveWaitUntil ¶
func (s *DefaultLanguageServer) WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
func (*DefaultLanguageServer) WorkDoneProgressCancel ¶
func (s *DefaultLanguageServer) WorkDoneProgressCancel(ctx context.Context, params *lsp.WorkDoneProgressCancelParams) error
type DefaultNameFinder ¶
type DefaultNameFinder struct {
// contains filtered or unexported fields
}
type DefaultReferencesFinder ¶
type DefaultReferencesFinder struct {
// contains filtered or unexported fields
}
func (*DefaultReferencesFinder) Find ¶
func (rf *DefaultReferencesFinder) Find(ctx context.Context, target core.AstNode, options FindReferencesOptions) iter.Seq[*core.ReferenceDescription]
type DefaultReferencesProvider ¶
type DefaultReferencesProvider struct {
// contains filtered or unexported fields
}
DefaultReferencesProvider is the default implementation of ReferencesProvider.
func (*DefaultReferencesProvider) HandleReferencesRequest ¶
func (s *DefaultReferencesProvider) HandleReferencesRequest(ctx context.Context, params *lsp.ReferenceParams) ([]lsp.Location, error)
type DefaultRenameProvider ¶
type DefaultRenameProvider struct {
// contains filtered or unexported fields
}
func (*DefaultRenameProvider) HandleRenameRequest ¶
func (rp *DefaultRenameProvider) HandleRenameRequest(ctx context.Context, params *lsp.RenameParams) (*lsp.WorkspaceEdit, error)
func (*DefaultRenameProvider) PrepareRenameRequest ¶
func (rp *DefaultRenameProvider) PrepareRenameRequest(ctx context.Context, params *lsp.PrepareRenameParams) (*lsp.PrepareRenameResult, error)
type DefinitionProvider ¶
type DefinitionProvider interface {
// TODO: Maybe add the document directly to the params to avoid looking it up in the workspace?
// Also, maybe add a separate params struct that doesn't directly depend on the lsp lib
HandleDefinitionRequest(ctx context.Context, params *lsp.DefinitionParams) ([]lsp.DefinitionLink, error)
}
DefinitionProvider is a service for handling LSP definition requests.
func NewDefaultDefinitionProvider ¶
func NewDefaultDefinitionProvider(sc *service.Container) DefinitionProvider
type DocumentSymbolFilter ¶
type DocumentSymbolFilter interface {
// ShouldInclude determines whether the specified AstNode should appear as a symbol.
// By default, nodes with names are included.
ShouldInclude(node core.AstNode) bool
}
DocumentSymbolFilter defines document-symbol-specific customization points.
type DocumentSymbolProvider ¶
type DocumentSymbolProvider interface {
HandleDocumentSymbolRequest(ctx context.Context, params *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, error)
}
DocumentSymbolProvider is a service for handling LSP document symbol requests.
func NewDefaultDocumentSymbolProvider ¶
func NewDefaultDocumentSymbolProvider(sc *service.Container) DocumentSymbolProvider
NewDefaultDocumentSymbolProvider creates a provider using services from the container.
func NewDocumentSymbolProviderWithFilter ¶
func NewDocumentSymbolProviderWithFilter(sc *service.Container, filter DocumentSymbolFilter) DocumentSymbolProvider
NewDocumentSymbolProviderWithFilter creates a provider with a custom filter.
type DocumentSyncher ¶
type DocumentSyncher interface {
DidOpen(ctx context.Context, params *lsp.DidOpenTextDocumentParams)
DidChange(ctx context.Context, params *lsp.DidChangeTextDocumentParams)
DidClose(ctx context.Context, params *lsp.DidCloseTextDocumentParams)
WillSave(ctx context.Context, params *lsp.WillSaveTextDocumentParams)
WillSaveWaitUntil(ctx context.Context, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, error)
DidSave(ctx context.Context, params *lsp.DidSaveTextDocumentParams)
}
DocumentSyncher is a service for handling LSP text document synchronization notifications.
Thread Safety: All methods are safe for concurrent use.
func NewDefaultDocumentSyncher ¶
func NewDefaultDocumentSyncher(sc *service.Container) DocumentSyncher
type FindReferencesOptions ¶
type FindReferencesOptions struct {
// Whether to include the declaration of the symbol as a dedicated [core.ReferenceDescription] in the results.
// If true, will contain the declaration as a reference with the same source and target node, and the range of the name as the first element.
IncludeDeclaration bool
}
type FoldingRangeFilter ¶
type FoldingRangeFilter interface {
// ShouldProcess determines whether the specified AstNode should be folded.
ShouldProcess(node core.AstNode) bool
// IncludeLastFoldingLine determines whether the folding range should include its last line for AST nodes.
// Return false to exclude the last line (e.g., for nodes ending in closing braces).
IncludeLastFoldingLine(node core.AstNode) bool
// IncludeLastFoldingLineForComment determines whether comment folding ranges should include the last line.
// Return false to exclude the last line (typically desired for multi-line comments).
IncludeLastFoldingLineForComment() bool
}
FoldingRangeFilter defines the customization points for folding behavior.
type FoldingRangeProvider ¶
type FoldingRangeProvider interface {
HandleFoldingRangeRequest(ctx context.Context, params *lsp.FoldingRangeParams) ([]lsp.FoldingRange, error)
}
FoldingRangeProvider is a service for handling LSP folding range requests.
func NewDefaultFoldingRangeProvider ¶
func NewDefaultFoldingRangeProvider(sc *service.Container) FoldingRangeProvider
func NewFoldingRangeProviderWithFilter ¶
func NewFoldingRangeProviderWithFilter(sc *service.Container, filter FoldingRangeFilter) FoldingRangeProvider
type FoundName ¶
type FoundName struct {
// The unit that contains the token that was used to start the search.
Source core.StringUnit
// The unit that contains the name of the symbol that was found.
Target core.StringUnit
}
type NameFinder ¶
NameFinder is responsible for finding the source and target core.StringUnit for a given token. It is used by various LSP services to find the name of a referenced/given symbol. Adopters should customize this service if they want to change how names are found in LSP services. Downstream LSP services will automatically use the new implementation.
func NewDefaultNameFinder ¶
func NewDefaultNameFinder(sc *service.Container) NameFinder
type ReferencesFinder ¶
type ReferencesFinder interface {
Find(ctx context.Context, target core.AstNode, options FindReferencesOptions) iter.Seq[*core.ReferenceDescription]
}
func NewDefaultReferencesFinder ¶
func NewDefaultReferencesFinder(sc *service.Container) ReferencesFinder
type ReferencesProvider ¶
type ReferencesProvider interface {
HandleReferencesRequest(ctx context.Context, params *lsp.ReferenceParams) ([]lsp.Location, error)
}
ReferencesProvider is a service for handling LSP reference requests.
func NewDefaultReferencesProvider ¶
func NewDefaultReferencesProvider(sc *service.Container) ReferencesProvider
type RenameProvider ¶
type RenameProvider interface {
HandleRenameRequest(ctx context.Context, params *lsp.RenameParams) (*lsp.WorkspaceEdit, error)
PrepareRenameRequest(ctx context.Context, params *lsp.PrepareRenameParams) (*lsp.PrepareRenameResult, error)
}
func NewDefaultRenameProvider ¶
func NewDefaultRenameProvider(sc *service.Container) RenameProvider
type StdioDialer ¶
type StdioDialer struct{}
StdioDialer implements jsonrpc2.Dialer for stdio communication
func (StdioDialer) Dial ¶
func (d StdioDialer) Dial(ctx context.Context) (io.ReadWriteCloser, error)
type SymbolKindNode ¶
type SymbolKindNode interface {
// SymbolKind returns the LSP symbol kind for this node.
SymbolKind() lsp.SymbolKind
}
SymbolKindNode can be implemented by AST node Impl structs to provide custom LSP symbol kinds for the document symbol outline.
type TextDocumentChangeEvent ¶
TextDocumentChangeEvent signals changes to a text document.
type TextDocumentChangeHandler ¶
type TextDocumentChangeHandler func(ctx context.Context, event *TextDocumentChangeEvent)
TextDocumentChangeHandler is called when a document changes. Handlers are invoked synchronously in the order they were registered. If a handler blocks, it will delay subsequent handlers and the notification response.
type TextDocumentWillSaveEvent ¶
type TextDocumentWillSaveEvent struct {
Document *textdoc.Overlay
Reason lsp.TextDocumentSaveReason
}
TextDocumentWillSaveEvent signals that a document will be saved.
type TextDocumentWillSaveHandler ¶
type TextDocumentWillSaveHandler func(ctx context.Context, event *TextDocumentWillSaveEvent)
TextDocumentWillSaveHandler is called when a document will be saved. Handlers are invoked synchronously in the order they were registered.
type TextDocumentWillSaveWaitUntilHandler ¶
type TextDocumentWillSaveWaitUntilHandler func(ctx context.Context, event *TextDocumentWillSaveEvent) ([]lsp.TextEdit, error)
TextDocumentWillSaveWaitUntilHandler is called when a document will be saved and can return edits. Only one handler can be registered for this event to ensure deterministic edit behavior.
type WorkspaceFolders ¶
type WorkspaceFolders struct {
Value []lsp.WorkspaceFolder
}
WorkspaceFolders is populated during the LSP initialize request.