Documentation
¶
Index ¶
- Constants
- Variables
- func FromPtr[T any](p *T) T
- func GetSimplifiedTypeString(typ types.Type) string
- func HasSpxResourceNameTypeParams(fun *types.Func) (has bool)
- func IsInSpxPkg(obj types.Object) bool
- func IsRangesOverlap(a, b Range) bool
- func IsSpxEventHandlerFuncName(name string) bool
- func IsSpxPropertyNameType(typ types.Type) bool
- func IsSpxResourceNameType(typ types.Type) bool
- func PosAt(proj *xgo.Project, astFile *xgoast.File, position Position) xgotoken.Pos
- func PositionOffset(content []byte, position Position) int
- func PropertyTargetNamedTypeForCall(typeInfo *xgotypes.Info, call *xgoast.CallExpr, spxFile, mainSpxFile string) *types.Named
- func SelectorTypeNameForIdent(proj *xgo.Project, ident *xgoast.Ident) string
- func ToPosition(proj *xgo.Project, astFile *xgoast.File, position Position) xgotoken.Position
- func ToPtr[T any](v T) *T
- func UTF16Len(s string) int
- func UTF16PosToUTF8Offset(s string, utf16Pos int) int
- func UnmarshalJSON(msg json.RawMessage, v any) error
- type CancelParams
- type CompletionItem
- type CompletionItemDatadeprecated
- type CompletionItemKind
- type CompletionParams
- type DeclarationParams
- type DefinitionParams
- type Diagnostic
- type DidChangeTextDocumentParams
- type DidCloseTextDocumentParams
- type DidOpenTextDocumentParams
- type DidSaveTextDocumentParams
- type DocumentDiagnosticParams
- type DocumentDiagnosticReport
- type DocumentFormattingParams
- type DocumentHighlight
- type DocumentHighlightParams
- type DocumentLink
- type DocumentLinkParams
- type DocumentURI
- type ExecuteCommandParams
- type FileChange
- type FileMapGetter
- type FullDocumentDiagnosticReport
- type Hover
- type HoverParams
- type ImplementationParams
- type InitializeParams
- type InitializeResult
- type InitializedParams
- type InlayHint
- type InlayHintKind
- type InlayHintParams
- type InsertTextFormat
- type Location
- type MarkupContent
- type MessageReplier
- type Or_CompletionItem_documentation
- type ParameterInformation
- type Position
- type PrepareRenameParams
- type PropertyRenamedParams
- type PublishDiagnosticsParams
- type Range
- func RangeForASTFileNode(proj *xgo.Project, astFile *xgoast.File, node xgoast.Node) Range
- func RangeForASTFilePosition(proj *xgo.Project, astFile *xgoast.File, position xgotoken.Position) Range
- func RangeForNode(proj *xgo.Project, node xgoast.Node) Range
- func RangeForPos(proj *xgo.Project, pos xgotoken.Pos) Range
- func RangeForPosEnd(proj *xgo.Project, pos, end xgotoken.Pos) Range
- type ReferenceContext
- type ReferenceParams
- type RelatedFullDocumentDiagnosticReport
- type RenameParams
- type Scheduler
- type SemanticTokenModifiers
- type SemanticTokenTypes
- type SemanticTokens
- type SemanticTokensParams
- type Server
- type ServerCapabilities
- type ServerInfo
- type SignatureHelp
- type SignatureHelpParams
- type SignatureInformation
- type SpxBackdropResource
- type SpxBackdropResourceID
- type SpxColorInputValuedeprecated
- type SpxDefinition
- func GetSpxDefinitionForBuiltinObj(obj types.Object) SpxDefinition
- func GetSpxDefinitionForConst(c *types.Const, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
- func GetSpxDefinitionForFunc(fun *types.Func, recvTypeName string, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
- func GetSpxDefinitionForPkg(pkgName *types.PkgName, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
- func GetSpxDefinitionForType(typeName *types.TypeName, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
- func GetSpxDefinitionForVar(v *types.Var, selectorTypeName string, forceVar bool, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
- func GetSpxDefinitionsForPkg(pkg *types.Package, pkgDoc *pkgdoc.PkgDoc) (defs []SpxDefinition)
- type SpxDefinitionIdentifierdeprecated
- type SpxGetDefinitionsParamsdeprecated
- type SpxGetInputSlotsParamsdeprecated
- type SpxInputdeprecated
- type SpxInputKinddeprecated
- type SpxInputSlotdeprecated
- type SpxInputSlotAcceptdeprecated
- type SpxInputSlotKinddeprecated
- type SpxInputTypedeprecated
- type SpxInputTypeSpxColorConstructordeprecated
- type SpxReferencePkg
- type SpxRenameResourceParamsdeprecated
- type SpxResourceContextURIdeprecated
- type SpxResourceID
- type SpxResourceIdentifierdeprecated
- type SpxResourceRef
- type SpxResourceRefDocumentLinkDatadeprecated
- type SpxResourceRefKind
- type SpxResourceSet
- func (set *SpxResourceSet) Backdrop(name string) *SpxBackdropResource
- func (set *SpxResourceSet) Contains(id SpxResourceID) bool
- func (set *SpxResourceSet) Sound(name string) *SpxSoundResource
- func (set *SpxResourceSet) Sprite(name string) *SpxSpriteResource
- func (set *SpxResourceSet) Widget(name string) *SpxWidgetResource
- type SpxResourceURIdeprecated
- type SpxSoundResource
- type SpxSoundResourceID
- type SpxSpriteAnimationResource
- type SpxSpriteAnimationResourceID
- type SpxSpriteCostumeResource
- type SpxSpriteCostumeResourceID
- type SpxSpriteResource
- type SpxSpriteResourceID
- type SpxWidgetResource
- type SpxWidgetResourceID
- type TextDocumentIdentifier
- type TextDocumentPositionParams
- type TextEdit
- type TypeDefinitionParams
- type URI
- type WorkspaceDiagnosticParams
- type WorkspaceDiagnosticReport
- type WorkspaceDocumentDiagnosticReport
- type WorkspaceEdit
- type WorkspaceFullDocumentDiagnosticReport
- type XGoCompletionItemData
- type XGoDefinitionIdentifier
- type XGoGetDefinitionsParams
- type XGoGetInputSlotsParams
- type XGoGetPropertiesParams
- type XGoInput
- type XGoInputKind
- type XGoInputSlot
- type XGoInputSlotAccept
- type XGoInputSlotKind
- type XGoInputSpxColorValue
- type XGoInputType
- type XGoInputTypeSpxColorConstructor
- type XGoProperty
- type XGoPropertyKind
- type XGoRenameResourceParams
- type XGoResourceContextURI
- type XGoResourceIdentifier
- type XGoResourceRefDocumentLinkData
- type XGoResourceURI
Constants ¶
const ( CommandXGoRenameResources = "xgo.renameResources" CommandSpxRenameResources = "spx.renameResources" CommandXGoGetInputSlots = "xgo.getInputSlots" CommandSpxGetInputSlots = "spx.getInputSlots" CommandXGoGetProperties = "xgo.getProperties" )
const ( SeverityError = protocol.SeverityError SeverityWarning = protocol.SeverityWarning TextCompletion = protocol.TextCompletion ClassCompletion = protocol.ClassCompletion InterfaceCompletion = protocol.InterfaceCompletion StructCompletion = protocol.StructCompletion VariableCompletion = protocol.VariableCompletion ConstantCompletion = protocol.ConstantCompletion KeywordCompletion = protocol.KeywordCompletion FieldCompletion = protocol.FieldCompletion MethodCompletion = protocol.MethodCompletion PropertyCompletion = protocol.PropertyCompletion FunctionCompletion = protocol.FunctionCompletion ModuleCompletion = protocol.ModuleCompletion DiagnosticFull = protocol.DiagnosticFull Markdown = protocol.Markdown Text = protocol.Text Write = protocol.Write Read = protocol.Read PlainTextTextFormat = protocol.PlainTextTextFormat SnippetTextFormat = protocol.SnippetTextFormat NamespaceType = protocol.NamespaceType TypeType = protocol.TypeType InterfaceType = protocol.InterfaceType StructType = protocol.StructType EnumType = protocol.EnumType EnumMember = protocol.EnumMember VariableType = protocol.VariableType ParameterType = protocol.ParameterType FunctionType = protocol.FunctionType MethodType = protocol.MethodType PropertyType = protocol.PropertyType KeywordType = protocol.KeywordType CommentType = protocol.CommentType StringType = protocol.StringType NumberType = protocol.NumberType OperatorType = protocol.OperatorType LabelType = protocol.LabelType ModDeclaration = protocol.ModDeclaration ModReadonly = protocol.ModReadonly ModStatic = protocol.ModStatic ModDefinition = protocol.ModDefinition ModDefaultLibrary = protocol.ModDefaultLibrary Type = protocol.Type Parameter = protocol.Parameter RequestCancelled = protocol.RequestCancelled )
const ( // Deprecated: use XGoInputSlotKindValue. SpxInputSlotKindValue = XGoInputSlotKindValue // Deprecated: use XGoInputSlotKindAddress. SpxInputSlotKindAddress = XGoInputSlotKindAddress )
const ( // Deprecated: use XGoInputKindInPlace. SpxInputKindInPlace = XGoInputKindInPlace // Deprecated: use XGoInputKindPredefined. SpxInputKindPredefined = XGoInputKindPredefined )
const SpxPkgPath = "github.com/goplus/spx/v2"
SpxPkgPath is the path to the spx package.
Variables ¶
var ( // GeneralSpxDefinitions are general spx definitions. GeneralSpxDefinitions = []SpxDefinition{ { ID: SpxDefinitionIdentifier{Name: ToPtr("for_iterate")}, Overview: "for v in arr {}", Detail: "Iterate within given set", CompletionItemLabel: "for", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "for ${1:v} in ${2:[]} {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("for_iterate_with_index")}, Overview: "for i, v in arr {}", Detail: "Iterate with index within given set", CompletionItemLabel: "for", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "for ${1:i}, ${2:v} in ${3:[]} {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("for_loop_with_condition")}, Overview: "for condition {}", Detail: "Loop with condition", CompletionItemLabel: "for", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "for ${1:true} {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("for_loop_with_range")}, Overview: "for i in start:end {}", Detail: "Loop with range", CompletionItemLabel: "for", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "for ${1:i} in ${2:1}:${3:5} {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("if_statement")}, Overview: "if condition {}", Detail: "If statement", CompletionItemLabel: "if", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "if ${1:true} {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("if_else_statement")}, Overview: "if condition {} else {}", Detail: "If else statement", CompletionItemLabel: "if", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "if ${1:true} {\n\t$2\n} else {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("var_declaration")}, Overview: "var name type", Detail: "Variable declaration, e.g., `var count int`", CompletionItemLabel: "var", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "var ${1:name} $0", CompletionItemInsertTextFormat: SnippetTextFormat, }, } // FileScopeSpxDefinitions are spx definitions that are only available // in file scope. FileScopeSpxDefinitions = []SpxDefinition{ { ID: SpxDefinitionIdentifier{Name: ToPtr("import_declaration")}, Overview: "import \"package\"", Detail: "Import package declaration, e.g., `import \"fmt\"`", CompletionItemLabel: "import", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "import \"${1:package}\"$0", CompletionItemInsertTextFormat: SnippetTextFormat, }, { ID: SpxDefinitionIdentifier{Name: ToPtr("func_declaration")}, Overview: "func name(params) { ... }", Detail: "Function declaration, e.g., `func add(a int, b int) int {}`", CompletionItemLabel: "func", CompletionItemKind: KeywordCompletion, CompletionItemInsertText: "func ${1:name}(${2:params}) ${3:returnType} {\n\t$0\n}", CompletionItemInsertTextFormat: SnippetTextFormat, }, } )
var ( // GetMathPkg returns the math package. GetMathPkg = sync.OnceValue(func() *types.Package { mathPkg, err := internal.Importer.Import("math") if err != nil { panic(fmt.Errorf("failed to import math package: %w", err)) } return mathPkg }) // GetMathPkgSpxDefinitions returns the spx definitions for the math package. GetMathPkgSpxDefinitions = sync.OnceValue(func() []SpxDefinition { mathPkg := GetMathPkg() mathPkgPath := xgoutil.PkgPath(mathPkg) mathPkgDoc, err := pkgdata.GetPkgDoc(mathPkgPath) if err != nil { panic(fmt.Errorf("failed to get math package doc: %w", err)) } return GetSpxDefinitionsForPkg(mathPkg, mathPkgDoc) }) )
var ( // GetSpxPkg returns the spx package. GetSpxPkg = sync.OnceValue(func() *types.Package { spxPkg, err := internal.Importer.Import(SpxPkgPath) if err != nil { panic(fmt.Errorf("failed to import spx package: %w", err)) } return spxPkg }) // GetSpxGameType returns the [spx.Game] type. GetSpxGameType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("Game").Type().(*types.Named) }) // GetSpxBackdropNameType returns the [spx.BackdropName] type. GetSpxBackdropNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("BackdropName").Type().(*types.Alias) }) // GetSpxSpriteType returns the [spx.Sprite] type. GetSpxSpriteType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("Sprite").Type().(*types.Named) }) // GetSpxSpriteImplType returns the [spx.SpriteImpl] type. GetSpxSpriteImplType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("SpriteImpl").Type().(*types.Named) }) // GetSpxSpriteNameType returns the [spx.SpriteName] type. GetSpxSpriteNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("SpriteName").Type().(*types.Alias) }) // GetSpxSpriteCostumeNameType returns the [spx.SpriteCostumeName] type. GetSpxSpriteCostumeNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("SpriteCostumeName").Type().(*types.Alias) }) // GetSpxSpriteAnimationNameType returns the [spx.SpriteAnimationName] type. GetSpxSpriteAnimationNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("SpriteAnimationName").Type().(*types.Alias) }) // GetSpxSoundNameType returns the [spx.SoundName] type. GetSpxSoundNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("SoundName").Type().(*types.Alias) }) // GetSpxWidgetNameType returns the [spx.WidgetName] type. GetSpxWidgetNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("WidgetName").Type().(*types.Alias) }) // GetSpxDirectionType returns the [spx.Direction] type. GetSpxDirectionType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("Direction").Type().(*types.Alias) }) // GetSpxLayerActionType returns the [spx.LayerAction] type. GetSpxLayerActionType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("layerAction").Type().(*types.Named) }) // GetSpxDirActionType returns the [spx.DirLayer] type. GetSpxDirActionType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("dirAction").Type().(*types.Named) }) // GetSpxEffectKindType returns the [spx.EffectKind] type. GetSpxEffectKindType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("EffectKind").Type().(*types.Named) }) // GetSpxKeyType returns the [spx.Key] type. GetSpxKeyType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("Key").Type().(*types.Alias) }) // GetSpxSpecialObjType returns the [spx.SpecialObj] type. GetSpxSpecialObjType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("Edge").Type().(*types.Named) }) // GetSpxRotationStyleType returns the [spx.RotationStyle] type. GetSpxRotationStyleType = sync.OnceValue(func() *types.Named { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("RotationStyle").Type().(*types.Named) }) // GetSpxPropertyNameType returns the [spx.PropertyName] type. GetSpxPropertyNameType = sync.OnceValue(func() *types.Alias { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("PropertyName").Type().(*types.Alias) }) // GetSpxPkgDefinitions returns the spx definitions for the spx package. GetSpxPkgDefinitions = sync.OnceValue(func() []SpxDefinition { spxPkg := GetSpxPkg() spxPkgPath := xgoutil.PkgPath(spxPkg) spxPkgDoc, err := pkgdata.GetPkgDoc(spxPkgPath) if err != nil { panic(fmt.Errorf("failed to get spx package doc: %w", err)) } return GetSpxDefinitionsForPkg(spxPkg, spxPkgDoc) }) // GetSpxHSBFunc returns the [spx.HSB] type. GetSpxHSBFunc = sync.OnceValue(func() *types.Func { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("HSB").(*types.Func) }) // GetSpxHSBAFunc returns the [spx.HSBA] type. GetSpxHSBAFunc = sync.OnceValue(func() *types.Func { spxPkg := GetSpxPkg() return spxPkg.Scope().Lookup("HSBA").(*types.Func) }) )
var GetBuiltinSpxDefinitions = sync.OnceValue(func() []SpxDefinition { names := types.Universe.Names() defs := make([]SpxDefinition, 0, len(names)+len(xgoBuiltinAliases)) for _, name := range names { if _, ok := xgoBuiltinAliases[name]; ok { continue } if obj := types.Universe.Lookup(name); obj != nil && obj.Pkg() == nil { defs = append(defs, GetSpxDefinitionForBuiltinObj(obj)) } } for alias := range xgoBuiltinAliases { def, err := getSpxDefinitionForXGoBuiltinAlias(alias) if err != nil { panic(fmt.Errorf("failed to get spx definition for xgo builtin alias %q: %w", alias, err)) } defs = append(defs, def) } return slices.Clip(defs) })
GetBuiltinSpxDefinitions returns the builtin spx definitions.
Functions ¶
func FromPtr ¶
func FromPtr[T any](p *T) T
FromPtr returns the value from a pointer. It returns the zero value of type T if the pointer is nil.
func GetSimplifiedTypeString ¶
GetSimplifiedTypeString returns the string representation of the given type, with the spx package name omitted while other packages use their short names.
func HasSpxResourceNameTypeParams ¶ added in v0.10.0
HasSpxResourceNameTypeParams reports if a function has parameters of spx resource name types.
func IsInSpxPkg ¶
IsInSpxPkg reports whether the given object is defined in the spx package.
func IsRangesOverlap ¶
IsRangesOverlap reports whether two ranges overlap.
func IsSpxEventHandlerFuncName ¶
IsSpxEventHandlerFuncName reports whether the given function name is an spx event handler function name.
func IsSpxPropertyNameType ¶ added in v0.18.0
IsSpxPropertyNameType reports whether the given type is or is an alias of [spx.PropertyName], resolving alias chains before comparing.
func IsSpxResourceNameType ¶ added in v0.13.0
IsSpxResourceNameType reports whether the given type is a spx resource name type.
func PosAt ¶
PosAt returns the xgotoken.Pos of the given position in the given AST file.
func PositionOffset ¶
PositionOffset converts an LSP position (line, character) to a byte offset in the document. It calculates the offset by:
- Finding the starting byte offset of the requested line
- Adding the character offset within that line, converting from UTF-16 to UTF-8 if needed
Parameters:
- content: The file content as a byte array
- position: The LSP position with line and character numbers (0-based)
Returns the byte offset from the beginning of the document
func PropertyTargetNamedTypeForCall ¶ added in v0.18.0
func PropertyTargetNamedTypeForCall(typeInfo *xgotypes.Info, call *xgoast.CallExpr, spxFile, mainSpxFile string) *types.Named
PropertyTargetNamedTypeForCall resolves the *types.Named that owns the properties being addressed by a call expression.
Resolution rules:
- If call.Fun is a SelectorExpr (e.g. x.Method(...) or getObj().Method(...)), the receiver type is read from typeInfo.Types[sel.X]. Returns nil when the receiver type cannot be resolved or is not a named type. No implicit-receiver fallback is attempted.
- If call.Fun is a bare identifier (implicit receiver), the target type is deduced from the file name: "main.spx" maps to "Game"; any other "TypeName.spx" maps to "TypeName".
spxFile is the file containing the call expression (e.g. "MySprite.spx"). mainSpxFile is the main entry file (e.g. "main.spx").
Returns nil when the target cannot be determined.
func SelectorTypeNameForIdent ¶
SelectorTypeNameForIdent returns the selector type name for the given identifier. It returns empty string if no selector can be inferred.
func ToPosition ¶
ToPosition converts a Position to a xgotoken.Position.
func UTF16PosToUTF8Offset ¶
UTF16PosToUTF8Offset converts a UTF-16 code unit position to a UTF-8 byte offset in the given string.
func UnmarshalJSON ¶
func UnmarshalJSON(msg json.RawMessage, v any) error
UnmarshalJSON unmarshals msg into the variable pointed to by params. In JSONRPC, optional messages may be "null", in which case it is a no-op.
Types ¶
type CancelParams ¶ added in v0.7.0
type CancelParams = protocol.CancelParams
type CompletionItem ¶
type CompletionItem = protocol.CompletionItem
type CompletionItemData
deprecated
type CompletionItemData = XGoCompletionItemData
Deprecated: use XGoCompletionItemData.
type CompletionItemKind ¶
type CompletionItemKind = protocol.CompletionItemKind
type CompletionParams ¶
type CompletionParams = protocol.CompletionParams
type DeclarationParams ¶
type DeclarationParams = protocol.DeclarationParams
type DefinitionParams ¶
type DefinitionParams = protocol.DefinitionParams
type Diagnostic ¶
type Diagnostic = protocol.Diagnostic
type DidChangeTextDocumentParams ¶
type DidChangeTextDocumentParams = protocol.DidChangeTextDocumentParams
type DidCloseTextDocumentParams ¶
type DidCloseTextDocumentParams = protocol.DidCloseTextDocumentParams
type DidOpenTextDocumentParams ¶
type DidOpenTextDocumentParams = protocol.DidOpenTextDocumentParams
type DidSaveTextDocumentParams ¶
type DidSaveTextDocumentParams = protocol.DidSaveTextDocumentParams
type DocumentDiagnosticParams ¶
type DocumentDiagnosticParams = protocol.DocumentDiagnosticParams
type DocumentDiagnosticReport ¶
type DocumentDiagnosticReport = protocol.DocumentDiagnosticReport
type DocumentFormattingParams ¶
type DocumentFormattingParams = protocol.DocumentFormattingParams
type DocumentHighlight ¶
type DocumentHighlight = protocol.DocumentHighlight
type DocumentHighlightParams ¶
type DocumentHighlightParams = protocol.DocumentHighlightParams
type DocumentLink ¶
type DocumentLink = protocol.DocumentLink
type DocumentLinkParams ¶
type DocumentLinkParams = protocol.DocumentLinkParams
type DocumentURI ¶
type DocumentURI = protocol.DocumentURI
type ExecuteCommandParams ¶
type ExecuteCommandParams = protocol.ExecuteCommandParams
type FileChange ¶
type FileChange struct {
Path string
Content []byte
Version int // Version is timestamp in milliseconds
}
FileChange represents a file change.
type FileMapGetter ¶
FileMapGetter is a function that returns a map of file names to [xgo.File]s.
type FullDocumentDiagnosticReport ¶
type FullDocumentDiagnosticReport = protocol.FullDocumentDiagnosticReport
type HoverParams ¶
type HoverParams = protocol.HoverParams
type ImplementationParams ¶
type ImplementationParams = protocol.ImplementationParams
type InitializeParams ¶
type InitializeParams = protocol.InitializeParams
type InitializeResult ¶ added in v0.12.0
type InitializeResult = protocol.InitializeResult
type InitializedParams ¶
type InitializedParams = protocol.InitializedParams
type InlayHintKind ¶
type InlayHintKind = protocol.InlayHintKind
type InlayHintParams ¶
type InlayHintParams = protocol.InlayHintParams
type InsertTextFormat ¶
type InsertTextFormat = protocol.InsertTextFormat
type Location ¶
func DedupeLocations ¶
DedupeLocations deduplicates locations.
type MarkupContent ¶
type MarkupContent = protocol.MarkupContent
type MessageReplier ¶
type MessageReplier interface {
// ReplyMessage sends a message back to the client.
//
// The message can be one of:
// - [jsonrpc2.Response]: sent in response to a call.
// - [jsonrpc2.Notification]: sent for server-initiated notifications.
ReplyMessage(m jsonrpc2.Message) error
}
MessageReplier is an interface for sending messages back to the client.
type Or_CompletionItem_documentation ¶
type Or_CompletionItem_documentation = protocol.Or_CompletionItem_documentation
type ParameterInformation ¶
type ParameterInformation = protocol.ParameterInformation
type PrepareRenameParams ¶
type PrepareRenameParams = protocol.PrepareRenameParams
type PropertyRenamedParams ¶ added in v0.16.2
type PropertyRenamedParams = protocol.PropertyRenamedParams
type PublishDiagnosticsParams ¶
type PublishDiagnosticsParams = protocol.PublishDiagnosticsParams
type Range ¶
func RangeForASTFileNode ¶
RangeForASTFileNode returns the Range for the given node in the given AST file.
func RangeForASTFilePosition ¶
func RangeForASTFilePosition(proj *xgo.Project, astFile *xgoast.File, position xgotoken.Position) Range
RangeForASTFilePosition returns a Range for the given xgotoken.Position in the given AST file.
func RangeForNode ¶
RangeForNode returns the Range for the given node.
func RangeForPos ¶
RangeForPos returns the Range for the given position.
type ReferenceContext ¶
type ReferenceContext = protocol.ReferenceContext
type ReferenceParams ¶
type ReferenceParams = protocol.ReferenceParams
type RelatedFullDocumentDiagnosticReport ¶
type RelatedFullDocumentDiagnosticReport = protocol.RelatedFullDocumentDiagnosticReport
type RenameParams ¶
type RenameParams = protocol.RenameParams
type Scheduler ¶ added in v0.7.0
type Scheduler interface {
// Sched yields the processor, allowing other routines to run.
// "routines" here refers to not just goroutines, but also other tasks, for example, Javascript event loop in browsers.
Sched()
}
Scheduler is an interface for task scheduling.
type SemanticTokenModifiers ¶
type SemanticTokenModifiers = protocol.SemanticTokenModifiers
type SemanticTokenTypes ¶
type SemanticTokenTypes = protocol.SemanticTokenTypes
type SemanticTokens ¶
type SemanticTokens = protocol.SemanticTokens
type SemanticTokensParams ¶
type SemanticTokensParams = protocol.SemanticTokensParams
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the core language server implementation that handles LSP messages.
func New ¶
func New(proj *xgo.Project, replier MessageReplier, fileMapGetter FileMapGetter, scheduler Scheduler) *Server
New creates a new Server instance.
func (*Server) HandleMessage ¶
HandleMessage handles an incoming LSP message.
func (*Server) ModifyFiles ¶
func (s *Server) ModifyFiles(changes []FileChange)
ModifyFiles modifies files in the project.
type ServerCapabilities ¶ added in v0.12.0
type ServerCapabilities = protocol.ServerCapabilities
type ServerInfo ¶ added in v0.12.0
type ServerInfo = protocol.ServerInfo
type SignatureHelp ¶
type SignatureHelp = protocol.SignatureHelp
type SignatureHelpParams ¶
type SignatureHelpParams = protocol.SignatureHelpParams
type SignatureInformation ¶
type SignatureInformation = protocol.SignatureInformation
type SpxBackdropResource ¶
type SpxBackdropResource struct {
ID SpxBackdropResourceID `json:"-"`
Name string `json:"name"`
Path string `json:"path"`
}
SpxBackdropResource represents a backdrop resource in spx.
type SpxBackdropResourceID ¶
type SpxBackdropResourceID struct {
BackdropName string
}
SpxBackdropResourceID is the ID of an spx backdrop resource.
func (SpxBackdropResourceID) ContextURI ¶
func (id SpxBackdropResourceID) ContextURI() SpxResourceContextURI
ContextURI implements SpxResourceID.
func (SpxBackdropResourceID) Name ¶
func (id SpxBackdropResourceID) Name() string
Name implements SpxResourceID.
func (SpxBackdropResourceID) URI ¶
func (id SpxBackdropResourceID) URI() SpxResourceURI
URI implements SpxResourceID.
type SpxColorInputValue
deprecated
type SpxColorInputValue = XGoInputSpxColorValue
Deprecated: use XGoInputSpxColorValue.
type SpxDefinition ¶
type SpxDefinition struct {
// TypeHint represents a type hint for this definition. It may be nil if
// the definition has no associated type.
TypeHint types.Type
ID SpxDefinitionIdentifier
Overview string
Detail string
CompletionItemLabel string
CompletionItemKind CompletionItemKind
CompletionItemInsertText string
CompletionItemInsertTextFormat InsertTextFormat
}
SpxDefinition represents an spx definition.
func GetSpxDefinitionForBuiltinObj ¶
func GetSpxDefinitionForBuiltinObj(obj types.Object) SpxDefinition
GetSpxDefinitionForBuiltinObj returns the spx definition for the given object.
func GetSpxDefinitionForConst ¶
func GetSpxDefinitionForConst(c *types.Const, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
GetSpxDefinitionForConst returns the spx definition for the provided constant.
func GetSpxDefinitionForFunc ¶
func GetSpxDefinitionForFunc(fun *types.Func, recvTypeName string, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
GetSpxDefinitionForFunc returns the spx definition for the provided function.
func GetSpxDefinitionForPkg ¶
func GetSpxDefinitionForPkg(pkgName *types.PkgName, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
GetSpxDefinitionForPkg returns the spx definition for the provided package.
func GetSpxDefinitionForType ¶
func GetSpxDefinitionForType(typeName *types.TypeName, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
GetSpxDefinitionForType returns the spx definition for the provided type.
func GetSpxDefinitionForVar ¶
func GetSpxDefinitionForVar(v *types.Var, selectorTypeName string, forceVar bool, pkgDoc *pkgdoc.PkgDoc) (def SpxDefinition)
GetSpxDefinitionForVar returns the spx definition for the provided variable.
func GetSpxDefinitionsForPkg ¶
func GetSpxDefinitionsForPkg(pkg *types.Package, pkgDoc *pkgdoc.PkgDoc) (defs []SpxDefinition)
GetSpxDefinitionsForPkg returns the spx definitions for the given package.
func (SpxDefinition) CompletionItem ¶
func (def SpxDefinition) CompletionItem() CompletionItem
CompletionItem constructs a CompletionItem from the definition.
func (SpxDefinition) HTML ¶
func (def SpxDefinition) HTML() string
HTML returns the HTML representation of the definition.
type SpxDefinitionIdentifier
deprecated
type SpxDefinitionIdentifier = XGoDefinitionIdentifier
Deprecated: use XGoDefinitionIdentifier.
type SpxGetDefinitionsParams
deprecated
type SpxGetDefinitionsParams = XGoGetDefinitionsParams
Deprecated: use XGoGetDefinitionsParams.
type SpxGetInputSlotsParams
deprecated
type SpxGetInputSlotsParams = XGoGetInputSlotsParams
Deprecated: use XGoGetInputSlotsParams.
type SpxInputKind
deprecated
type SpxInputKind = XGoInputKind
Deprecated: use XGoInputKind.
type SpxInputSlot
deprecated
type SpxInputSlot = XGoInputSlot
Deprecated: use XGoInputSlot.
type SpxInputSlotAccept
deprecated
type SpxInputSlotAccept = XGoInputSlotAccept
Deprecated: use XGoInputSlotAccept.
type SpxInputSlotKind
deprecated
type SpxInputSlotKind = XGoInputSlotKind
Deprecated: use XGoInputSlotKind.
type SpxInputType
deprecated
type SpxInputType = XGoInputType
Deprecated: use XGoInputType.
const ( SpxInputTypeString SpxInputType = XGoInputTypeString SpxInputTypeInteger SpxInputType = XGoInputTypeInteger SpxInputTypeDecimal SpxInputType = XGoInputTypeDecimal SpxInputTypeBoolean SpxInputType = XGoInputTypeBoolean SpxInputTypeUnknown SpxInputType = XGoInputTypeUnknown SpxInputTypeResourceName SpxInputType = XGoInputTypeSpxResourceName SpxInputTypeDirection SpxInputType = XGoInputTypeSpxDirection SpxInputTypeLayerAction SpxInputType = XGoInputTypeSpxLayerAction SpxInputTypeDirAction SpxInputType = XGoInputTypeSpxDirAction SpxInputTypeColor SpxInputType = XGoInputTypeSpxColor SpxInputTypeEffectKind SpxInputType = XGoInputTypeSpxEffectKind SpxInputTypeKey SpxInputType = XGoInputTypeSpxKey SpxInputTypeSpecialObj SpxInputType = XGoInputTypeSpxSpecialObj SpxInputTypeRotationStyle SpxInputType = XGoInputTypeSpxRotationStyle SpxInputTypePropertyName SpxInputType = XGoInputTypeSpxPropertyName )
Deprecated: use XGoInputType*.
type SpxInputTypeSpxColorConstructor
deprecated
type SpxInputTypeSpxColorConstructor = XGoInputTypeSpxColorConstructor
Deprecated: use XGoInputTypeSpxColorConstructor.
const ( SpxInputTypeSpxColorConstructorHSB SpxInputTypeSpxColorConstructor = XGoInputTypeSpxColorConstructorHSB SpxInputTypeSpxColorConstructorHSBA SpxInputTypeSpxColorConstructor = XGoInputTypeSpxColorConstructorHSBA )
Deprecated: use XGoInputTypeSpxColorConstructor*.
type SpxReferencePkg ¶
type SpxReferencePkg struct {
PkgPath string
Pkg *pkgdoc.PkgDoc
Node *xgoast.ImportSpec
}
SpxReferencePkg is a reference to an imported package.
type SpxRenameResourceParams
deprecated
type SpxRenameResourceParams = XGoRenameResourceParams
Deprecated: use XGoRenameResourceParams.
type SpxResourceContextURI
deprecated
type SpxResourceContextURI = XGoResourceContextURI
Deprecated: use XGoResourceContextURI.
const SpxBackdropResourceContextURI SpxResourceContextURI = "spx://resources/backdrops"
SpxBackdropResourceContextURI is the SpxResourceContextURI of SpxBackdropResource.
const SpxSoundResourceContextURI SpxResourceContextURI = "spx://resources/sounds"
SpxSoundResourceContextURI is the SpxResourceContextURI of SpxSoundResource.
const SpxSpriteResourceContextURI SpxResourceContextURI = "spx://resources/sprites"
SpxSpriteResourceContextURI is the SpxResourceContextURI of SpxSpriteResource.
const SpxWidgetResourceContextURI SpxResourceContextURI = "spx://resources/widgets"
SpxWidgetResourceContextURI is the SpxResourceContextURI of SpxWidgetResource.
func FormatSpxSpriteAnimationResourceContextURI ¶
func FormatSpxSpriteAnimationResourceContextURI(spriteName string) SpxResourceContextURI
FormatSpxSpriteAnimationResourceContextURI formats the SpxResourceContextURI for a sprite's animation resources.
func FormatSpxSpriteCostumeResourceContextURI ¶
func FormatSpxSpriteCostumeResourceContextURI(spriteName string) SpxResourceContextURI
FormatSpxSpriteCostumeResourceContextURI formats the SpxResourceContextURI for a sprite's costume resources.
type SpxResourceID ¶
type SpxResourceID interface {
Name() string
URI() SpxResourceURI
ContextURI() SpxResourceContextURI
}
SpxResourceID is the ID of an spx resource.
func ParseSpxResourceURI ¶
func ParseSpxResourceURI(uri SpxResourceURI) (SpxResourceID, error)
ParseSpxResourceURI parses an spx resource URI and returns the corresponding spx resource ID.
type SpxResourceIdentifier
deprecated
type SpxResourceIdentifier = XGoResourceIdentifier
Deprecated: use XGoResourceIdentifier.
type SpxResourceRef ¶
type SpxResourceRef struct {
ID SpxResourceID
Kind SpxResourceRefKind
Node xgoast.Node
}
SpxResourceRef is a reference to an spx resource.
type SpxResourceRefDocumentLinkData
deprecated
type SpxResourceRefDocumentLinkData = XGoResourceRefDocumentLinkData
Deprecated: use XGoResourceRefDocumentLinkData.
type SpxResourceRefKind ¶
type SpxResourceRefKind string
SpxResourceRefKind is the kind of an spx resource reference.
const ( SpxResourceRefKindStringLiteral SpxResourceRefKind = "stringLiteral" SpxResourceRefKindAutoBindingReference SpxResourceRefKind = "autoBindingReference" SpxResourceRefKindConstantReference SpxResourceRefKind = "constantReference" )
type SpxResourceSet ¶
type SpxResourceSet struct {
// contains filtered or unexported fields
}
SpxResourceSet is a set of spx resources.
func NewSpxResourceSet ¶
func NewSpxResourceSet(proj *xgo.Project) (*SpxResourceSet, error)
NewSpxResourceSet creates a new spx resource set.
func (*SpxResourceSet) Backdrop ¶
func (set *SpxResourceSet) Backdrop(name string) *SpxBackdropResource
Backdrop returns the backdrop with the given name. It returns nil if not found.
func (*SpxResourceSet) Contains ¶ added in v0.18.0
func (set *SpxResourceSet) Contains(id SpxResourceID) bool
Contains reports whether the given resource ID exists in the set.
func (*SpxResourceSet) Sound ¶
func (set *SpxResourceSet) Sound(name string) *SpxSoundResource
Sound returns the sound with the given name. It returns nil if not found.
func (*SpxResourceSet) Sprite ¶
func (set *SpxResourceSet) Sprite(name string) *SpxSpriteResource
Sprite returns the sprite with the given name. It returns nil if not found.
func (*SpxResourceSet) Widget ¶
func (set *SpxResourceSet) Widget(name string) *SpxWidgetResource
Widget returns the widget with the given name. It returns nil if not found.
type SpxResourceURI
deprecated
type SpxResourceURI = XGoResourceURI
Deprecated: use XGoResourceURI.
type SpxSoundResource ¶
type SpxSoundResource struct {
ID SpxSoundResourceID `json:"-"`
Name string `json:"name"`
Path string `json:"path"`
}
SpxSoundResource represents a sound resource in spx.
type SpxSoundResourceID ¶
type SpxSoundResourceID struct {
SoundName string
}
SpxSoundResourceID is the ID of an spx sound resource.
func (SpxSoundResourceID) ContextURI ¶
func (id SpxSoundResourceID) ContextURI() SpxResourceContextURI
ContextURI implements SpxResourceID.
func (SpxSoundResourceID) Name ¶
func (id SpxSoundResourceID) Name() string
Name implements SpxResourceID.
func (SpxSoundResourceID) URI ¶
func (id SpxSoundResourceID) URI() SpxResourceURI
URI implements SpxResourceID.
type SpxSpriteAnimationResource ¶
type SpxSpriteAnimationResource struct {
ID SpxSpriteAnimationResourceID `json:"-"`
Name string `json:"name"`
FromIndex *int `json:"-"`
ToIndex *int `json:"-"`
}
SpxSpriteAnimationResource represents an spx sprite animation resource.
type SpxSpriteAnimationResourceID ¶
SpxSpriteAnimationResourceID is the ID of an spx sprite animation resource.
func (SpxSpriteAnimationResourceID) ContextURI ¶
func (id SpxSpriteAnimationResourceID) ContextURI() SpxResourceContextURI
ContextURI implements SpxResourceID.
func (SpxSpriteAnimationResourceID) Name ¶
func (id SpxSpriteAnimationResourceID) Name() string
Name implements SpxResourceID.
func (SpxSpriteAnimationResourceID) URI ¶
func (id SpxSpriteAnimationResourceID) URI() SpxResourceURI
URI implements SpxResourceID.
type SpxSpriteCostumeResource ¶
type SpxSpriteCostumeResource struct {
ID SpxSpriteCostumeResourceID `json:"-"`
Name string `json:"name"`
Path string `json:"path"`
}
SpxSpriteCostumeResource represents an spx sprite costume resource.
type SpxSpriteCostumeResourceID ¶
SpxSpriteCostumeResourceID is the ID of an spx sprite costume resource.
func (SpxSpriteCostumeResourceID) ContextURI ¶
func (id SpxSpriteCostumeResourceID) ContextURI() SpxResourceContextURI
ContextURI implements SpxResourceID.
func (SpxSpriteCostumeResourceID) Name ¶
func (id SpxSpriteCostumeResourceID) Name() string
Name implements SpxResourceID.
func (SpxSpriteCostumeResourceID) URI ¶
func (id SpxSpriteCostumeResourceID) URI() SpxResourceURI
URI implements SpxResourceID.
type SpxSpriteResource ¶
type SpxSpriteResource struct {
ID SpxSpriteResourceID `json:"-"`
Name string `json:"name"`
Costumes []SpxSpriteCostumeResource `json:"costumes"`
// NormalCostumes includes all costumes except animation costumes.
NormalCostumes []SpxSpriteCostumeResource `json:"-"`
CostumeIndex int `json:"costumeIndex"`
FAnimations map[string]spxSpriteFAnimation `json:"fAnimations"`
Animations []SpxSpriteAnimationResource `json:"-"`
DefaultAnimation string `json:"defaultAnimation"`
}
SpxSpriteResource represents an spx sprite resource.
func (*SpxSpriteResource) Animation ¶
func (sprite *SpxSpriteResource) Animation(name string) *SpxSpriteAnimationResource
Animation returns the animation with the given name. It returns nil if not found.
func (*SpxSpriteResource) Costume ¶
func (sprite *SpxSpriteResource) Costume(name string) *SpxSpriteCostumeResource
Costume returns the costume with the given name. It returns nil if not found.
type SpxSpriteResourceID ¶
type SpxSpriteResourceID struct {
SpriteName string
}
SpxSpriteResourceID is the ID of an spx sprite resource.
func (SpxSpriteResourceID) ContextURI ¶
func (id SpxSpriteResourceID) ContextURI() SpxResourceContextURI
ContextURI implements SpxResourceID.
func (SpxSpriteResourceID) Name ¶
func (id SpxSpriteResourceID) Name() string
Name implements SpxResourceID.
func (SpxSpriteResourceID) URI ¶
func (id SpxSpriteResourceID) URI() SpxResourceURI
URI implements SpxResourceID.
type SpxWidgetResource ¶
type SpxWidgetResource struct {
ID SpxWidgetResourceID `json:"-"`
Name string `json:"name"`
Type string `json:"type"`
Label string `json:"label"`
Val string `json:"val"`
}
SpxWidgetResource represents a widget resource in spx.
type SpxWidgetResourceID ¶
type SpxWidgetResourceID struct {
WidgetName string
}
SpxWidgetResourceID is the ID of an spx widget resource.
func (SpxWidgetResourceID) ContextURI ¶
func (id SpxWidgetResourceID) ContextURI() SpxResourceContextURI
ContextURI implements SpxResourceID.
func (SpxWidgetResourceID) Name ¶
func (id SpxWidgetResourceID) Name() string
Name implements SpxResourceID.
func (SpxWidgetResourceID) URI ¶
func (id SpxWidgetResourceID) URI() SpxResourceURI
URI implements SpxResourceID.
type TextDocumentIdentifier ¶
type TextDocumentIdentifier = protocol.TextDocumentIdentifier
type TextDocumentPositionParams ¶
type TextDocumentPositionParams = protocol.TextDocumentPositionParams
type TypeDefinitionParams ¶
type TypeDefinitionParams = protocol.TypeDefinitionParams
type WorkspaceDiagnosticParams ¶
type WorkspaceDiagnosticParams = protocol.WorkspaceDiagnosticParams
type WorkspaceDiagnosticReport ¶
type WorkspaceDiagnosticReport = protocol.WorkspaceDiagnosticReport
type WorkspaceDocumentDiagnosticReport ¶
type WorkspaceDocumentDiagnosticReport = protocol.WorkspaceDocumentDiagnosticReport
type WorkspaceEdit ¶
type WorkspaceEdit = protocol.WorkspaceEdit
type WorkspaceFullDocumentDiagnosticReport ¶
type WorkspaceFullDocumentDiagnosticReport = protocol.WorkspaceFullDocumentDiagnosticReport
type XGoCompletionItemData ¶ added in v0.15.0
type XGoCompletionItemData struct {
// The corresponding definition of the completion item.
Definition *XGoDefinitionIdentifier `json:"definition,omitempty"`
}
XGoCompletionItemData represents data in a completion item.
type XGoDefinitionIdentifier ¶ added in v0.15.0
type XGoDefinitionIdentifier struct {
// Full name of source package.
// If not provided, it's assumed to be kind-statement.
// If `main`, it's the current user package.
// Examples:
// - `fmt`
// - `github.com/goplus/spx/v2`
// - `main`
Package *string `json:"package,omitempty"`
// Exported name of the definition.
// If not provided, it's assumed to be kind-package.
// Examples:
// - `Println`
// - `Sprite`
// - `Sprite.turn`
// - `for_statement_with_single_condition`
Name *string `json:"name,omitempty"`
// Overload Identifier.
OverloadID *string `json:"overloadId,omitempty"`
}
XGoDefinitionIdentifier identifies an XGo definition.
func (XGoDefinitionIdentifier) String ¶ added in v0.15.0
func (id XGoDefinitionIdentifier) String() string
String implements fmt.Stringer.
type XGoGetDefinitionsParams ¶ added in v0.15.0
type XGoGetDefinitionsParams struct {
// The text document position params.
protocol.TextDocumentPositionParams
}
XGoGetDefinitionsParams represents parameters to get definitions at a specific position in a document.
type XGoGetInputSlotsParams ¶ added in v0.15.0
type XGoGetInputSlotsParams struct {
// The text document.
TextDocument protocol.TextDocumentIdentifier `json:"textDocument"`
}
XGoGetInputSlotsParams holds parameters to get XGo input slots for a specific document.
type XGoGetPropertiesParams ¶ added in v0.16.2
type XGoGetPropertiesParams struct {
// The target name (object type) to retrieve properties for (e.g., 'Game' type or a sprite type name).
Target string `json:"target"`
}
XGoGetPropertiesParams holds parameters to get properties for a specific target.
type XGoInput ¶ added in v0.15.0
type XGoInput struct {
Kind XGoInputKind `json:"kind"`
Type XGoInputType `json:"type"`
Value any `json:"value,omitempty"` // For InPlace kind
Name string `json:"name,omitempty"` // For Predefined kind
}
XGoInput represents the current input in a slot.
type XGoInputKind ¶ added in v0.15.0
type XGoInputKind string
XGoInputKind represents the kind of input.
const ( // XGoInputKindInPlace in-place value like "hello world", 123, true, etc. XGoInputKindInPlace XGoInputKind = "in-place" // XGoInputKindPredefined reference to user predefined identifier. XGoInputKindPredefined XGoInputKind = "predefined" )
XGoInputKind constants.
type XGoInputSlot ¶ added in v0.15.0
type XGoInputSlot struct {
Range Range `json:"range"`
Kind XGoInputSlotKind `json:"kind"`
Accept XGoInputSlotAccept `json:"accept"`
Input XGoInput `json:"input"`
PredefinedNames []string `json:"predefinedNames"`
}
XGoInputSlot describes a modifiable item in code.
type XGoInputSlotAccept ¶ added in v0.15.0
type XGoInputSlotAccept struct {
// Type of input accepted by the slot.
Type XGoInputType `json:"type"`
// Resource context for XGoInputTypeSpxResourceName.
// Only valid when Type is XGoInputTypeSpxResourceName.
ResourceContext *XGoResourceContextURI `json:"resourceContext,omitempty"`
}
XGoInputSlotAccept represents info about what inputs are accepted by a slot.
type XGoInputSlotKind ¶ added in v0.15.0
type XGoInputSlotKind string
XGoInputSlotKind enumerates kinds of XGo input slots.
const ( // XGoInputSlotKindValue slot accepts value, which may be an in-place value or a predefined identifier. XGoInputSlotKindValue XGoInputSlotKind = "value" // XGoInputSlotKindAddress slot accepts address, which must be a predefined identifier. XGoInputSlotKindAddress XGoInputSlotKind = "address" )
XGoInputSlotKind constants.
type XGoInputSpxColorValue ¶ added in v0.15.0
type XGoInputSpxColorValue struct {
Constructor XGoInputTypeSpxColorConstructor `json:"constructor"`
Args []float64 `json:"args"`
}
XGoInputSpxColorValue represents the value structure for an XGoInput when its type is XGoInputTypeSpxColor and kind is XGoInputKindInPlace.
type XGoInputType ¶ added in v0.15.0
type XGoInputType string
XGoInputType represents the type of input for a slot.
const ( XGoInputTypeString XGoInputType = "string" XGoInputTypeInteger XGoInputType = "integer" XGoInputTypeDecimal XGoInputType = "decimal" XGoInputTypeBoolean XGoInputType = "boolean" XGoInputTypeUnknown XGoInputType = "unknown" XGoInputTypeSpxResourceName XGoInputType = "spx-resource-name" XGoInputTypeSpxDirection XGoInputType = "spx-direction" XGoInputTypeSpxLayerAction XGoInputType = "spx-layer-action" XGoInputTypeSpxDirAction XGoInputType = "spx-dir-action" XGoInputTypeSpxColor XGoInputType = "spx-color" XGoInputTypeSpxEffectKind XGoInputType = "spx-effect-kind" XGoInputTypeSpxKey XGoInputType = "spx-key" XGoInputTypeSpxSpecialObj XGoInputType = "spx-special-obj" XGoInputTypeSpxRotationStyle XGoInputType = "spx-rotation-style" XGoInputTypeSpxPropertyName XGoInputType = "spx-property-name" )
XGoInputType constants.
type XGoInputTypeSpxColorConstructor ¶ added in v0.15.0
type XGoInputTypeSpxColorConstructor string
XGoInputTypeSpxColorConstructor represents the name for color constructors.
const ( XGoInputTypeSpxColorConstructorHSB XGoInputTypeSpxColorConstructor = "HSB" XGoInputTypeSpxColorConstructorHSBA XGoInputTypeSpxColorConstructor = "HSBA" )
XGoInputTypeSpxColorConstructor constants.
type XGoProperty ¶ added in v0.16.2
type XGoProperty struct {
// The name of the property.
Name string `json:"name"`
// The type of the property as a string.
Type string `json:"type"`
// The kind of property.
Kind XGoPropertyKind `json:"kind"`
// Optional documentation for the property.
Doc string `json:"doc,omitempty"`
// The definition identifier for this property.
Definition XGoDefinitionIdentifier `json:"definition"`
}
type XGoPropertyKind ¶ added in v0.16.2
type XGoPropertyKind string
XGoPropertyKind represents a property of a type (field or method).
const ( XGoPropertyKindField XGoPropertyKind = "field" XGoPropertyKindMethod XGoPropertyKind = "method" )
type XGoRenameResourceParams ¶ added in v0.15.0
type XGoRenameResourceParams struct {
// The XGo resource to rename.
Resource XGoResourceIdentifier `json:"resource"`
// The new name of the XGo resource.
NewName string `json:"newName"`
}
XGoRenameResourceParams represents parameters to rename an XGo resource in the workspace.
type XGoResourceContextURI ¶ added in v0.15.0
type XGoResourceContextURI string
XGoResourceContextURI represents a URI for XGo resource context. Examples: - `spx://resources/sprites` - `spx://resources/sounds` - `spx://resources/sprites/<sName>/costumes`
type XGoResourceIdentifier ¶ added in v0.15.0
type XGoResourceIdentifier struct {
// The XGo resource URI.
URI XGoResourceURI `json:"uri"`
}
XGoResourceIdentifier identifies an XGo resource.
type XGoResourceRefDocumentLinkData ¶ added in v0.15.0
type XGoResourceRefDocumentLinkData struct {
// The kind of the XGo resource reference.
Kind SpxResourceRefKind `json:"kind"`
}
XGoResourceRefDocumentLinkData represents data for an XGo resource reference document link.
type XGoResourceURI ¶ added in v0.15.0
type XGoResourceURI string
XGoResourceURI represents a URI string for an XGo resource.
func (XGoResourceURI) HTML ¶ added in v0.15.0
func (u XGoResourceURI) HTML() string
HTML returns the HTML representation of the XGo resource URI.
Source Files
¶
- command.go
- compile.go
- completion.go
- definition.go
- diagnostic.go
- document.go
- format.go
- highlight.go
- hover.go
- implementation.go
- initialize.go
- inlay_hint.go
- protocol.go
- reference.go
- rename.go
- semantic_token.go
- server.go
- signature.go
- spx_definition.go
- spx_reference_pkg.go
- spx_resource.go
- spx_util.go
- text_synchronization.go
- util.go