Documentation
¶
Index ¶
- func ApplyTextEdits(ctx context.Context, client *lsp.Client, filePath string, edits []TextEdit) (string, error)
- func ExecuteCodeLens(ctx context.Context, client *lsp.Client, filePath string, index int) (string, error)
- func ExtractTextFromLocation(loc protocol.Location) (string, error)
- func FindReferences(ctx context.Context, client *lsp.Client, symbolName string) (string, error)
- func FindReferencesAtPosition(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func FormatDocument(ctx context.Context, client *lsp.Client, filePath string, mode string, ...) (string, error)
- func FormatLinesWithRanges(lines []string, ranges []LineRange) string
- func GetCodeActions(ctx context.Context, client *lsp.Client, filePath string, ...) (string, error)
- func GetCodeLens(ctx context.Context, client *lsp.Client, filePath string) (string, error)
- func GetDiagnosticsForFile(ctx context.Context, client *lsp.Client, filePath string, contextLines int, ...) (string, error)
- func GetDocumentHighlights(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func GetDocumentSymbols(ctx context.Context, client *lsp.Client, filePath string) (string, error)
- func GetFoldingRanges(ctx context.Context, client *lsp.Client, filePath string) (string, error)
- func GetFullDefinition(ctx context.Context, client *lsp.Client, startLocation protocol.Location) (string, protocol.Location, error)
- func GetHoverInfo(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func GetImplementation(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func GetLineRangesToDisplay(ctx context.Context, client *lsp.Client, locations []protocol.Location, ...) (map[int]bool, error)
- func GetLinkedEditingRange(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func GetSelectionRange(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func GetSemanticTokens(ctx context.Context, client *lsp.Client, caps *protocol.ServerCapabilities, ...) (string, error)
- func GetSignatureHelp(ctx context.Context, client *lsp.Client, filePath string, line, column int, ...) (string, error)
- func GetTypeDefinition(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func PrepareRename(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func ReadDefinition(ctx context.Context, client *lsp.Client, symbolName string) (string, error)
- func ReadDefinitionAtPosition(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
- func RenameSymbol(ctx context.Context, client *lsp.Client, filePath string, line, column int, ...) (string, error)
- type LineRange
- type TextEdit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTextEdits ¶
func ExecuteCodeLens ¶
func ExecuteCodeLens(ctx context.Context, client *lsp.Client, filePath string, index int) (string, error)
ExecuteCodeLens executes a specific code lens command from a file.
func FindReferences ¶
func FindReferencesAtPosition ¶ added in v0.4.2
func FindReferencesAtPosition(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
FindReferencesAtPosition resolves references for the symbol at the given 1-indexed (line, column) via textDocument/references. Avoids the workspace/symbol fan-out used by FindReferences, so it can disambiguate same-named symbols and won't duplicate the reference set for symbols that have multiple workspace/symbol hits (decl + export + dist copies).
func FormatDocument ¶
func FormatDocument(ctx context.Context, client *lsp.Client, filePath string, mode string, startLine, startCol, endLine, endCol int, triggerChar string) (string, error)
FormatDocument formats a document using the LSP formatting capabilities.
Modes: - "full": Format the entire document (textDocument/formatting) - "range": Format a specific range (textDocument/rangeFormatting) - "ontype": Format on typing a character (textDocument/onTypeFormatting)
For "full" mode, the range parameters are ignored. For "range" mode, startLine/startCol and endLine/endCol define the range. For "ontype" mode, startLine/startCol define the position, and triggerChar is the typed character.
func FormatLinesWithRanges ¶
FormatLinesWithRanges formats file content using line ranges
func GetCodeActions ¶
func GetCodeActions(ctx context.Context, client *lsp.Client, filePath string, startLine, startColumn, endLine, endColumn int) (string, error)
GetCodeActions returns available code actions for a range in a file.
func GetCodeLens ¶
GetCodeLens retrieves code lens hints for a given file location
func GetDiagnosticsForFile ¶
func GetDiagnosticsForFile(ctx context.Context, client *lsp.Client, filePath string, contextLines int, showLineNumbers bool) (string, error)
GetDiagnosticsForFile retrieves diagnostics for a specific file from the language server
func GetDocumentHighlights ¶ added in v0.4.3
func GetDocumentHighlights(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
GetDocumentHighlights returns the highlight ranges for the symbol at the given 1-indexed (line, column), grouped by kind (Read / Write / Text). Each highlight is shown alongside the source line it covers.
func GetDocumentSymbols ¶
GetDocumentSymbols returns the hierarchical symbol outline of a file
func GetFoldingRanges ¶ added in v0.4.3
GetFoldingRanges returns each foldable range in the file as `L<start>-<end>` plus the first line of the covered text. Civet uses whitespace-significant blocks, so this is the primary verification that fold boundaries land on the right lines after the .civet → .ts source map.
func GetFullDefinition ¶
func GetFullDefinition(ctx context.Context, client *lsp.Client, startLocation protocol.Location) (string, protocol.Location, error)
Gets the full code block surrounding the start of the input location
func GetHoverInfo ¶
func GetHoverInfo(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
GetHoverInfo retrieves hover information (type, documentation) for a symbol at the specified position
func GetImplementation ¶ added in v0.4.3
func GetImplementation(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
GetImplementation resolves implementation locations for the symbol at the given 1-indexed (line, column) via textDocument/implementation. For civet-lsp this exercises interface→class jumps surviving the sourcemap remap.
func GetLineRangesToDisplay ¶
func GetLineRangesToDisplay(ctx context.Context, client *lsp.Client, locations []protocol.Location, totalLines int, contextLines int) (map[int]bool, error)
GetLineRangesToDisplay determines which lines should be displayed for a set of locations. Caches `textDocument/documentSymbol` per URI so a 17k-diagnostic file (civet-lsp on parser.hera with broken types) does one LSP round-trip instead of one-per-location — previously this loop hammered the LSP with N identical documentSymbol RPCs and hung for minutes.
func GetLinkedEditingRange ¶ added in v0.4.3
func GetLinkedEditingRange(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
GetLinkedEditingRange returns the set of ranges that should be edited together with the symbol at the given 1-indexed (line, column). Primary use is JSX open/close tag mirroring. The LSP returns null when no linked-edit region exists at the cursor — that's surfaced explicitly rather than treated as an error.
func GetSelectionRange ¶ added in v0.4.3
func GetSelectionRange(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
GetSelectionRange asks the LSP for the "smart expand" selection ranges containing the given 1-indexed (line, column), then flattens the recursive parent chain outermost-first. Each level is rendered as `L<start>-<end>` plus the first line of the covered text.
LSP takes a list of positions; this tool wraps a single position into a one-element array, which is the only shape that's useful to an agent.
func GetSemanticTokens ¶
func GetSemanticTokens(ctx context.Context, client *lsp.Client, caps *protocol.ServerCapabilities, filePath string) (string, error)
GetSemanticTokens retrieves full semantic tokens for a file and renders them in a human-readable form. Intended primarily as a debug surface for LSP implementors — the full token list is emitted (no truncation) so provider output can be diffed against expectations.
func GetSignatureHelp ¶ added in v0.4.3
func GetSignatureHelp(ctx context.Context, client *lsp.Client, filePath string, line, column int, triggerCharacter, triggerKind string, isRetrigger bool) (string, error)
GetSignatureHelp returns the signature(s) and active parameter at the given 1-indexed (line, column). triggerCharacter / triggerKind / isRetrigger are optional and feed into SignatureHelpContext so the LSP can branch on how signature help was invoked (manual vs. trigger char vs. retrigger).
triggerKind values: "invoked" (1, default), "trigger" (2), "content" (3). If triggerCharacter is non-empty, triggerKind defaults to "trigger".
func GetTypeDefinition ¶ added in v0.4.3
func GetTypeDefinition(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
GetTypeDefinition resolves the type-definition location for the symbol at the given 1-indexed (line, column) via textDocument/typeDefinition. For civet-lsp this exercises the TS service's mapping of *type* (not value) back through the sourcemap to the original `.civet`.
func PrepareRename ¶ added in v0.4.3
func PrepareRename(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
PrepareRename probes whether a rename is possible at the given 1-indexed (line, column) and reports the range that would be renamed plus an optional placeholder. The LSP response is one of: Range | { range, placeholder } | { defaultBehavior: true } | null.
func ReadDefinition ¶
func ReadDefinitionAtPosition ¶ added in v0.4.2
func ReadDefinitionAtPosition(ctx context.Context, client *lsp.Client, filePath string, line, column int) (string, error)
ReadDefinitionAtPosition resolves the definition for the symbol at the given 1-indexed (line, column) via textDocument/definition. Unlike ReadDefinition it does not rely on workspace/symbol, so it can disambiguate same-named symbols by call site and won't surface build-output copies the LSP happens to index.
func RenameSymbol ¶
func RenameSymbol(ctx context.Context, client *lsp.Client, filePath string, line, column int, newName string) (string, error)
RenameSymbol renames a symbol (variable, function, class, etc.) at the specified position It uses the LSP rename functionality to handle all references across files
Types ¶
type TextEdit ¶
type TextEdit struct {
StartLine int `json:"startLine" jsonschema:"required,description=Start line to replace, inclusive"`
EndLine int `json:"endLine" jsonschema:"required,description=End line to replace, inclusive"`
NewText string `json:"newText" jsonschema:"description=Replacement text. Replace with the new text. Leave blank to remove lines."`
}
Source Files
¶
- code-actions.go
- definition.go
- diagnostics.go
- document-highlight.go
- document-symbols.go
- edit_file.go
- execute-codelens.go
- folding-range.go
- formatting.go
- get-codelens.go
- hover.go
- implementation.go
- linked-editing-range.go
- logging.go
- lsp-utilities.go
- prepare-rename.go
- references.go
- rename-symbol.go
- selection-range.go
- semantic-tokens.go
- signature-help.go
- type-definition.go
- utilities.go