Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Suite = snap.Suite{ Inputs: []snap.Input{{Name: "DOCUMENT"}}, Actions: []snap.Action{ {Name: "CHANGE", HasBody: true}, {Name: "COMPLETION", Args: 1}, {Name: "CODE_ACTION", Args: 2}, {Name: "HOVER", Args: 1}, {Name: "DEFINITION", Args: 1}, {Name: "DOCUMENT_SYMBOL"}, {Name: "REFERENCES", Args: -1}, {Name: "RENAME", Args: 2}, {Name: "SEMANTIC_TOKENS"}, }, Outputs: []snap.Output{{Name: "STDOUT"}}, Parallel: true, }
Suite declares the LSP snapshot format.
Each request shape gets its own action because the LSP methods take different parameters; overloading one delimiter would make the files harder to read than this table is. What a header's arguments mean stays here rather than in go-snap: the engine tokenizes and counts them, this file decides that "1:6" is a position.
Functions ¶
func Run ¶
func Run(tc *SnapshotCase) (string, error)
Run executes a single snapshot test case against a real in-process server. It handles the full LSP lifecycle: initialization, didOpen, actions, and shutdown. Returns the normalized JSON output of all server messages after the init handshake.
Types ¶
type Action ¶
type Action struct {
Type ActionType
Content string // For CHANGE: new document text
Position *lsp.Pos // For COMPLETION / HOVER / DEFINITION / REFERENCES / RENAME
Range *lsp.Range // For CODE_ACTION: selected range
IncludeDeclaration bool // For REFERENCES: matches LSP context flag
NewName string // For RENAME: the rename target name
}
Action carries one snapshot action's parameters. Different ActionTypes use different sub-fields; the omitted fields are just left zero. We don't bother with a discriminated union because each Action is short-lived and the fields are small.
type ActionType ¶
type ActionType int
ActionType identifies which LSP request a snapshot step makes.
const ( ActionChange ActionType = iota ActionCompletion ActionCodeAction ActionHover ActionDefinition ActionDocumentSymbol ActionReferences ActionRename ActionSemanticTokens )
type SnapshotCase ¶
SnapshotCase is what the harness runs: a document plus the sequence of requests to make against it.