lsp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is the SysML v2 language server. It wraps a single model.Workspace and serves the Language Server Protocol over a jsonrpc2 stream.

func NewServer

func NewServer(ws *model.Workspace) *Server

NewServer returns a Server bound to ws.

func (*Server) CodeAction

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

CodeAction answers the quick fixes for the diagnostics in a range: the fixes the pass that reported a diagnostic attached to it, as workspace edits.

func (Server) CodeLens

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

func (Server) CodeLensRefresh

func (Server) CodeLensRefresh(ctx context.Context) error

func (Server) CodeLensResolve

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

func (Server) ColorPresentation

func (Server) ColorPresentation(ctx context.Context, params *protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error)

func (*Server) Completion

func (s *Server) Completion(ctx context.Context, params *protocol.CompletionParams) (*protocol.CompletionList, error)

Completion implements textDocument/completion: members of what a member access names, else the names in scope plus library names and keywords. Prefix filtering is left to the client.

func (Server) CompletionResolve

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

func (Server) Declaration

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

func (*Server) Definition

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

Definition returns the declaration location of the reference under the cursor.

func (*Server) DidChange

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

DidChange applies content changes (full-replace or incremental) then updates the workspace document.

NOTE: real transport traffic is intercepted by (*Server).changeHandler, which decodes the raw params with a pointer-valued Range so an omitted range (full-document replace) is distinguishable from an incremental insertion at {0,0}. This typed method is retained to satisfy protocol.Server and for direct unit testing; because protocol.TextDocumentContentChangeEvent.Range is a value type, this path treats a zero Range as an incremental splice at [0,0) and never as a full replace.

func (Server) DidChangeConfiguration

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

func (*Server) DidChangeWatchedFiles

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

DidChangeWatchedFiles reindexes model files changed outside the editor. A deletion leaves an open buffer alone; it is still authoritative.

func (*Server) DidChangeWorkspaceFolders

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

DidChangeWorkspaceFolders indexes the model sources a folder added to the session holds, and drops those a removed folder contributed. The file watcher reports changes only, so a newly added folder has to be walked here.

func (*Server) DidClose

func (s *Server) DidClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams) error

DidClose marks the document closed, re-reading its on-disk content first so closing a tab does not unindex names other documents resolve through it. Its markers are withdrawn: only an open document has a set that keeps pace with the workspace.

func (Server) DidCreateFiles

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

func (Server) DidDeleteFiles

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

func (*Server) DidOpen

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

DidOpen registers a newly opened document with the workspace. The buffer the editor sends can differ from what was read from disk, so the other open documents are refreshed too.

func (Server) DidRenameFiles

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

func (*Server) DidSave

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

DidSave refreshes diagnostics for every open document, since an edit to one file changes what the others resolve.

func (Server) DocumentColor

func (Server) DocumentColor(ctx context.Context, params *protocol.DocumentColorParams) ([]protocol.ColorInformation, error)

func (Server) DocumentHighlight

func (Server) DocumentHighlight(ctx context.Context, params *protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error)
func (Server) DocumentLink(ctx context.Context, params *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error)

func (Server) DocumentLinkResolve

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

func (*Server) DocumentSymbol

func (s *Server) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) ([]interface{}, error)

DocumentSymbol returns the hierarchical symbol tree for a document.

func (Server) ExecuteCommand

func (Server) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error)

func (*Server) Exit

func (s *Server) Exit(ctx context.Context) error

Exit ends the session. It records the status the process owes its client and releases Run, which owns the stream, rather than closing it from under the read loop that dispatched this notification.

func (*Server) ExitCode

func (s *Server) ExitCode() int

ExitCode is the process status LSP 3.17 asks of a served session: 0 when exit followed a shutdown request, 1 when exit arrived without one. A session the client ended by closing the stream instead served to its end, so it is 0.

func (Server) FoldingRanges

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

func (*Server) Formatting

func (s *Server) Formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error)

Formatting re-indents the whole document. A document that does not parse is left alone: its brace structure is unreliable, and reformatting a file the author is midway through editing is worse than doing nothing.

func (*Server) Hover

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

Hover returns type/kind information for the declaration under the cursor.

func (Server) Implementation

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

func (*Server) Initialize

Initialize advertises the server capabilities this plan implements and records the session's folders, scanned later so the handshake is not delayed.

func (*Server) Initialized

func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedParams) error

Initialized indexes the session's folders, so cross-file names resolve without the editor having opened every file.

func (Server) LinkedEditingRange

func (Server) LinkedEditingRange(ctx context.Context, params *protocol.LinkedEditingRangeParams) (*protocol.LinkedEditingRanges, error)

func (Server) LogTrace

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

func (Server) Moniker

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

func (Server) OnTypeFormatting

func (Server) OnTypeFormatting(ctx context.Context, params *protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error)

func (Server) PrepareCallHierarchy

func (Server) PrepareCallHierarchy(ctx context.Context, params *protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error)

func (*Server) PrepareRename

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

PrepareRename reports the range the client should offer for editing, and rejects positions that name nothing renameable before the user types.

func (Server) RangeFormatting

func (Server) RangeFormatting(ctx context.Context, params *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error)

func (*Server) References

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

References returns every location naming the symbol under the cursor, in all workspace documents, at whichever segment of a qualified name denotes it.

func (*Server) Rename

func (s *Server) Rename(ctx context.Context, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error)

Rename renames the declaration under the cursor and every reference to it across the workspace's documents, including the qualifier positions of multi-segment names (`A::B` when renaming A).

func (Server) Request

func (Server) Request(ctx context.Context, method string, params interface{}) (interface{}, error)

func (*Server) Run

func (s *Server) Run(ctx context.Context, rwc io.ReadWriteCloser) error

Run wires the server to a stdio-style stream and blocks until the connection is done.

The connection is built here rather than with protocol.NewServer because that helper already starts a read loop; a second conn.Go would run two concurrent readers over the same stream and corrupt the framing. runHandler adds back what that helper wrapped around the handler.

func (*Server) SemanticTokensFull

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

SemanticTokensFull answers the semantic tokens of a whole document.

func (Server) SemanticTokensFullDelta

func (Server) SemanticTokensFullDelta(ctx context.Context, params *protocol.SemanticTokensDeltaParams) (interface{}, error)

func (*Server) SemanticTokensRange

func (s *Server) SemanticTokensRange(ctx context.Context, params *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error)

SemanticTokensRange answers the tokens overlapping a range, the document's tokens filtered: highlighting a name resolves the whole document either way.

func (Server) SemanticTokensRefresh

func (Server) SemanticTokensRefresh(ctx context.Context) error

func (Server) SetTrace

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

func (Server) ShowDocument

func (Server) ShowDocument(ctx context.Context, params *protocol.ShowDocumentParams) (*protocol.ShowDocumentResult, error)

func (*Server) Shutdown

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

Shutdown prepares the server for exit: the session stays readable, but only the exit notification is still answered (LSP 3.17 §Shutdown Request).

func (Server) SignatureHelp

func (Server) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error)

func (*Server) Symbols

Symbols implements workspace/symbol: a flat, query-filtered list of all symbols across every open document.

func (Server) TypeDefinition

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

func (Server) WillCreateFiles

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

func (Server) WillDeleteFiles

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

func (Server) WillRenameFiles

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

func (Server) WillSave

func (Server) WillSave(ctx context.Context, params *protocol.WillSaveTextDocumentParams) error

func (Server) WillSaveWaitUntil

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

func (Server) WorkDoneProgressCancel

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

Jump to

Keyboard shortcuts

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