Documentation ¶
Index ¶
- Constants
- Variables
- func ClientCapabilities(ctx context.Context) (lsp.ClientCapabilities, error)
- func ClientName(ctx context.Context) (string, bool)
- func Command(cmd lang.Command) (lsp.Command, error)
- func ContentChange(chEvent lsp.TextDocumentContentChangeEvent) filesystem.DocumentChange
- func ContextWithClientName(ctx context.Context, namePtr *string) context.Context
- func DocumentChanges(events []lsp.TextDocumentContentChangeEvent, f File) (filesystem.DocumentChanges, error)
- func DocumentSymbols(sbs []decoder.Symbol, caps lsp.DocumentSymbolClientCapabilities) []lsp.DocumentSymbol
- func FileFromDocumentItem(doc lsp.TextDocumentItem) *file
- func FileHandlerFromDirPath(dirPath string) *fileHandler
- func FileHandlerFromDirURI(dirUri lsp.DocumentURI) *fileHandler
- func FileHandlerFromDocumentURI(docUri lsp.DocumentURI) *fileHandler
- func FileHandlerFromPath(path string) *fileHandler
- func FilePositionFromDocumentPosition(params lsp.TextDocumentPositionParams, f File) (*filePosition, error)
- func HCLDiagsToLSP(hclDiags hcl.Diagnostics, source string) []lsp.Diagnostic
- func HCLPosToLSP(pos hcl.Pos) lsp.Position
- func HCLRangeToLSP(rng hcl.Range) lsp.Range
- func HCLSeverityToLSP(severity hcl.DiagnosticSeverity) lsp.DiagnosticSeverity
- func HoverData(data *lang.HoverData, cc lsp.TextDocumentClientCapabilities) *lsp.Hover
- func Links(links []lang.Link, caps lsp.DocumentLinkClientCapabilities) []lsp.DocumentLink
- func RefOriginsToLocations(origins decoder.ReferenceOrigins) []lsp.Location
- func RefTargetsToLocationLinks(targets decoder.ReferenceTargets, linkSupport bool) interface{}
- func SetClientCapabilities(ctx context.Context, caps *lsp.ClientCapabilities) error
- func SetClientName(ctx context.Context, name string) error
- func TextEditsFromDocumentChanges(changes filesystem.DocumentChanges) []lsp.TextEdit
- func VersionedFileHandler(doc lsp.VersionedTextDocumentIdentifier) *versionedFileHandler
- func WithClientCapabilities(ctx context.Context, caps *lsp.ClientCapabilities) context.Context
- func WorkspaceSymbols(sbs []decoder.Symbol, caps *lsp.WorkspaceSymbolClientCapabilities) []lsp.SymbolInformation
- type CodeActions
- type DirHandler
- type File
- type FileHandler
- type LanguageID
- type SemanticTokensClientCapabilities
- type TokenEncoder
- type TokenModifier
- type TokenModifiers
- type TokenType
- type TokenTypes
Constants ¶
View Source
const ( // Types predefined in LSP spec TokenTypeClass TokenType = "class" TokenTypeComment TokenType = "comment" TokenTypeEnum TokenType = "enum" TokenTypeEnumMember TokenType = "enumMember" TokenTypeEvent TokenType = "event" TokenTypeFunction TokenType = "function" TokenTypeInterface TokenType = "interface" TokenTypeKeyword TokenType = "keyword" TokenTypeMacro TokenType = "macro" TokenTypeMethod TokenType = "method" TokenTypeModifier TokenType = "modifier" TokenTypeNamespace TokenType = "namespace" TokenTypeNumber TokenType = "number" TokenTypeOperator TokenType = "operator" TokenTypeParameter TokenType = "parameter" TokenTypeProperty TokenType = "property" TokenTypeRegexp TokenType = "regexp" TokenTypeString TokenType = "string" TokenTypeStruct TokenType = "struct" TokenTypeType TokenType = "type" TokenTypeTypeParameter TokenType = "typeParameter" TokenTypeVariable TokenType = "variable" // Modifiers predefined in LSP spec TokenModifierDeclaration TokenModifier = "declaration" TokenModifierDefinition TokenModifier = "definition" TokenModifierReadonly TokenModifier = "readonly" TokenModifierStatic TokenModifier = "static" TokenModifierDeprecated TokenModifier = "deprecated" TokenModifierAbstract TokenModifier = "abstract" TokenModifierAsync TokenModifier = "async" TokenModifierModification TokenModifier = "modification" TokenModifierDocumentation TokenModifier = "documentation" TokenModifierDefaultLibrary TokenModifier = "defaultLibrary" )
View Source
const (
// SourceFormatAllTerraform is a Terraform specific format code action.
SourceFormatAllTerraform = "source.formatAll.terraform"
)
Variables ¶
View Source
var ( // `source.formatAll`: Generic format code action. // We do not register this for terraform to allow fine grained selection of actions. // A user should be able to set `source.formatAll` to true, and source.formatAll.terraform to false to allow all // files to be formatted, but not terraform files (or vice versa). SupportedCodeActions = CodeActions{ SourceFormatAllTerraform: true, } )
Functions ¶
func ClientCapabilities ¶
func ClientCapabilities(ctx context.Context) (lsp.ClientCapabilities, error)
func ContentChange ¶
func ContentChange(chEvent lsp.TextDocumentContentChangeEvent) filesystem.DocumentChange
func ContextWithClientName ¶
func DocumentChanges ¶
func DocumentChanges(events []lsp.TextDocumentContentChangeEvent, f File) (filesystem.DocumentChanges, error)
func DocumentSymbols ¶
func DocumentSymbols(sbs []decoder.Symbol, caps lsp.DocumentSymbolClientCapabilities) []lsp.DocumentSymbol
func FileFromDocumentItem ¶
func FileFromDocumentItem(doc lsp.TextDocumentItem) *file
func FileHandlerFromDirPath ¶
func FileHandlerFromDirPath(dirPath string) *fileHandler
func FileHandlerFromDirURI ¶
func FileHandlerFromDirURI(dirUri lsp.DocumentURI) *fileHandler
func FileHandlerFromDocumentURI ¶
func FileHandlerFromDocumentURI(docUri lsp.DocumentURI) *fileHandler
func FileHandlerFromPath ¶
func FileHandlerFromPath(path string) *fileHandler
func FilePositionFromDocumentPosition ¶
func FilePositionFromDocumentPosition(params lsp.TextDocumentPositionParams, f File) (*filePosition, error)
func HCLDiagsToLSP ¶
func HCLDiagsToLSP(hclDiags hcl.Diagnostics, source string) []lsp.Diagnostic
func HCLPosToLSP ¶
func HCLRangeToLSP ¶
func HCLSeverityToLSP ¶
func HCLSeverityToLSP(severity hcl.DiagnosticSeverity) lsp.DiagnosticSeverity
func Links ¶
func Links(links []lang.Link, caps lsp.DocumentLinkClientCapabilities) []lsp.DocumentLink
func RefOriginsToLocations ¶
func RefOriginsToLocations(origins decoder.ReferenceOrigins) []lsp.Location
func RefTargetsToLocationLinks ¶
func RefTargetsToLocationLinks(targets decoder.ReferenceTargets, linkSupport bool) interface{}
func SetClientCapabilities ¶
func SetClientCapabilities(ctx context.Context, caps *lsp.ClientCapabilities) error
func TextEditsFromDocumentChanges ¶
func TextEditsFromDocumentChanges(changes filesystem.DocumentChanges) []lsp.TextEdit
func VersionedFileHandler ¶
func VersionedFileHandler(doc lsp.VersionedTextDocumentIdentifier) *versionedFileHandler
func WithClientCapabilities ¶
func WorkspaceSymbols ¶
func WorkspaceSymbols(sbs []decoder.Symbol, caps *lsp.WorkspaceSymbolClientCapabilities) []lsp.SymbolInformation
Types ¶
type CodeActions ¶
type CodeActions map[lsp.CodeActionKind]bool
func (CodeActions) AsSlice ¶
func (c CodeActions) AsSlice() []lsp.CodeActionKind
func (CodeActions) Only ¶
func (ca CodeActions) Only(only []lsp.CodeActionKind) CodeActions
type DirHandler ¶
type FileHandler ¶
type LanguageID ¶
type LanguageID string
LanguageID represents the coding language of a file
const ( Terraform LanguageID = "demo" Tfvars LanguageID = "demo-vars" )
func (LanguageID) String ¶
func (l LanguageID) String() string
type SemanticTokensClientCapabilities ¶
type SemanticTokensClientCapabilities struct {
lsp.SemanticTokensClientCapabilities
}
func (SemanticTokensClientCapabilities) FullRequest ¶
func (c SemanticTokensClientCapabilities) FullRequest() bool
type TokenEncoder ¶
type TokenEncoder struct { Lines source.Lines Tokens []lang.SemanticToken ClientCaps lsp.SemanticTokensClientCapabilities }
func (*TokenEncoder) Encode ¶
func (te *TokenEncoder) Encode() []uint32
type TokenModifier ¶
type TokenModifier string
type TokenModifiers ¶
type TokenModifiers []TokenModifier
func TokenModifiersLegend ¶
func TokenModifiersLegend(clientSupported []string) TokenModifiers
func (TokenModifiers) AsStrings ¶
func (tm TokenModifiers) AsStrings() []string
func (TokenModifiers) BitMask ¶
func (tm TokenModifiers) BitMask(declaredModifiers TokenModifiers) int
type TokenTypes ¶
type TokenTypes []TokenType
func TokenTypesLegend ¶
func TokenTypesLegend(clientSupported []string) TokenTypes
func (TokenTypes) AsStrings ¶
func (tt TokenTypes) AsStrings() []string
func (TokenTypes) Index ¶
func (tt TokenTypes) Index(tokenType TokenType) int
Source Files ¶
- client_capabilities.go
- client_name.go
- code_actions.go
- command.go
- completion.go
- diagnostics.go
- dir_handler.go
- doc.go
- document_links.go
- file.go
- file_change.go
- file_handler.go
- hover.go
- language_id.go
- location_links.go
- locations.go
- markup_content.go
- position.go
- range.go
- semantic_tokens.go
- symbols.go
- text_edits.go
- token_encoder.go
- token_types.go
Click to show internal directories.
Click to hide internal directories.