Documentation
¶
Overview ¶
Package core provides diagnostic types for reporting errors, warnings, and hints.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#diagnostic
Package core provides encoding conversion utilities for UTF-8 and UTF-16.
LSP Specification requires UTF-16 code units for positions: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#textDocuments
"Character offset in a line is measured in UTF-16 code units. So a string of the form 'a𐐀b' has length 4, not 3, since 𐐀 is represented by a surrogate pair in UTF-16."
This package handles conversion between: - UTF-8 byte offsets (used in core types for natural Go string handling) - UTF-16 code unit offsets (used in LSP protocol per specification)
Package core provides document highlight types for showing symbol occurrences.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#textDocument_documentHighlight
Package core provides protocol-agnostic types for language server operations. These types are optimized for Go usage and CLI tools, using UTF-8 byte offsets instead of LSP's UTF-16 code units. Adapters handle conversion to/from protocol types.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/
Index ¶
- func PositionToByteOffset(content string, pos Position) int
- func UTF8ToUTF16Offset(content string, line int, utf8Offset int) int
- func UTF16ToUTF8Offset(content string, line int, utf16Offset int) int
- type AnnotatedTextEdit
- type ChangeAnnotation
- type CodeAction
- type CodeActionDisabled
- type CodeActionKind
- type CodeActionTriggerKind
- type CodeDescription
- type CodeFixContext
- type CodeFixProvider
- type CodeFixRegistry
- type CodeLens
- type CodeLensContext
- type CodeLensProvider
- type CodeLensResolveProvider
- type Color
- type ColorInformation
- type ColorPresentation
- type ColorPresentationProvider
- type Command
- type CompletionContext
- type CompletionItem
- type CompletionItemKind
- type CompletionItemResolveProvider
- type CompletionItemTag
- type CompletionList
- type CompletionProvider
- type CompletionTriggerKind
- type CreateFile
- type CreateFileOptions
- type DefinitionProvider
- type DeleteFile
- type DeleteFileOptions
- type Diagnostic
- type DiagnosticCode
- type DiagnosticProvider
- type DiagnosticRegistry
- type DiagnosticRelatedInformation
- type DiagnosticSeverity
- type DiagnosticTag
- type Document
- type DocumentColorProvider
- type DocumentHighlight
- type DocumentHighlightContext
- type DocumentHighlightKind
- type DocumentHighlightProvider
- type DocumentLink
- type DocumentLinkProvider
- type DocumentLinkResolveProvider
- type DocumentManager
- func (dm *DocumentManager) ApplyEdit(uri string, r Range, newText string) bool
- func (dm *DocumentManager) Close(uri string)
- func (dm *DocumentManager) Get(uri string) (*Document, bool)
- func (dm *DocumentManager) GetContent(uri string) string
- func (dm *DocumentManager) Open(uri, content string, version int) *Document
- func (dm *DocumentManager) Update(uri, content string) bool
- type DocumentSymbol
- type DocumentSymbolProvider
- type FoldingRange
- type FoldingRangeKind
- type FoldingRangeProvider
- type FormattingOptions
- type FormattingProvider
- type HoverInfo
- type HoverProvider
- type InlayHint
- type InlayHintKind
- type InlayHintResolveProvider
- type InlayHintsProvider
- type InlineCompletionContext
- type InlineCompletionItem
- type InlineCompletionList
- type InlineCompletionProvider
- type InlineCompletionTriggerKind
- type InsertTextFormat
- type Location
- type LocationLink
- type ParameterInformation
- type Position
- type PrepareRenameProvider
- type Range
- type RangeFormattingProvider
- type RangesFormattingProvider
- type ReferenceContext
- type ReferencesProvider
- type RenameContext
- type RenameFile
- type RenameFileOptions
- type RenameProvider
- type SelectedCompletionInfo
- type SelectionRange
- type SelectionRangeProvider
- type SignatureHelp
- type SignatureHelpContext
- type SignatureHelpProvider
- type SignatureInformation
- type SymbolKind
- type SymbolTag
- type TextDocumentEdit
- type TextEdit
- type VersionedTextDocumentIdentifier
- type WorkspaceEdit
- type WorkspaceSymbol
- type WorkspaceSymbolParams
- type WorkspaceSymbolProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PositionToByteOffset ¶
PositionToByteOffset converts a Position to an absolute byte offset in the document. This is the inverse of ByteOffsetToPosition.
The input Position should use UTF-8 byte offsets (core format). If you have a protocol Position with UTF-16 code units, convert it first using adapter functions.
If the position is beyond the end of the document, returns len(content). If the character offset is beyond the end of the line, clamps to end of line.
func UTF8ToUTF16Offset ¶
UTF8ToUTF16Offset converts a UTF-8 byte offset to a UTF-16 code unit offset. This is used when converting core types to protocol types.
The line parameter is zero-based, and offset is the UTF-8 byte offset within the line. Returns the equivalent UTF-16 code unit offset within the same line.
Character Boundary Handling: If the offset lands in the middle of a multi-byte UTF-8 character, it rounds DOWN to the start of that character. This ensures positions always point to valid character boundaries.
LSP Spec Reference: UTF-16 code units are required by the LSP specification https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#position
func UTF16ToUTF8Offset ¶
UTF16ToUTF8Offset converts a UTF-16 code unit offset to a UTF-8 byte offset. This is used when converting protocol types to core types.
The line parameter is zero-based, and utf16Offset is the UTF-16 code unit offset within the line. Returns the equivalent UTF-8 byte offset within the same line.
Character Boundary Handling: If the offset lands in the middle of a surrogate pair (e.g., emoji or characters >= U+10000), it rounds DOWN to the start of that character.
Surrogate Pairs: Characters outside the BMP (U+10000 to U+10FFFF) are encoded as surrogate pairs in UTF-16, using 2 code units. For example, '𐐀' (U+10400) requires 2 UTF-16 code units but 4 UTF-8 bytes.
LSP Spec Reference: UTF-16 code units are required by the LSP specification https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#position
Types ¶
type AnnotatedTextEdit ¶
type AnnotatedTextEdit struct {
TextEdit
// AnnotationID is an optional identifier for the edit.
// This can be used to group related edits or provide additional context.
AnnotationID *string
}
AnnotatedTextEdit represents a text edit with an optional annotation.
type ChangeAnnotation ¶
type ChangeAnnotation struct {
// Label is a human-readable string describing the change.
Label string
// NeedsConfirmation indicates whether the change needs user confirmation.
NeedsConfirmation bool
// Description is an optional longer description of the change.
Description string
}
ChangeAnnotation represents additional information about a change.
type CodeAction ¶
type CodeAction struct {
// Title is a short, human-readable title for this code action.
Title string
// Kind is the kind of this code action.
Kind *CodeActionKind
// Diagnostics are the diagnostics that this code action resolves.
Diagnostics []Diagnostic
// IsPreferred indicates that this code action is the preferred action in a group.
IsPreferred bool
// Disabled indicates the reason why this code action is disabled.
Disabled *CodeActionDisabled
// Edit is the workspace edit this code action performs.
Edit *WorkspaceEdit
// Command is a command to execute instead of or in addition to the edit.
Command *Command
// Data is arbitrary data preserved between textDocument/codeAction and codeAction/resolve.
Data interface{}
}
CodeAction represents a change that can be performed in code. Uses UTF-8 byte offsets for all ranges in diagnostics and edits.
type CodeActionDisabled ¶
type CodeActionDisabled struct {
// Reason is the human-readable reason why the code action is disabled.
Reason string
}
CodeActionDisabled explains why a code action is disabled.
type CodeActionKind ¶
type CodeActionKind string
CodeActionKind defines the kind of a code action.
const ( // CodeActionKindEmpty is the empty kind. CodeActionKindEmpty CodeActionKind = "" // CodeActionKindQuickFix is a quick fix action. CodeActionKindQuickFix CodeActionKind = "quickfix" // CodeActionKindRefactor is a refactoring action. CodeActionKindRefactor CodeActionKind = "refactor" // CodeActionKindRefactorExtract extracts code into a new entity. CodeActionKindRefactorExtract CodeActionKind = "refactor.extract" // CodeActionKindRefactorInline inlines code. CodeActionKindRefactorInline CodeActionKind = "refactor.inline" // CodeActionKindRefactorRewrite rewrites code. CodeActionKindRefactorRewrite CodeActionKind = "refactor.rewrite" // CodeActionKindSource is a source action (e.g., organize imports). CodeActionKindSource CodeActionKind = "source" // CodeActionKindSourceOrganizeImports organizes imports. CodeActionKindSourceOrganizeImports CodeActionKind = "source.organizeImports" // CodeActionKindSourceFixAll fixes all auto-fixable problems. CodeActionKindSourceFixAll CodeActionKind = "source.fixAll" )
type CodeActionTriggerKind ¶
type CodeActionTriggerKind int
CodeActionTriggerKind defines how a code action was triggered.
const ( // CodeActionTriggerKindInvoked means the code action was explicitly requested by the user. CodeActionTriggerKindInvoked CodeActionTriggerKind = 1 // CodeActionTriggerKindAutomatic means the code action was automatically triggered (e.g., on save). CodeActionTriggerKindAutomatic CodeActionTriggerKind = 2 )
type CodeDescription ¶
type CodeDescription struct {
// HRef is a URI pointing to documentation or more information
HRef string
}
CodeDescription provides additional information about a diagnostic code, typically a URL to documentation.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#codeDescription Protocol: { href: URI }
type CodeFixContext ¶
type CodeFixContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
// Range is the range for which code fixes are requested.
Range Range
// Diagnostics are the diagnostics in the requested range.
Diagnostics []Diagnostic
// Only contains the kinds of code actions requested.
// If empty, all kinds are requested.
Only []CodeActionKind
// TriggerKind indicates how the code action was triggered.
TriggerKind CodeActionTriggerKind
}
CodeFixContext provides context for code fix providers.
type CodeFixProvider ¶
type CodeFixProvider interface {
// ProvideCodeFixes returns code actions for the given context.
// Returns nil or empty slice if no fixes are available.
ProvideCodeFixes(ctx CodeFixContext) []CodeAction
}
CodeFixProvider provides code fixes for a document. Implementations work directly with core types (UTF-8 offsets).
type CodeFixRegistry ¶
type CodeFixRegistry struct {
// contains filtered or unexported fields
}
CodeFixRegistry manages multiple code fix providers.
func NewCodeFixRegistry ¶
func NewCodeFixRegistry() *CodeFixRegistry
NewCodeFixRegistry creates a new code fix registry.
func (*CodeFixRegistry) ProvideCodeFixes ¶
func (r *CodeFixRegistry) ProvideCodeFixes(ctx CodeFixContext) []CodeAction
ProvideCodeFixes collects code fixes from all registered providers.
func (*CodeFixRegistry) Register ¶
func (r *CodeFixRegistry) Register(provider CodeFixProvider)
Register adds a code fix provider to the registry.
type CodeLens ¶
type CodeLens struct {
// Range is where the code lens should appear.
Range Range
// Command is the command to execute when the code lens is clicked.
Command *Command
// Data is arbitrary data preserved for code lens resolve.
Data interface{}
}
CodeLens represents a command that should be shown inline with source code.
type CodeLensContext ¶
type CodeLensContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
}
CodeLensContext provides context for code lens requests.
type CodeLensProvider ¶
type CodeLensProvider interface {
// ProvideCodeLenses returns code lenses for the document.
ProvideCodeLenses(ctx CodeLensContext) []CodeLens
}
CodeLensProvider provides code lenses.
type CodeLensResolveProvider ¶
type CodeLensResolveProvider interface {
// ResolveCodeLens resolves additional details for a code lens.
ResolveCodeLens(lens CodeLens) CodeLens
}
CodeLensResolveProvider resolves additional details for a code lens.
type Color ¶
type Color struct {
// Red component in the range [0-1].
Red float64
// Green component in the range [0-1].
Green float64
// Blue component in the range [0-1].
Blue float64
// Alpha component in the range [0-1].
Alpha float64
}
Color represents an RGBA color value.
type ColorInformation ¶
type ColorInformation struct {
// Range is the range in the document where this color appears.
Range Range
// Color is the actual RGBA color value.
Color Color
}
ColorInformation represents a color reference found in a document. Uses UTF-8 byte offsets for the range.
type ColorPresentation ¶
type ColorPresentation struct {
// Label is the label of this color presentation.
// This is what will be shown in the color picker.
Label string
// TextEdit is an optional edit to apply when selecting this presentation.
// If not provided, the label is used as the edit text.
TextEdit *TextEdit
// AdditionalTextEdits are optional additional edits that are applied
// when selecting this color presentation.
AdditionalTextEdits []TextEdit
}
ColorPresentation represents how a color can be represented as text. For example, a color could be presented as "#FF0000", "rgb(255, 0, 0)", or "red" depending on the context.
type ColorPresentationProvider ¶
type ColorPresentationProvider interface {
// ProvideColorPresentations returns ways to represent a color value as text.
// Returns nil or empty slice if no presentations are available.
ProvideColorPresentations(uri, content string, color Color, rng Range) []ColorPresentation
}
ColorPresentationProvider provides different textual representations of a color. This is used when the user picks a color to determine how it should be formatted.
type Command ¶
type Command struct {
// Title is the title of the command.
Title string
// Tooltip is an optional tooltip when hovering over the command.
// @since 3.18.0
Tooltip string
// Command is the identifier of the command to execute.
Command string
// Arguments are optional arguments for the command.
Arguments []interface{}
}
Command represents a reference to a command.
type CompletionContext ¶
type CompletionContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
// Position is where completion was requested (UTF-8 offset).
Position Position
// TriggerKind indicates how completion was triggered.
TriggerKind CompletionTriggerKind
// TriggerCharacter is the character that triggered completion (if any).
TriggerCharacter string
}
CompletionContext provides context for a completion request.
type CompletionItem ¶
type CompletionItem struct {
// Label is the text shown in the completion list.
Label string
// Kind is the type of completion item.
Kind *CompletionItemKind
// Tags are additional tags for this item.
Tags []CompletionItemTag
// Detail provides additional information about this item.
Detail string
// Documentation provides documentation for this item.
Documentation string
// Deprecated indicates if this item is deprecated.
Deprecated bool
// Preselect indicates if this item should be preselected.
Preselect bool
// SortText is used for sorting (if different from label).
SortText string
// FilterText is used for filtering (if different from label).
FilterText string
// InsertText is the text to insert (if different from label).
InsertText string
// InsertTextFormat indicates how to interpret the insert text.
InsertTextFormat *InsertTextFormat
// TextEdit is the edit to apply when selecting this item.
TextEdit *TextEdit
// AdditionalTextEdits are additional edits to apply.
AdditionalTextEdits []TextEdit
// CommitCharacters are characters that trigger accepting this completion.
CommitCharacters []string
// Command is a command to execute after inserting this completion.
Command *Command
// Data is arbitrary data preserved for completion resolve.
Data interface{}
}
CompletionItem represents a single completion suggestion.
type CompletionItemKind ¶
type CompletionItemKind int
CompletionItemKind defines the kind of a completion item.
const ( CompletionItemKindText CompletionItemKind = 1 CompletionItemKindMethod CompletionItemKind = 2 CompletionItemKindFunction CompletionItemKind = 3 CompletionItemKindConstructor CompletionItemKind = 4 CompletionItemKindField CompletionItemKind = 5 CompletionItemKindVariable CompletionItemKind = 6 CompletionItemKindClass CompletionItemKind = 7 CompletionItemKindInterface CompletionItemKind = 8 CompletionItemKindModule CompletionItemKind = 9 CompletionItemKindProperty CompletionItemKind = 10 CompletionItemKindUnit CompletionItemKind = 11 CompletionItemKindValue CompletionItemKind = 12 CompletionItemKindEnum CompletionItemKind = 13 CompletionItemKindKeyword CompletionItemKind = 14 CompletionItemKindSnippet CompletionItemKind = 15 CompletionItemKindColor CompletionItemKind = 16 CompletionItemKindFile CompletionItemKind = 17 CompletionItemKindReference CompletionItemKind = 18 CompletionItemKindFolder CompletionItemKind = 19 CompletionItemKindEnumMember CompletionItemKind = 20 CompletionItemKindConstant CompletionItemKind = 21 CompletionItemKindStruct CompletionItemKind = 22 CompletionItemKindEvent CompletionItemKind = 23 CompletionItemKindOperator CompletionItemKind = 24 CompletionItemKindTypeParameter CompletionItemKind = 25 )
type CompletionItemResolveProvider ¶
type CompletionItemResolveProvider interface {
// ResolveCompletionItem resolves additional details for a completion item.
// This is called when the user selects an item but before inserting it.
ResolveCompletionItem(item CompletionItem) CompletionItem
}
CompletionItemResolveProvider resolves additional details for a completion item.
type CompletionItemTag ¶
type CompletionItemTag int
CompletionItemTag defines tags for completion items.
const ( // CompletionItemTagDeprecated indicates the item is deprecated. CompletionItemTagDeprecated CompletionItemTag = 1 )
type CompletionList ¶
type CompletionList struct {
// IsIncomplete indicates if the list is incomplete.
// If true, the client should re-request completions when typing continues.
IsIncomplete bool
// Items are the completion items.
Items []CompletionItem
}
CompletionList represents a list of completion items.
type CompletionProvider ¶
type CompletionProvider interface {
// ProvideCompletions returns completion items for the given context.
// Returns nil or empty list if no completions are available.
ProvideCompletions(ctx CompletionContext) *CompletionList
}
CompletionProvider provides completion suggestions.
type CompletionTriggerKind ¶
type CompletionTriggerKind int
CompletionTriggerKind defines how a completion was triggered.
const ( // CompletionTriggerKindInvoked means completion was explicitly requested. CompletionTriggerKindInvoked CompletionTriggerKind = 1 // CompletionTriggerKindTriggerCharacter means completion was triggered by a character. CompletionTriggerKindTriggerCharacter CompletionTriggerKind = 2 // CompletionTriggerKindTriggerForIncompleteCompletions means completion was re-triggered. CompletionTriggerKindTriggerForIncompleteCompletions CompletionTriggerKind = 3 )
type CreateFile ¶
type CreateFile struct {
// URI is the resource to create.
URI string
// Options contains additional options for creating the file.
Options *CreateFileOptions
}
CreateFile represents an operation to create a file.
type CreateFileOptions ¶
type CreateFileOptions struct {
// Overwrite existing file if it exists. Overwrite wins over ignoreIfExists.
Overwrite bool
// IgnoreIfExists will not create the file if it already exists.
IgnoreIfExists bool
}
CreateFileOptions contains options for creating a file.
type DefinitionProvider ¶
type DefinitionProvider interface {
// ProvideDefinition returns definition locations for the position.
// Returns nil if no definition is found.
ProvideDefinition(uri, content string, position Position) []Location
}
DefinitionProvider provides go-to-definition locations.
type DeleteFile ¶
type DeleteFile struct {
// URI is the file to delete.
URI string
// Options contains additional options for deleting the file.
Options *DeleteFileOptions
}
DeleteFile represents an operation to delete a file.
type DeleteFileOptions ¶
type DeleteFileOptions struct {
// Recursive deletes the directory and all its contents if the URI is a directory.
Recursive bool
// IgnoreIfNotExists will not fail if the file does not exist.
IgnoreIfNotExists bool
}
DeleteFileOptions contains options for deleting a file.
type Diagnostic ¶
type Diagnostic struct {
// Range is where the diagnostic applies
Range Range
// Severity indicates the diagnostic level (error, warning, info, hint)
// If nil, the client decides how to interpret it
Severity *DiagnosticSeverity
// Code is an optional diagnostic code (can be int or string)
Code *DiagnosticCode
// CodeDescription provides a link to more information about the code
CodeDescription *CodeDescription
// Source is the name of the source of the diagnostic (e.g., "typescript", "eslint")
Source string
// Message is the human-readable diagnostic message
Message string
// Tags provide additional metadata (unnecessary, deprecated)
Tags []DiagnosticTag
// RelatedInformation provides additional locations related to this diagnostic
RelatedInformation []DiagnosticRelatedInformation
// Data is arbitrary data preserved between diagnostics and code actions
// This can be used to carry information needed for quick fixes
Data any
}
Diagnostic represents a diagnostic message such as a compiler error or warning. Diagnostics are the primary way to report problems found during analysis.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#diagnostic Protocol: { range: Range, severity?: DiagnosticSeverity, code?: integer | string,
codeDescription?: CodeDescription, source?: string, message: string, tags?: DiagnosticTag[], relatedInformation?: DiagnosticRelatedInformation[], data?: any }
func (Diagnostic) HasTag ¶
func (d Diagnostic) HasTag(tag DiagnosticTag) bool
HasTag returns true if this diagnostic has the specified tag
func (Diagnostic) IsError ¶
func (d Diagnostic) IsError() bool
IsError returns true if this diagnostic is an error
func (Diagnostic) IsHint ¶
func (d Diagnostic) IsHint() bool
IsHint returns true if this diagnostic is a hint
func (Diagnostic) IsInformation ¶
func (d Diagnostic) IsInformation() bool
IsInformation returns true if this diagnostic is informational
func (Diagnostic) IsWarning ¶
func (d Diagnostic) IsWarning() bool
IsWarning returns true if this diagnostic is a warning
type DiagnosticCode ¶
type DiagnosticCode struct {
// IsInt indicates whether this is an integer code
IsInt bool
// IntValue holds the integer code if IsInt is true
IntValue int
// StringValue holds the string code if IsInt is false
StringValue string
}
DiagnosticCode represents a diagnostic code which can be either an integer or string.
func NewIntCode ¶
func NewIntCode(code int) DiagnosticCode
NewIntCode creates a diagnostic code from an integer
func NewStringCode ¶
func NewStringCode(code string) DiagnosticCode
NewStringCode creates a diagnostic code from a string
func (DiagnosticCode) String ¶
func (c DiagnosticCode) String() string
String returns the string representation of the code
type DiagnosticProvider ¶
type DiagnosticProvider interface {
// ProvideDiagnostics returns diagnostics for the given document.
// Returns nil or empty slice if no diagnostics are found.
ProvideDiagnostics(uri, content string) []Diagnostic
}
DiagnosticProvider provides diagnostics for a document. Implementations work directly with core types (UTF-8 offsets).
type DiagnosticRegistry ¶
type DiagnosticRegistry struct {
// contains filtered or unexported fields
}
DiagnosticRegistry manages multiple diagnostic providers.
func NewDiagnosticRegistry ¶
func NewDiagnosticRegistry() *DiagnosticRegistry
NewDiagnosticRegistry creates a new diagnostic registry.
func (*DiagnosticRegistry) ProvideDiagnostics ¶
func (r *DiagnosticRegistry) ProvideDiagnostics(uri, content string) []Diagnostic
ProvideDiagnostics collects diagnostics from all registered providers.
func (*DiagnosticRegistry) Register ¶
func (r *DiagnosticRegistry) Register(provider DiagnosticProvider)
Register adds a diagnostic provider to the registry.
type DiagnosticRelatedInformation ¶
type DiagnosticRelatedInformation struct {
// Location is where the related information is
Location Location
// Message describes the relationship
Message string
}
DiagnosticRelatedInformation represents a related location and message for a diagnostic. This is used to show related code locations that contribute to or are affected by the diagnostic.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#diagnosticRelatedInformation Protocol: { location: Location, message: string }
type DiagnosticSeverity ¶
type DiagnosticSeverity int
DiagnosticSeverity indicates the severity level of a diagnostic.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#diagnosticSeverity Values: Error = 1, Warning = 2, Information = 3, Hint = 4
const ( // SeverityError indicates an error SeverityError DiagnosticSeverity = 1 // SeverityWarning indicates a warning SeverityWarning DiagnosticSeverity = 2 // SeverityInformation indicates informational message SeverityInformation DiagnosticSeverity = 3 // SeverityHint indicates a hint SeverityHint DiagnosticSeverity = 4 )
func (DiagnosticSeverity) String ¶
func (s DiagnosticSeverity) String() string
String returns a human-readable name for the severity
type DiagnosticTag ¶
type DiagnosticTag int
DiagnosticTag provides additional metadata about a diagnostic.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#diagnosticTag Values: Unnecessary = 1, Deprecated = 2
const ( // TagUnnecessary indicates unused or unnecessary code that can be grayed out TagUnnecessary DiagnosticTag = 1 // TagDeprecated indicates deprecated code that should be struck through TagDeprecated DiagnosticTag = 2 )
func (DiagnosticTag) String ¶
func (t DiagnosticTag) String() string
String returns a human-readable name for the tag
type Document ¶
type Document struct {
URI string
Content string
Version int
// contains filtered or unexported fields
}
Document represents a text document with its content and metadata. This is a convenience type for managing documents in memory and working with core types.
func NewDocument ¶
NewDocument creates a new document with the given URI and content.
func (*Document) ApplyEdit ¶
ApplyEdit applies a text edit to the document. The range and replacement text use UTF-8 byte offsets.
func (*Document) GetContent ¶
GetContent returns the current content of the document.
func (*Document) SetContent ¶
SetContent updates the document content and increments the version.
type DocumentColorProvider ¶
type DocumentColorProvider interface {
// ProvideDocumentColors returns all color references found in the document.
// Returns nil or empty slice if no colors are found.
ProvideDocumentColors(uri, content string) []ColorInformation
}
DocumentColorProvider provides color information for a document. This allows editors to show color decorators and color pickers.
type DocumentHighlight ¶
type DocumentHighlight struct {
// Range is the range this highlight applies to (UTF-8 offsets in core).
Range Range
// Kind is the highlight kind (Text, Read, Write).
// If nil, defaults to Text.
Kind *DocumentHighlightKind
}
DocumentHighlight represents a range to highlight in a document. Used to show all occurrences of a symbol when the cursor is on it.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#documentHighlight Protocol: { range: Range, kind?: DocumentHighlightKind }
type DocumentHighlightContext ¶
type DocumentHighlightContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
// Position is where the cursor is positioned (UTF-8 offset in core).
Position Position
}
DocumentHighlightContext provides context for document highlight requests.
type DocumentHighlightKind ¶
type DocumentHighlightKind int
DocumentHighlightKind defines the kind of document highlight.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#documentHighlightKind Values: Text = 1, Read = 2, Write = 3
const ( // DocumentHighlightKindText indicates a textual occurrence. DocumentHighlightKindText DocumentHighlightKind = 1 // DocumentHighlightKindRead indicates read-access of a symbol (e.g., reading a variable). DocumentHighlightKindRead DocumentHighlightKind = 2 // DocumentHighlightKindWrite indicates write-access of a symbol (e.g., writing to a variable). DocumentHighlightKindWrite DocumentHighlightKind = 3 )
type DocumentHighlightProvider ¶
type DocumentHighlightProvider interface {
// ProvideDocumentHighlights returns highlights for the symbol at the position.
// Returns nil or empty slice if no highlights are available.
ProvideDocumentHighlights(ctx DocumentHighlightContext) []DocumentHighlight
}
DocumentHighlightProvider provides document highlights. This interface can be implemented to provide "find all references" style highlighting.
type DocumentLink ¶
type DocumentLink struct {
// Range is the range where the link appears in the document.
Range Range
// Target is the URI that the link points to.
// If nil, the link should be resolved lazily via DocumentLinkResolveProvider.
Target *string
// Tooltip is the tooltip text when hovering over this link.
Tooltip *string
// Data is arbitrary data preserved between textDocument/documentLink and documentLink/resolve.
Data interface{}
}
DocumentLink represents a link inside a document. The link can point to a URL, a file, or another location in the workspace. Uses UTF-8 byte offsets for the range.
type DocumentLinkProvider ¶
type DocumentLinkProvider interface {
// ProvideDocumentLinks returns document links for the given document.
// Returns nil or empty slice if no links are available.
ProvideDocumentLinks(uri, content string) []DocumentLink
}
DocumentLinkProvider provides document links. Document links are clickable regions in a document that link to URIs, files, or locations.
type DocumentLinkResolveProvider ¶
type DocumentLinkResolveProvider interface {
// ResolveDocumentLink resolves additional details for a document link.
// This is called when the user hovers over a link but before following it.
ResolveDocumentLink(link DocumentLink) DocumentLink
}
DocumentLinkResolveProvider resolves additional details for a document link. This is used for lazy resolution of link targets.
type DocumentManager ¶
type DocumentManager struct {
// contains filtered or unexported fields
}
DocumentManager manages a collection of documents. This is useful for LSP server implementations that need to track open documents.
func NewDocumentManager ¶
func NewDocumentManager() *DocumentManager
NewDocumentManager creates a new document manager.
func (*DocumentManager) ApplyEdit ¶
func (dm *DocumentManager) ApplyEdit(uri string, r Range, newText string) bool
ApplyEdit applies a text edit to a document.
func (*DocumentManager) Close ¶
func (dm *DocumentManager) Close(uri string)
Close removes a document from the manager.
func (*DocumentManager) Get ¶
func (dm *DocumentManager) Get(uri string) (*Document, bool)
Get retrieves a document by URI.
func (*DocumentManager) GetContent ¶
func (dm *DocumentManager) GetContent(uri string) string
GetContent is a convenience method to get document content by URI. Returns empty string if document not found.
func (*DocumentManager) Open ¶
func (dm *DocumentManager) Open(uri, content string, version int) *Document
Open adds or updates a document in the manager.
func (*DocumentManager) Update ¶
func (dm *DocumentManager) Update(uri, content string) bool
Update updates a document's content.
type DocumentSymbol ¶
type DocumentSymbol struct {
// Name is the name of this symbol.
Name string
// Detail provides additional information about this symbol.
Detail string
// Kind is the kind of this symbol.
Kind SymbolKind
// Tags are tags for this symbol.
Tags []SymbolTag
// Deprecated indicates if this symbol is deprecated.
Deprecated bool
// Range is the range enclosing this symbol (including leading/trailing whitespace and comments).
Range Range
// SelectionRange is the range that should be selected and revealed when navigating to this symbol.
// This is typically the range of the symbol's name.
SelectionRange Range
// Children are symbols that are children of this symbol (e.g., properties of a class).
Children []DocumentSymbol
}
DocumentSymbol represents programming constructs like variables, classes, interfaces, etc. that appear in a document. Uses UTF-8 byte offsets for ranges.
type DocumentSymbolProvider ¶
type DocumentSymbolProvider interface {
// ProvideDocumentSymbols returns document symbols for the given document.
ProvideDocumentSymbols(uri, content string) []DocumentSymbol
}
DocumentSymbolProvider provides document symbols.
type FoldingRange ¶
type FoldingRange struct {
// StartLine is the zero-based start line of the range to fold.
StartLine int
// StartCharacter is the UTF-8 byte offset from where the folded range starts.
// If nil, defaults to the length of the start line.
StartCharacter *int
// EndLine is the zero-based end line of the range to fold.
EndLine int
// EndCharacter is the UTF-8 byte offset before the folded range ends.
// If nil, defaults to the length of the end line.
EndCharacter *int
// Kind describes the kind of the folding range (comment, region, imports).
Kind *FoldingRangeKind
}
FoldingRange represents a range in a document that can be folded (collapsed). Unlike protocol FoldingRange which uses UTF-16 offsets, this uses UTF-8 byte offsets.
type FoldingRangeKind ¶
type FoldingRangeKind string
FoldingRangeKind defines the kind of folding range.
const ( // FoldingRangeKindComment indicates a folding range for a comment. FoldingRangeKindComment FoldingRangeKind = "comment" // FoldingRangeKindImports indicates a folding range for imports or includes. FoldingRangeKindImports FoldingRangeKind = "imports" // FoldingRangeKindRegion indicates a folding range for a region (e.g., #region). FoldingRangeKindRegion FoldingRangeKind = "region" )
type FoldingRangeProvider ¶
type FoldingRangeProvider interface {
// ProvideFoldingRanges returns folding ranges for the given document.
ProvideFoldingRanges(uri, content string) []FoldingRange
}
FoldingRangeProvider provides folding ranges for a document.
type FormattingOptions ¶
type FormattingOptions struct {
// TabSize is the size of a tab in spaces.
TabSize int
// InsertSpaces indicates whether to insert spaces instead of tabs.
InsertSpaces bool
// TrimTrailingWhitespace indicates whether to trim trailing whitespace.
TrimTrailingWhitespace bool
// InsertFinalNewline indicates whether to insert a final newline.
InsertFinalNewline bool
// TrimFinalNewlines indicates whether to trim final newlines.
TrimFinalNewlines bool
}
FormattingOptions contains options for formatting.
type FormattingProvider ¶
type FormattingProvider interface {
// ProvideFormatting returns edits to format the entire document.
ProvideFormatting(uri, content string, options FormattingOptions) []TextEdit
}
FormattingProvider provides document formatting.
type HoverInfo ¶
type HoverInfo struct {
// Contents is the hover content (markdown or plain text).
Contents string
// Range is the range to which the hover applies.
// If nil, the range is computed from the position.
Range *Range
}
HoverInfo contains hover information for a position.
type HoverProvider ¶
type HoverProvider interface {
// ProvideHover returns hover information for the position.
// Returns nil if no hover information is available.
ProvideHover(uri, content string, position Position) *HoverInfo
}
HoverProvider provides hover information.
type InlayHint ¶
type InlayHint struct {
// Position is the position where the hint should be shown.
// The hint appears directly before this position.
Position Position
// Label is the text to display in the hint.
// Can be a simple string or structured with parts.
Label string
// Kind is the kind of hint (type or parameter).
Kind *InlayHintKind
// TextEdits are optional text edits to apply when accepting the hint.
// This allows hints to be actionable.
TextEdits []TextEdit
// Tooltip provides additional information shown when hovering the hint.
Tooltip string
// PaddingLeft adds whitespace before the hint.
PaddingLeft bool
// PaddingRight adds whitespace after the hint.
PaddingRight bool
// Data is arbitrary data preserved between textDocument/inlayHint and inlayHint/resolve.
Data interface{}
}
InlayHint represents an inline annotation that is shown in the editor. Inlay hints appear inline with the code and provide additional information such as parameter names or inferred types.
type InlayHintKind ¶
type InlayHintKind int
InlayHintKind defines the kind of an inlay hint.
const ( // InlayHintKindType is a hint for a type annotation. InlayHintKindType InlayHintKind = 1 // InlayHintKindParameter is a hint for a parameter name. InlayHintKindParameter InlayHintKind = 2 )
type InlayHintResolveProvider ¶
type InlayHintResolveProvider interface {
// ResolveInlayHint resolves additional details for an inlay hint.
// This is called when more information is needed about a hint.
ResolveInlayHint(hint InlayHint) InlayHint
}
InlayHintResolveProvider resolves additional details for an inlay hint. This allows for lazy resolution of hint properties.
type InlayHintsProvider ¶
type InlayHintsProvider interface {
// ProvideInlayHints returns inlay hints for the given range in the document.
// Returns nil or empty slice if no hints are available.
ProvideInlayHints(uri, content string, rng Range) []InlayHint
}
InlayHintsProvider provides inlay hints for a document. Inlay hints show inline annotations like parameter names or inferred types.
type InlineCompletionContext ¶
type InlineCompletionContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
// Position is where inline completion was requested (UTF-8 offset).
Position Position
// TriggerKind indicates how inline completion was triggered.
TriggerKind InlineCompletionTriggerKind
// SelectedCompletionInfo contains information about the currently selected item
// in the autocomplete widget if it is visible.
SelectedCompletionInfo *SelectedCompletionInfo
}
InlineCompletionContext provides context for an inline completion request.
type InlineCompletionItem ¶
type InlineCompletionItem struct {
// InsertText is the text to insert.
// If omitted, the filterText is used.
InsertText string
// FilterText is used for filtering inline completions.
// If omitted, the insertText is used.
FilterText string
// Range is the range to replace (UTF-8 offsets).
// If omitted, the current word range is used.
Range *Range
// Command is an optional command to execute after inserting.
Command *Command
}
InlineCompletionItem represents a single inline completion suggestion. Inline completions are typically used for AI-powered code suggestions that appear as ghost text in the editor.
type InlineCompletionList ¶
type InlineCompletionList struct {
// Items are the inline completion items.
Items []InlineCompletionItem
}
InlineCompletionList represents a list of inline completion items.
type InlineCompletionProvider ¶
type InlineCompletionProvider interface {
// ProvideInlineCompletions returns inline completion items for the given context.
// Returns nil or empty list if no inline completions are available.
ProvideInlineCompletions(ctx InlineCompletionContext) *InlineCompletionList
}
InlineCompletionProvider provides inline completion suggestions. This is typically used for AI-powered code suggestions.
type InlineCompletionTriggerKind ¶
type InlineCompletionTriggerKind int
InlineCompletionTriggerKind defines how an inline completion was triggered.
const ( // InlineCompletionTriggerKindInvoked means inline completion was explicitly requested. InlineCompletionTriggerKindInvoked InlineCompletionTriggerKind = 0 // InlineCompletionTriggerKindAutomatic means inline completion was triggered automatically. InlineCompletionTriggerKindAutomatic InlineCompletionTriggerKind = 1 )
type InsertTextFormat ¶
type InsertTextFormat int
InsertTextFormat defines how the insert text should be interpreted.
const ( // InsertTextFormatPlainText means the insert text is plain text. InsertTextFormatPlainText InsertTextFormat = 1 // InsertTextFormatSnippet means the insert text is a snippet. InsertTextFormatSnippet InsertTextFormat = 2 )
type Location ¶
type Location struct {
// URI is the resource identifier (file path, URL, etc.)
URI string
// Range is the text range within the resource
Range Range
}
Location represents a location in a resource (file, document, etc.) with a URI and range.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#location Protocol: { uri: DocumentUri, range: Range }
type LocationLink ¶
type LocationLink struct {
// OriginSelectionRange is the range in the origin document that is linked (optional)
OriginSelectionRange *Range
// TargetURI is the URI of the target resource
TargetURI string
// TargetRange is the full range of the target symbol (including comments, etc.)
TargetRange Range
// TargetSelectionRange is the range that should be selected and revealed (e.g., symbol name)
TargetSelectionRange Range
}
LocationLink represents a link between two locations, typically for navigation features. The origin is where the user initiated the action, and the target is where to navigate.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#locationLink Protocol: { originSelectionRange?: Range, targetUri: DocumentUri, targetRange: Range, targetSelectionRange: Range } Used for "Go to Definition" with better UX than plain Location.
func (LocationLink) IsValid ¶
func (ll LocationLink) IsValid() bool
IsValid returns true if the target URI is non-empty and ranges are valid
type ParameterInformation ¶
type ParameterInformation struct {
// Label is the parameter label (can be a substring of the signature label).
Label string
// Documentation provides documentation for this parameter.
Documentation string
}
ParameterInformation represents a parameter of a callable signature.
type Position ¶
type Position struct {
// Line is the zero-based line number (compatible with LSP spec)
Line int
// Character is the zero-based UTF-8 byte offset within the line
// (LSP spec uses UTF-16 code units; conversion happens in adapters)
Character int
}
Position represents a position in a text document using zero-based line and UTF-8 byte offset.
IMPORTANT: Unlike LSP protocol Position (which uses UTF-16 code units per the spec), this core type uses UTF-8 byte offsets for natural Go string indexing. Use adapter functions to convert between core and protocol types at API boundaries.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#position Protocol Position uses UTF-16 code units: { line: uinteger, character: uinteger } Core Position uses UTF-8 byte offsets: { Line: int, Character: int }
func ByteOffsetToPosition ¶
ByteOffsetToPosition converts an absolute byte offset in a document to a Position. This is useful for converting absolute byte positions (e.g., from parsers) to line/character positions compatible with LSP.
The returned Position uses UTF-8 byte offsets (core format). Use adapters to convert to UTF-16 code units for LSP protocol messages.
Note: Positions are zero-based per LSP specification.
type PrepareRenameProvider ¶
type PrepareRenameProvider interface {
// PrepareRename checks if rename is valid at the position.
// Returns the range of the symbol to rename, or nil if not possible.
PrepareRename(uri, content string, position Position) *Range
}
PrepareRenameProvider checks if rename is possible at a position.
type Range ¶
Range represents a text range in a document with start and end positions.
LSP Specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.16/specification/#range Protocol: { start: Position, end: Position } Both start and end positions use UTF-8 offsets in core (UTF-16 in protocol).
type RangeFormattingProvider ¶
type RangeFormattingProvider interface {
// ProvideRangeFormatting returns edits to format a range in the document.
ProvideRangeFormatting(uri, content string, r Range, options FormattingOptions) []TextEdit
}
RangeFormattingProvider provides range formatting.
type RangesFormattingProvider ¶
type RangesFormattingProvider interface {
// ProvideRangesFormatting returns edits to format multiple ranges in the document.
ProvideRangesFormatting(uri, content string, ranges []Range, options FormattingOptions) []TextEdit
}
RangesFormattingProvider provides formatting for multiple ranges. This is more efficient than formatting each range individually.
@since 3.18.0
type ReferenceContext ¶
type ReferenceContext struct {
// IncludeDeclaration indicates whether the declaration should be included in the results.
IncludeDeclaration bool
}
ReferenceContext specifies additional information when finding references.
type ReferencesProvider ¶
type ReferencesProvider interface {
// FindReferences returns all references to the symbol at the given position.
// Returns nil or empty slice if no references are found.
FindReferences(uri, content string, position Position, context ReferenceContext) []Location
}
ReferencesProvider provides references to a symbol. This finds all locations where a symbol is used.
type RenameContext ¶
type RenameContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
// Position is where rename was requested (UTF-8 offset).
Position Position
// NewName is the new name for the symbol.
NewName string
}
RenameContext provides context for a rename operation.
type RenameFile ¶
type RenameFile struct {
// OldURI is the old resource URI.
OldURI string
// NewURI is the new resource URI.
NewURI string
// Options contains additional options for renaming the file.
Options *RenameFileOptions
}
RenameFile represents an operation to rename a file.
type RenameFileOptions ¶
type RenameFileOptions struct {
// Overwrite existing file if it exists. Overwrite wins over ignoreIfExists.
Overwrite bool
// IgnoreIfExists will not rename the file if the new URI already exists.
IgnoreIfExists bool
}
RenameFileOptions contains options for renaming a file.
type RenameProvider ¶
type RenameProvider interface {
// ProvideRename returns a workspace edit to rename a symbol.
// Returns nil if rename is not possible.
ProvideRename(ctx RenameContext) *WorkspaceEdit
}
RenameProvider provides rename operations.
type SelectedCompletionInfo ¶
type SelectedCompletionInfo struct {
// Range is the range that will be replaced (UTF-8 offsets).
Range Range
// Text is the text the range will be replaced with.
Text string
}
SelectedCompletionInfo contains information about a selected completion item.
type SelectionRange ¶
type SelectionRange struct {
// Range is the range of this selection range.
Range Range
// Parent is the parent selection range containing this range.
// This forms a hierarchy of selection ranges from narrow to broad.
Parent *SelectionRange
}
SelectionRange represents a range that can be selected in a text document. Selection ranges allow for smart expand/shrink selection functionality. Uses UTF-8 byte offsets for the range.
type SelectionRangeProvider ¶
type SelectionRangeProvider interface {
// ProvideSelectionRanges returns selection ranges for the given positions.
// Returns nil or empty slice if no selection ranges are available.
ProvideSelectionRanges(uri, content string, positions []Position) []SelectionRange
}
SelectionRangeProvider provides selection ranges for a document. Selection ranges enable smart expand/shrink selection in editors.
type SignatureHelp ¶
type SignatureHelp struct {
// Signatures are the available signatures.
Signatures []SignatureInformation
// ActiveSignature is the index of the active signature.
ActiveSignature *int
// ActiveParameter is the index of the active parameter in the active signature.
ActiveParameter *int
}
SignatureHelp represents signature help information.
type SignatureHelpContext ¶
type SignatureHelpContext struct {
// URI is the document URI.
URI string
// Content is the document content.
Content string
// Position is where signature help was requested (UTF-8 offset).
Position Position
// TriggerCharacter is the character that triggered signature help (if any).
TriggerCharacter string
// IsRetrigger indicates if this is a retrigger.
IsRetrigger bool
}
SignatureHelpContext provides context for signature help.
type SignatureHelpProvider ¶
type SignatureHelpProvider interface {
// ProvideSignatureHelp returns signature help for the given context.
// Returns nil if no signature help is available.
ProvideSignatureHelp(ctx SignatureHelpContext) *SignatureHelp
}
SignatureHelpProvider provides signature help.
type SignatureInformation ¶
type SignatureInformation struct {
// Label is the signature label.
Label string
// Documentation provides documentation for this signature.
Documentation string
// Parameters are the parameters of this signature.
Parameters []ParameterInformation
// ActiveParameter is the index of the active parameter.
ActiveParameter *int
}
SignatureInformation represents a callable signature.
type SymbolKind ¶
type SymbolKind int
SymbolKind defines the kind of a symbol.
const ( SymbolKindFile SymbolKind = 1 SymbolKindModule SymbolKind = 2 SymbolKindNamespace SymbolKind = 3 SymbolKindPackage SymbolKind = 4 SymbolKindClass SymbolKind = 5 SymbolKindMethod SymbolKind = 6 SymbolKindProperty SymbolKind = 7 SymbolKindField SymbolKind = 8 SymbolKindConstructor SymbolKind = 9 SymbolKindEnum SymbolKind = 10 SymbolKindInterface SymbolKind = 11 SymbolKindFunction SymbolKind = 12 SymbolKindVariable SymbolKind = 13 SymbolKindConstant SymbolKind = 14 SymbolKindString SymbolKind = 15 SymbolKindNumber SymbolKind = 16 SymbolKindBoolean SymbolKind = 17 SymbolKindArray SymbolKind = 18 SymbolKindObject SymbolKind = 19 SymbolKindKey SymbolKind = 20 SymbolKindNull SymbolKind = 21 SymbolKindEnumMember SymbolKind = 22 SymbolKindStruct SymbolKind = 23 SymbolKindEvent SymbolKind = 24 SymbolKindOperator SymbolKind = 25 SymbolKindTypeParameter SymbolKind = 26 )
type SymbolTag ¶
type SymbolTag int
SymbolTag defines tags for symbols.
const ( // SymbolTagDeprecated indicates the symbol is deprecated. SymbolTagDeprecated SymbolTag = 1 )
type TextDocumentEdit ¶
type TextDocumentEdit struct {
// TextDocument identifies the document to change.
TextDocument VersionedTextDocumentIdentifier
// Edits is the list of edits to apply to the document.
Edits []TextEdit
}
TextDocumentEdit represents edits to a single text document.
type TextEdit ¶
type TextEdit struct {
// Range is the range of text to be replaced.
Range Range
// NewText is the string to replace the range with.
NewText string
}
TextEdit represents a textual edit to a document. The range and replacement text use UTF-8 byte offsets.
type VersionedTextDocumentIdentifier ¶
type VersionedTextDocumentIdentifier struct {
// URI is the text document's URI.
URI string
// Version is the version number of the document.
// Null indicates that the version is not known.
Version *int
}
VersionedTextDocumentIdentifier identifies a specific version of a text document.
type WorkspaceEdit ¶
type WorkspaceEdit struct {
// Changes maps document URIs to arrays of text edits.
Changes map[string][]TextEdit
// DocumentChanges is the preferred way to specify edits.
// If provided, Changes should be ignored.
DocumentChanges []interface{} // TextDocumentEdit | CreateFile | RenameFile | DeleteFile
// ChangeAnnotations maps annotation IDs to change annotations.
ChangeAnnotations map[string]ChangeAnnotation
}
WorkspaceEdit represents changes to many resources managed in the workspace.
type WorkspaceSymbol ¶
type WorkspaceSymbol struct {
// Name is the name of this symbol.
Name string
// Kind is the kind of this symbol.
Kind SymbolKind
// Tags are tags for this symbol.
Tags []SymbolTag
// ContainerName is an optional container name (e.g., the class name for a method).
ContainerName string
// Location is where this symbol is defined.
Location Location
// Data is arbitrary data preserved between workspace/symbol and workspaceSymbol/resolve.
Data interface{}
}
WorkspaceSymbol represents information about a symbol across the entire workspace. Unlike DocumentSymbol which is for a single document, this can represent symbols in any file in the workspace.
type WorkspaceSymbolParams ¶
type WorkspaceSymbolParams struct {
// Query is a non-empty query string to search for.
// The query is used to filter symbols.
Query string
}
WorkspaceSymbolParams are parameters for a workspace symbol request.
type WorkspaceSymbolProvider ¶
type WorkspaceSymbolProvider interface {
// ProvideWorkspaceSymbols returns symbols matching the query across the workspace.
// Returns nil or empty slice if no symbols match the query.
ProvideWorkspaceSymbols(query string) []WorkspaceSymbol
}
WorkspaceSymbolProvider provides workspace-wide symbol search. Unlike DocumentSymbolProvider which returns symbols for a single document, this searches across the entire workspace.