lsp

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

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 added in v0.24.0

func ClientCapabilities(ctx context.Context) (lsp.ClientCapabilities, error)

func ClientName added in v0.24.0

func ClientName(ctx context.Context) (string, bool)

func Command added in v0.24.0

func Command(cmd lang.Command) (lsp.Command, error)

func ContentChange added in v0.6.0

func ContextWithClientName added in v0.24.0

func ContextWithClientName(ctx context.Context, namePtr *string) context.Context

func DocumentChanges added in v0.6.0

func DocumentSymbols added in v0.15.0

func FileFromDocumentItem

func FileFromDocumentItem(doc lsp.TextDocumentItem) *file

func FileHandlerFromDirPath added in v0.4.0

func FileHandlerFromDirPath(dirPath string) *fileHandler

func FileHandlerFromDirURI added in v0.4.0

func FileHandlerFromDirURI(dirUri lsp.DocumentURI) *fileHandler

func FileHandlerFromDocumentURI added in v0.4.0

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 added in v0.10.0

func HCLDiagsToLSP(hclDiags hcl.Diagnostics, source string) []lsp.Diagnostic

func HCLPosToLSP added in v0.20.0

func HCLPosToLSP(pos hcl.Pos) lsp.Position

func HCLRangeToLSP added in v0.7.0

func HCLRangeToLSP(rng hcl.Range) lsp.Range

func HCLSeverityToLSP added in v0.8.0

func HCLSeverityToLSP(severity hcl.DiagnosticSeverity) lsp.DiagnosticSeverity

func HoverData added in v0.10.0

func RefOriginsToLocations added in v0.19.0

func RefOriginsToLocations(origins decoder.ReferenceOrigins) []lsp.Location
func RefTargetsToLocationLinks(targets decoder.ReferenceTargets, linkSupport bool) interface{}

func SetClientCapabilities added in v0.24.0

func SetClientCapabilities(ctx context.Context, caps *lsp.ClientCapabilities) error

func SetClientName added in v0.24.0

func SetClientName(ctx context.Context, name string) error

func TextEditsFromDocumentChanges added in v0.11.0

func TextEditsFromDocumentChanges(changes filesystem.DocumentChanges) []lsp.TextEdit

func ToCompletionList added in v0.10.0

func ToCompletionList(candidates lang.Candidates, caps lsp.TextDocumentClientCapabilities) lsp.CompletionList

func VersionedFileHandler

func VersionedFileHandler(doc lsp.VersionedTextDocumentIdentifier) *versionedFileHandler

func WithClientCapabilities added in v0.24.0

func WithClientCapabilities(ctx context.Context, caps *lsp.ClientCapabilities) context.Context

func WorkspaceSymbols added in v0.24.0

Types

type CodeActions added in v0.21.0

type CodeActions map[lsp.CodeActionKind]bool

func (CodeActions) AsSlice added in v0.21.0

func (c CodeActions) AsSlice() []lsp.CodeActionKind

func (CodeActions) Only added in v0.21.0

func (ca CodeActions) Only(only []lsp.CodeActionKind) CodeActions

type DirHandler added in v0.11.0

type DirHandler interface {
	Dir() string
	URI() string
}

type File

type File interface {
	URI() string
	FullPath() string
	Dir() string
	Filename() string
	Lines() source.Lines
	LanguageID() string
}

type FileHandler

type FileHandler interface {
	Valid() bool
	Dir() string
	IsDir() bool
	Filename() string
	DocumentURI() lsp.DocumentURI
	URI() string
}

type LanguageID added in v0.18.0

type LanguageID string

LanguageID represents the coding language of a file

const (
	Terraform LanguageID = "terraform"
	Tfvars    LanguageID = "terraform-vars"
)

func (LanguageID) String added in v0.18.0

func (l LanguageID) String() string

type SemanticTokensClientCapabilities added in v0.12.0

type SemanticTokensClientCapabilities struct {
	lsp.SemanticTokensClientCapabilities
}

func (SemanticTokensClientCapabilities) FullRequest added in v0.12.0

func (c SemanticTokensClientCapabilities) FullRequest() bool

type TokenEncoder added in v0.12.0

type TokenEncoder struct {
	Lines      source.Lines
	Tokens     []lang.SemanticToken
	ClientCaps lsp.SemanticTokensClientCapabilities
}

func (*TokenEncoder) Encode added in v0.12.0

func (te *TokenEncoder) Encode() []uint32

type TokenModifier added in v0.12.0

type TokenModifier string

type TokenModifiers added in v0.12.0

type TokenModifiers []TokenModifier

func TokenModifiersLegend added in v0.12.0

func TokenModifiersLegend(clientSupported []string) TokenModifiers

func (TokenModifiers) AsStrings added in v0.12.0

func (tm TokenModifiers) AsStrings() []string

func (TokenModifiers) BitMask added in v0.12.0

func (tm TokenModifiers) BitMask(declaredModifiers TokenModifiers) int

type TokenType added in v0.12.0

type TokenType string

type TokenTypes added in v0.12.0

type TokenTypes []TokenType

func TokenTypesLegend added in v0.12.0

func TokenTypesLegend(clientSupported []string) TokenTypes

func (TokenTypes) AsStrings added in v0.12.0

func (tt TokenTypes) AsStrings() []string

func (TokenTypes) Index added in v0.12.0

func (tt TokenTypes) Index(tokenType TokenType) int

Jump to

Keyboard shortcuts

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