Documentation ¶
Index ¶
- Variables
- func AddExprCompletions(list *protocol.CompletionList, comp CompletionContext, ctx *context.Ctx, ...)
- func AddFromIndex(list *protocol.CompletionList, pos *position.Position, prefix string, ...)
- func AddKeywordsWithPrefix(list *protocol.CompletionList, prefix string)
- func AddScopeVars(list *protocol.CompletionList, ctx *context.Ctx, prefix string)
- func Complete(pos *position.Position, comp CompletionContext) (list protocol.CompletionList)
- func CompletionData(pos *position.Position, n *index.INode) string
- func NodeCompletionKind(kind ast.Type) protocol.CompletionItemKind
- func NodeSignature(node ast.Vertex) string
- func PredictNamespace(pos *position.Position) string
- func Reconstruct(tokens []*token.Token) ast.Vertex
- type CompletionAction
- type CompletionContext
- type CompletionItemData
- type DefinitionProvider
- type Project
- func (p *Project) Complete(pos *position.Position) []*index.INode
- func (p *Project) Definition(pos *position.Position) ([]*position.Position, error)
- func (p *Project) Hover(currpos *position.Position) string
- func (p *Project) Parse(done *atomic.Uint64, total *atomic.Uint64, totalDone chan<- bool) error
- func (p *Project) ParseFileUpdate(path string, content string) error
- func (p *Project) ParseWithoutProgress() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoCompletionResults = errors.New("No completion results found for symbol at given position")
View Source
var (
ErrNoDefinitionFound = errors.New(
"No definition found for symbol at given position",
)
)
View Source
var KeywordItems = functional.Map(Keywords, func(keyword string) protocol.CompletionItem { return protocol.CompletionItem{Label: keyword, Kind: protocol.KeywordCompletion} })
View Source
var Keywords = []string{
"abstract",
"and",
"as",
"break",
"callable",
"case",
"catch",
"class",
"clone",
"const",
"continue",
"declare",
"default",
"die",
"do",
"echo",
"else",
"elseif",
"enddeclare",
"endfor",
"endforeach",
"endif",
"endswitch",
"endwhile",
"exit",
"extends",
"final",
"finally",
"fn",
"for",
"foreach",
"function",
"global",
"goto",
"if",
"implements",
"include",
"include_once",
"instanceof",
"insteadof",
"interface",
"match",
"namespace",
"new",
"or",
"print",
"private",
"protected",
"public",
"readonly",
"require",
"require_once",
"return",
"static",
"switch",
"throw",
"trait",
"try",
"use",
"var",
"while",
"xor",
"yield",
"yield from",
}
Functions ¶
func AddExprCompletions ¶
func AddExprCompletions( list *protocol.CompletionList, comp CompletionContext, ctx *context.Ctx, lastValue string, additionalFilters ...symbol.FilterFunc[symbol.Member], )
func AddFromIndex ¶
func AddKeywordsWithPrefix ¶
func AddKeywordsWithPrefix(list *protocol.CompletionList, prefix string)
func AddScopeVars ¶
func AddScopeVars( list *protocol.CompletionList, ctx *context.Ctx, prefix string, )
func Complete ¶
func Complete(pos *position.Position, comp CompletionContext) (list protocol.CompletionList)
func NodeCompletionKind ¶
func NodeCompletionKind(kind ast.Type) protocol.CompletionItemKind
func NodeSignature ¶
func PredictNamespace ¶
1. Check if there are other sibling files, parse for their namespace. 2. Keep going up a dir, trying the files for their namespace, camel case the directory names. 3. TODO: If we find the root of the project, return.
func Reconstruct ¶
Reconstruct tries to construct an AST node from the given tokens. It closes any open constructs and tries to turn the tokens into parse-able PHP. That PHP is then parsed and the resulting nodes have their position set to that of the tokens.
Types ¶
type CompletionAction ¶
type CompletionAction int
const ( None CompletionAction = iota // Not doing anything special, should complete global stuff, available variables in the scope. NamingFunction // A function is being named, probably nothing to complete. NamingClassLike // A class, interface or trait is being named, probably nothing to complete. NamingNamespace // Typing after 'namespace', complete with possible namespaces based on directory structure. StartingVariable // A '$' has been typed, should complete available variables in scope. Variable // A '$' with some characters (variable being typed), should complete available variables in scope, starting with the currently typed prefix. ObjectOp // Last op was a '->', should resolve up to before '->' and complete available stuff on that variable. StaticOp // Last op was '::', should resolve up to before '::' and complete available static stuff on that variable, can also complete 'class' to make $obj::class. Implements // Typing after 'implements', should complete any interfaces. Extends // Typing after 'extends', should complete any classes. Use // Typing after 'use', should complete any traits. AddingFile // Typing after include, include once, require or require once. Should complete file paths. Newing // Typing after 'new'. Should complete classes. Name // Typing a bare name, complete any classes that match it. NameRelative // Typing 'namespace\foo'. Should complete classes relative to current namespace. NameFullyQualified // Typing a name starting with '\'. Should complete any FQN starting with what has been typed. )
func (CompletionAction) String ¶
func (i CompletionAction) String() string
type CompletionContext ¶
type CompletionContext struct { Action CompletionAction Tokens []*token.Token // The last of these is the place the cursor is at. }
func GetCompletionQuery ¶
func GetCompletionQuery(pos *position.Position) CompletionContext
type CompletionItemData ¶
type DefinitionProvider ¶
type DefinitionProvider interface { CanDefine(ctx *context.Ctx, kind ast.Type) bool Define(ctx *context.Ctx) ([]*definition.Definition, error) }
type Project ¶
type Project struct{}
func (*Project) Definition ¶
func (*Project) Parse ¶
This should only be called once at the beginning of the connection with a client.
func (*Project) ParseFileUpdate ¶
func (*Project) ParseWithoutProgress ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.