analysis

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Public indicates public visibility
	Public VisibilityModifierValue = iota
	// Protected indicates protected visibility
	Protected = iota
	// Private indicates private visibility
	Private = iota
)
View Source
const (
	// NoClassModifier indicates there is no class modifier
	NoClassModifier ClassModifierValue = iota
	// Abstract indicates there is an abstract keyword
	Abstract = iota
	// Final indicates there is a final keyword
	Final = iota
)
View Source
const (
	UseClass    UseType = iota
	UseFunction         = iota
	UseConst            = iota
)
View Source
const KeySep string = "\x00"

KeySep is the separator when constructing key

Variables

View Source
var Aliases = map[string]string{
	"boolean": "bool",
	"integer": "int",
}

Aliases is a constant to look up aliases (e.g. boolean is bool)

View Source
var IgnoreTokenSet mapset.Set[lexer.TokenType]
View Source
var Natives = map[string]bool{
	"mixed":    true,
	"null":     true,
	"bool":     true,
	"true":     true,
	"false":    true,
	"int":      true,
	"float":    true,
	"real":     true,
	"double":   true,
	"string":   true,
	"binary":   true,
	"array":    true,
	"object":   true,
	"callable": true,
	"void":     true,
	"static":   true,
	"$this":    true,

	"__DIR__":  true,
	"__FILE__": true,
}

Natives is a constant to look up native types

Functions

func DeprecatedDiagnostics

func DeprecatedDiagnostics(ctx ResolveContext) []protocol.Diagnostic

DeprecatedDiagnostics returns the diagnostics for deprecated references

func GetClassFQNLowerCase

func GetClassFQNLowerCase(fqn string) string

GetClassFQNLowerCase gets the lower case version of FQN which is lower case name and the rest is left as is

func GetParserDiagnostics

func GetParserDiagnostics(document *Document) []protocol.Diagnostic

GetParserDiagnostics returns the diagnostics for the syntax error

func GetScopeAndNameFromString

func GetScopeAndNameFromString(name string) (string, string)

func IsFQN

func IsFQN(name string) bool

func IsInherited

func IsInherited(currentClass string, access MemberAccess, relationMap RelationMap, member MemberSymbol) bool

IsInherited checks whether the given conditions can inherit the symbol with non-static rules

func IsInheritedStatic

func IsInheritedStatic(currentClass string, access MemberAccess, relationMap RelationMap, member MemberSymbol) bool

IsInheritedStatic checks the given conditions if it can be inherited

func IsNameParent

func IsNameParent(name string) bool

func IsNameRelative

func IsNameRelative(name string) bool

func SymToRefs

func SymToRefs(document *Document, sym HasTypes) []string

SymToRefs converts a HasTypes symbol to reference strings

func TraverseDocument

func TraverseDocument(document *Document, preorder func(Symbol), postorder func(Symbol))

func TraverseSymbol

func TraverseSymbol(s Symbol, preorder func(Symbol), postorder func(Symbol))

func UnusedDiagnostics

func UnusedDiagnostics(document *Document) []protocol.Diagnostic

UnusedDiagnostics returns the diagnostics for unused variables or imports TODO: provide unused imports

Types

type AnonymousFunction

type AnonymousFunction struct {
	Params []*Parameter
	// contains filtered or unexported fields
}

func (*AnonymousFunction) GetChildren

func (s *AnonymousFunction) GetChildren() []Symbol

func (*AnonymousFunction) GetLocation

func (s *AnonymousFunction) GetLocation() protocol.Location

type ArgumentList

type ArgumentList struct {
	// contains filtered or unexported fields
}

ArgumentList contains information of arguments in function-like call

func (*ArgumentList) GetArgumentRanges

func (s *ArgumentList) GetArgumentRanges() []protocol.Range

GetArgumentRanges returns the ranges of the arguments while this is not useful for providing signature help because the ranges ignore whitespaces, but this is useful for align signature annotations

func (*ArgumentList) GetArguments

func (s *ArgumentList) GetArguments() []phrase.AstNode

GetArguments returns the arguments

func (*ArgumentList) GetChildren

func (s *ArgumentList) GetChildren() []Symbol

func (*ArgumentList) GetLocation

func (s *ArgumentList) GetLocation() protocol.Location

func (*ArgumentList) GetRanges

func (s *ArgumentList) GetRanges() []protocol.Range

type BlockSymbol

type BlockSymbol interface {
	Symbol
	GetChildren() []Symbol
	// contains filtered or unexported methods
}

type Class

type Class struct {
	Location protocol.Location

	Modifier   ClassModifierValue
	Name       TypeString
	Extends    TypeString
	Interfaces []TypeString
	Use        []TypeString
	// contains filtered or unexported fields
}

Class contains information of classes

func ReadClass

func ReadClass(d *storage.Decoder) *Class

func (*Class) AddUse

func (s *Class) AddUse(name TypeString)

func (*Class) GetChildren

func (s *Class) GetChildren() []Symbol

func (*Class) GetCollection

func (s *Class) GetCollection() string

func (*Class) GetDescription

func (s *Class) GetDescription() string

func (*Class) GetIndexCollection

func (s *Class) GetIndexCollection() string

func (*Class) GetIndexableName

func (s *Class) GetIndexableName() string

func (*Class) GetKey

func (s *Class) GetKey() string

func (*Class) GetLocation

func (s *Class) GetLocation() protocol.Location

func (*Class) GetName

func (s *Class) GetName() string

func (*Class) GetScope

func (s *Class) GetScope() string

func (*Class) IsScopeSymbol

func (s *Class) IsScopeSymbol() bool

func (*Class) ReferenceFQN

func (s *Class) ReferenceFQN() string

ReferenceFQN returns the FQN of the class' name

func (*Class) ReferenceLocation

func (s *Class) ReferenceLocation() protocol.Location

ReferenceLocation returns the location of the class' name

func (*Class) Serialise

func (s *Class) Serialise(e *storage.Encoder)

type ClassAccess

type ClassAccess struct {
	Expression
	// contains filtered or unexported fields
}

ClassAccess represents a reference to the part before ::

func (*ClassAccess) GetLocation

func (s *ClassAccess) GetLocation() protocol.Location

func (*ClassAccess) GetName

func (s *ClassAccess) GetName() string

func (*ClassAccess) GetTypes

func (s *ClassAccess) GetTypes() TypeComposite

func (*ClassAccess) Resolve

func (s *ClassAccess) Resolve(ctx ResolveContext)

type ClassConst

type ClassConst struct {
	Name               string
	Value              string
	Scope              TypeString
	VisibilityModifier VisibilityModifierValue
	// contains filtered or unexported fields
}

ClassConst contains information of class constants

func ReadClassConst

func ReadClassConst(d *storage.Decoder) *ClassConst

func (*ClassConst) GetCollection

func (s *ClassConst) GetCollection() string

func (*ClassConst) GetDescription

func (s *ClassConst) GetDescription() string

func (*ClassConst) GetIndexCollection

func (s *ClassConst) GetIndexCollection() string

func (*ClassConst) GetIndexableName

func (s *ClassConst) GetIndexableName() string

func (*ClassConst) GetKey

func (s *ClassConst) GetKey() string

func (*ClassConst) GetLocation

func (s *ClassConst) GetLocation() protocol.Location

func (*ClassConst) GetName

func (s *ClassConst) GetName() string

func (*ClassConst) GetScope

func (s *ClassConst) GetScope() string

func (*ClassConst) IsScopeSymbol

func (s *ClassConst) IsScopeSymbol() bool

func (*ClassConst) IsStatic

func (s *ClassConst) IsStatic() bool

IsStatic is always static for class const

func (*ClassConst) ReferenceFQN

func (s *ClassConst) ReferenceFQN() string

func (*ClassConst) ReferenceLocation

func (s *ClassConst) ReferenceLocation() protocol.Location

func (*ClassConst) ScopeTypeString

func (s *ClassConst) ScopeTypeString() TypeString

ScopeTypeString returns the class const's class name

func (*ClassConst) Serialise

func (s *ClassConst) Serialise(e *storage.Encoder)

func (*ClassConst) Visibility

func (s *ClassConst) Visibility() VisibilityModifierValue

Visibility returns the visibility modifier of the class const

type ClassConstWithScope

type ClassConstWithScope struct {
	Const *ClassConst
	Scope Symbol
	Score int
}

ClassConstWithScope is the class const with its scope

func MergeClassConstWithScope

func MergeClassConstWithScope(items ...[]ClassConstWithScope) []ClassConstWithScope

MergeClassConstWithScope merges the items and remove duplicates

type ClassModifierValue

type ClassModifierValue int

ClassModifierValue is a value of class modifier (abstract, final)

type ClassTypeDesignator

type ClassTypeDesignator struct {
	Expression
	// contains filtered or unexported fields
}

ClassTypeDesignator represents a reference to object creation (e.g. new TestClass())

func (*ClassTypeDesignator) GetChildren

func (s *ClassTypeDesignator) GetChildren() []Symbol

func (*ClassTypeDesignator) GetLocation

func (s *ClassTypeDesignator) GetLocation() protocol.Location

func (*ClassTypeDesignator) GetTypes

func (s *ClassTypeDesignator) GetTypes() TypeComposite

func (*ClassTypeDesignator) ResolveToHasParams

func (s *ClassTypeDesignator) ResolveToHasParams(ctx ResolveContext) []HasParams

type CompletionValue

type CompletionValue string

CompletionValue holds references to uri and name

func (CompletionValue) Serialise

func (cv CompletionValue) Serialise(e *storage.Encoder)

Serialise writes the CompletionValue

type Const

type Const struct {
	Name  TypeString
	Value string
	// contains filtered or unexported fields
}

Const contains information of constants

func ReadConst

func ReadConst(d *storage.Decoder) *Const

func (*Const) GetCollection

func (s *Const) GetCollection() string

func (*Const) GetDescription

func (s *Const) GetDescription() string

func (*Const) GetIndexCollection

func (s *Const) GetIndexCollection() string

func (*Const) GetIndexableName

func (s *Const) GetIndexableName() string

func (*Const) GetKey

func (s *Const) GetKey() string

func (*Const) GetLocation

func (s *Const) GetLocation() protocol.Location

func (*Const) GetName

func (s *Const) GetName() string

func (*Const) Serialise

func (s *Const) Serialise(e *storage.Encoder)

type ConstantAccess

type ConstantAccess struct {
	Expression
}

ConstantAccess represents a reference to constant access

func (*ConstantAccess) GetLocation

func (s *ConstantAccess) GetLocation() protocol.Location

func (*ConstantAccess) GetTypes

func (s *ConstantAccess) GetTypes() TypeComposite

type Define

type Define struct {
	Name  TypeString
	Value string
	// contains filtered or unexported fields
}

Define contains information of define constants

func ReadDefine

func ReadDefine(d *storage.Decoder) *Define

func (*Define) GetChildren

func (s *Define) GetChildren() []Symbol

func (*Define) GetCollection

func (s *Define) GetCollection() string

func (*Define) GetDescription

func (s *Define) GetDescription() string

func (*Define) GetIndexCollection

func (s *Define) GetIndexCollection() string

func (*Define) GetIndexableName

func (s *Define) GetIndexableName() string

func (*Define) GetKey

func (s *Define) GetKey() string

func (*Define) GetLocation

func (s *Define) GetLocation() protocol.Location

func (*Define) GetName

func (s *Define) GetName() string

func (*Define) GetTypes

func (s *Define) GetTypes() TypeComposite

func (*Define) Resolve

func (s *Define) Resolve(ctx ResolveContext)

func (*Define) ResolveToHasParams

func (s *Define) ResolveToHasParams(ctx ResolveContext) []HasParams

func (*Define) Serialise

func (s *Define) Serialise(e *storage.Encoder)

type Document

type Document struct {
	Children []Symbol `json:"children"`
	// contains filtered or unexported fields
}

Document contains information of documents

func NewDocument

func NewDocument(uri string, text []byte) *Document

func (*Document) ApplyChanges

func (s *Document) ApplyChanges(changes []protocol.TextDocumentContentChangeEvent)

ApplyChanges applies the changes to line offsets and text

func (*Document) ArgumentListAndFunctionCallAt

func (s *Document) ArgumentListAndFunctionCallAt(pos protocol.Position) (*ArgumentList, HasParamsResolvable)

ArgumentListAndFunctionCallAt returns an ArgumentList and FunctionCall at the position

func (*Document) ClassAt

func (s *Document) ClassAt(pos protocol.Position) Symbol

ClassAt returns a class, interface or trait at the position

func (*Document) CloneForMutate

func (s *Document) CloneForMutate() *Document

CloneForMutate returns a new document with resetted state

func (*Document) Close

func (s *Document) Close()

Close unsets the flag

func (*Document) GetClassScopeAtSymbol

func (s *Document) GetClassScopeAtSymbol(symbol Symbol) string

GetClassScopeAtSymbol returns the class scope at the symbol

func (*Document) GetHash

func (s *Document) GetHash() []byte

func (*Document) GetNodeLocation

func (s *Document) GetNodeLocation(node phrase.AstNode) protocol.Location

GetNodeLocation retrieves the location of a phrase node

func (*Document) GetNodeText

func (s *Document) GetNodeText(node phrase.AstNode) string

func (*Document) GetRootNode

func (s *Document) GetRootNode() *phrase.Phrase

GetRootNode returns the root node of the AST tree

func (*Document) GetText

func (s *Document) GetText() []byte

GetText is a getter for text

func (*Document) GetURI

func (s *Document) GetURI() string

GetURI is a getter for uri

func (*Document) GetVariableTableAt

func (s *Document) GetVariableTableAt(pos protocol.Position) *VariableTable

GetVariableTableAt returns the closest variable table which is in range

func (*Document) HasTypesAt

func (s *Document) HasTypesAt(offset int) HasTypes

HasTypesAt is an interface to SymbolAtPos but with offset

func (*Document) HasTypesAtPos

func (s *Document) HasTypesAtPos(pos protocol.Position) HasTypes

HasTypesAtPos returns a HasTypes symbol at the position

func (*Document) HasTypesBeforePos

func (s *Document) HasTypesBeforePos(pos protocol.Position) HasTypes

HasTypesBeforePos returns a HasTypes before the position

func (*Document) ImportTableAtPos

func (s *Document) ImportTableAtPos(pos protocol.Position) *ImportTable

ImportTableAtPos finds the importTable at the position

func (*Document) IsOpen

func (s *Document) IsOpen() bool

IsOpen returns whether the document is open

func (*Document) Load

func (s *Document) Load()

Load makes sure that symbols are available

func (*Document) Lock

func (s *Document) Lock()

func (*Document) MarshalJSON

func (s *Document) MarshalJSON() ([]byte, error)

MarshalJSON is used for json.Marshal

func (*Document) NodeRange

func (s *Document) NodeRange(node phrase.AstNode) protocol.Range

NodeRange returns the lsp range of the given node

func (*Document) NodeSpineAt

func (s *Document) NodeSpineAt(offset int) util.NodeStack

func (*Document) OffsetAtPosition

func (s *Document) OffsetAtPosition(pos protocol.Position) int

func (*Document) Open

func (s *Document) Open()

Open sets a flag to indicate the document is open

func (*Document) SetText

func (s *Document) SetText(text []byte)

SetText is a setter for text, at the same time update line offsets

func (*Document) Unlock

func (s *Document) Unlock()

func (*Document) UnusedVariables

func (s *Document) UnusedVariables() []*Variable

UnusedVariables return unused declared variables in the doc

func (*Document) WordAtPos

func (s *Document) WordAtPos(pos protocol.Position) string

type Expression

type Expression struct {
	Type     TypeComposite
	Scope    HasTypes
	Location protocol.Location
	Name     string
}

Expression represents a reference

func (*Expression) Resolve

func (e *Expression) Resolve(ctx ResolveContext)

func (*Expression) ResolveAndGetScope

func (e *Expression) ResolveAndGetScope(ctx ResolveContext) TypeComposite

type ForeachCollection

type ForeachCollection struct {
	// contains filtered or unexported fields
}

func (ForeachCollection) GetLocation

func (s ForeachCollection) GetLocation() protocol.Location

func (ForeachCollection) GetTypes

func (s ForeachCollection) GetTypes() TypeComposite

func (ForeachCollection) Resolve

func (s ForeachCollection) Resolve(ctx ResolveContext)

type Function

type Function struct {
	Name   TypeString `json:"Name"`
	Params []*Parameter
	// contains filtered or unexported fields
}

Function contains information of functions

func ReadFunction

func ReadFunction(d *storage.Decoder) *Function

func (*Function) GetChildren

func (s *Function) GetChildren() []Symbol

func (*Function) GetCollection

func (s *Function) GetCollection() string

func (*Function) GetDescription

func (s *Function) GetDescription() string

func (*Function) GetDetail

func (s *Function) GetDetail() string

func (*Function) GetIndexCollection

func (s *Function) GetIndexCollection() string

func (*Function) GetIndexableName

func (s *Function) GetIndexableName() string

func (*Function) GetKey

func (s *Function) GetKey() string

func (*Function) GetLocation

func (s *Function) GetLocation() protocol.Location

func (*Function) GetName

func (s *Function) GetName() TypeString

func (*Function) GetNameLabel

func (s *Function) GetNameLabel() string

func (*Function) GetParams

func (s *Function) GetParams() []*Parameter

func (*Function) GetReturnTypes

func (s *Function) GetReturnTypes() TypeComposite

func (*Function) GetScope

func (s *Function) GetScope() string

func (*Function) IsScopeSymbol

func (s *Function) IsScopeSymbol() bool

func (*Function) ReferenceFQN

func (s *Function) ReferenceFQN() string

ReferenceFQN returns the FQN to function's name for the reference index

func (*Function) ReferenceLocation

func (s *Function) ReferenceLocation() protocol.Location

ReferenceLocation returns the location of the function's name for reference index

func (*Function) Serialise

func (s *Function) Serialise(e *storage.Encoder)

type FunctionCall

type FunctionCall struct {
	Expression
	// contains filtered or unexported fields
}

FunctionCall represents a reference to function call

func (*FunctionCall) GetLocation

func (s *FunctionCall) GetLocation() protocol.Location

func (*FunctionCall) GetTypes

func (s *FunctionCall) GetTypes() TypeComposite

func (*FunctionCall) Resolve

func (s *FunctionCall) Resolve(ctx ResolveContext)

func (*FunctionCall) ResolveToHasParams

func (s *FunctionCall) ResolveToHasParams(ctx ResolveContext) []HasParams

type GlobalVariable

type GlobalVariable struct {
	Name string
	// contains filtered or unexported fields
}

func ReadGlobalVariable

func ReadGlobalVariable(d *storage.Decoder) *GlobalVariable

func (*GlobalVariable) GetCollection

func (s *GlobalVariable) GetCollection() string

func (*GlobalVariable) GetDescription

func (s *GlobalVariable) GetDescription() string

func (*GlobalVariable) GetDetail

func (s *GlobalVariable) GetDetail() string

func (*GlobalVariable) GetKey

func (s *GlobalVariable) GetKey() string

func (*GlobalVariable) GetLocation

func (s *GlobalVariable) GetLocation() protocol.Location

func (*GlobalVariable) GetName

func (s *GlobalVariable) GetName() string

func (*GlobalVariable) Serialise

func (s *GlobalVariable) Serialise(e *storage.Encoder)

type HasName

type HasName interface {
	GetName() string
}

type HasParams

type HasParams interface {
	GetParams() []*Parameter
	GetDescription() string
	GetNameLabel() string
}

type HasParamsResolvable

type HasParamsResolvable interface {
	ResolveToHasParams(ctx ResolveContext) []HasParams
}

type HasScope

type HasScope interface {
	GetScope() string
	IsScopeSymbol() bool
}

type HasTypes

type HasTypes interface {
	Symbol
	GetTypes() TypeComposite
	Resolve(ctx ResolveContext)
}

type HasTypesHasScope

type HasTypesHasScope interface {
	HasTypes
	MemberName() string
	GetScopeTypes() TypeComposite
}

type ImportTable

type ImportTable struct {
	// contains filtered or unexported fields
}

func (ImportTable) FunctionPossibleFQNs

func (i ImportTable) FunctionPossibleFQNs(name TypeString) []string

func (ImportTable) GetClassReferenceFQN

func (i ImportTable) GetClassReferenceFQN(name TypeString) string

func (ImportTable) GetConstReferenceFQN

func (i ImportTable) GetConstReferenceFQN(q *Query, name TypeString) string

func (ImportTable) GetFunctionReferenceFQN

func (i ImportTable) GetFunctionReferenceFQN(q *Query, name TypeString) string

func (ImportTable) GetNamespace

func (i ImportTable) GetNamespace() string

func (ImportTable) ResolveScopeNamespace

func (i ImportTable) ResolveScopeNamespace(word string) string

func (ImportTable) ResolveToQualified

func (i ImportTable) ResolveToQualified(document *Document, symbol Symbol, name TypeString, word string) (string, *protocol.TextEdit)

type InheritedClassConst

type InheritedClassConst struct {
	Consts       []ClassConstWithScope
	RelationMap  RelationMap
	SearchedFQNs map[string]struct{}
}

InheritedClassConst contains class consts including inherited ones

func EmptyInheritedClassConst

func EmptyInheritedClassConst() InheritedClassConst

EmptyInheritedClassConst creates an empty inherited class const

func NewInheritedClassConst

func NewInheritedClassConst(consts []ClassConstWithScope, searchedFQNs map[string]struct{}) InheritedClassConst

NewInheritedClassConst creates inherited

func (*InheritedClassConst) Merge

func (c *InheritedClassConst) Merge(other InheritedClassConst)

Merge merges current inherited class consts with others

func (InheritedClassConst) ReduceStatic

func (c InheritedClassConst) ReduceStatic(currentClass string, access MemberAccess) []ClassConstWithScope

ReduceStatic reduces the inherited props using the static rules

type InheritedMethods

type InheritedMethods struct {
	Methods      []MethodWithScope
	RelationMap  RelationMap
	SearchedFQNs map[string]struct{}
}

InheritedMethods contains the methods and the searched scope names

func EmptyInheritedMethods

func EmptyInheritedMethods() InheritedMethods

EmptyInheritedMethods returns an empty inherited methods

func NewInheritedMethods

func NewInheritedMethods(methods []MethodWithScope, searchedFQNs map[string]struct{}) InheritedMethods

NewInheritedMethods returns InheritedMethods struct

func (InheritedMethods) Len

func (m InheritedMethods) Len() int

Len returns number of methods

func (*InheritedMethods) Merge

func (m *InheritedMethods) Merge(other InheritedMethods)

Merge merges current inherited methods with others, this merges the underlying methods and searched FQNs

func (InheritedMethods) ReduceAccess

func (m InheritedMethods) ReduceAccess(currentClass string, access MemberAccess) []MethodWithScope

ReduceAccess filters the methods by the access rules Rules:

  • If the `name` is $this includes the scope is the current class or not private methods
  • If the type of `scope` is the same as the current class, private methods can be accessed
  • Else, only public methods can be accessed

func (InheritedMethods) ReduceFirst

func (m InheritedMethods) ReduceFirst() MethodWithScope

ReduceFirst ignores static or non-static rules and returns the first public encountered method, this is useful in case of constructors which only public methods are accessible

func (InheritedMethods) ReduceStatic

func (m InheritedMethods) ReduceStatic(currentClass string, access MemberAccess) []MethodWithScope

ReduceStatic filters the methods by the static rules, even though the methods are not necessarily static, e.g. self::NonStaticMethod(). Rules:

  • If the `name` is parent, includes methods not from current class and not private
  • If the `name` is relative (static, self), includes methods from same class or not private methods
  • Otherwise, includes methods that are static and public

type InheritedProps

type InheritedProps struct {
	Props        []PropWithScope
	RelationMap  RelationMap
	SearchedFQNs map[string]struct{}
}

InheritedProps contains information for props include inheried ones

func EmptyInheritedProps

func EmptyInheritedProps() InheritedProps

EmptyInheritedProps creates an empty InheritedProps

func NewInheritedProps

func NewInheritedProps(props []PropWithScope, searchedFQNs map[string]struct{}) InheritedProps

NewInheritedProps creates InheritedProps

func (InheritedProps) Len

func (p InheritedProps) Len() int

Len returns number of inherited props

func (*InheritedProps) Merge

func (p *InheritedProps) Merge(other InheritedProps)

Merge merges the current inherited props with others

func (InheritedProps) ReduceAccess

func (p InheritedProps) ReduceAccess(currentClass string, access MemberAccess) []PropWithScope

ReduceAccess reduces propties using the access rules

func (InheritedProps) ReduceStatic

func (p InheritedProps) ReduceStatic(currentClass string, access MemberAccess) []PropWithScope

ReduceStatic reduces properties using the static rules

type InsertUseContext

type InsertUseContext struct {
	// contains filtered or unexported fields
}

func GetInsertUseContext

func GetInsertUseContext(document *Document) InsertUseContext

func (InsertUseContext) GetInsertAfterNode

func (i InsertUseContext) GetInsertAfterNode() *phrase.Phrase

func (InsertUseContext) GetInsertPosition

func (i InsertUseContext) GetInsertPosition() (protocol.Position, bool)

func (InsertUseContext) GetUseEdit

func (i InsertUseContext) GetUseEdit(typeString TypeString, symbol Symbol, alias string) *protocol.TextEdit

type Interface

type Interface struct {
	Name    TypeString
	Extends []TypeString
	// contains filtered or unexported fields
}

Interface contains information of interfaces

func ReadInterface

func ReadInterface(d *storage.Decoder) *Interface

func (*Interface) GetChildren

func (s *Interface) GetChildren() []Symbol

func (*Interface) GetCollection

func (s *Interface) GetCollection() string

func (*Interface) GetDescription

func (s *Interface) GetDescription() string

func (*Interface) GetIndexCollection

func (s *Interface) GetIndexCollection() string

func (*Interface) GetIndexableName

func (s *Interface) GetIndexableName() string

func (*Interface) GetKey

func (s *Interface) GetKey() string

func (*Interface) GetLocation

func (s *Interface) GetLocation() protocol.Location

func (*Interface) GetScope

func (s *Interface) GetScope() string

func (*Interface) IsScopeSymbol

func (s *Interface) IsScopeSymbol() bool

func (*Interface) ReferenceFQN

func (s *Interface) ReferenceFQN() string

ReferenceFQN returns the interface's FQN for reference index

func (*Interface) ReferenceLocation

func (s *Interface) ReferenceLocation() protocol.Location

ReferenceLocation returns the location of the interface's name

func (*Interface) Serialise

func (s *Interface) Serialise(e *storage.Encoder)

type InterfaceAccess

type InterfaceAccess struct {
	Expression
}

InterfaceAccess represents a reference to the part before ::

func (*InterfaceAccess) GetLocation

func (s *InterfaceAccess) GetLocation() protocol.Location

func (*InterfaceAccess) GetTypes

func (s *InterfaceAccess) GetTypes() TypeComposite

type MemberAccess

type MemberAccess interface {
	HasTypes
	ScopeName() string
	ScopeTypes() TypeComposite
}

MemberAccess is a has types that accesses via a scope name and types

type MemberAccessExpression

type MemberAccessExpression struct {
	Expression
}

MemberAccessExpression is the base struct for non-static member access

func (*MemberAccessExpression) ScopeName

func (m *MemberAccessExpression) ScopeName() string

ScopeName returns the name of the accessed scope

func (*MemberAccessExpression) ScopeTypes

func (m *MemberAccessExpression) ScopeTypes() TypeComposite

ScopeTypes returns the types of the scope, this should be resolved before calling this

type MemberSymbol

type MemberSymbol interface {
	ScopeTypeString() TypeString
	IsStatic() bool
	Visibility() VisibilityModifierValue
}

MemberSymbol is a symbol that is a member of another symbol (class consts, methods and props)

type Method

type Method struct {
	Name   string
	Params []*Parameter

	Scope              TypeString
	VisibilityModifier VisibilityModifierValue

	ClassModifier ClassModifierValue
	// contains filtered or unexported fields
}

Method contains information of methods

func ReadMethod

func ReadMethod(d *storage.Decoder) *Method

func (*Method) GetChildren

func (s *Method) GetChildren() []Symbol

func (*Method) GetCollection

func (s *Method) GetCollection() string

func (Method) GetDescription

func (s Method) GetDescription() string

func (*Method) GetIndexCollection

func (s *Method) GetIndexCollection() string

func (*Method) GetIndexableName

func (s *Method) GetIndexableName() string

func (*Method) GetKey

func (s *Method) GetKey() string

func (Method) GetLocation

func (s Method) GetLocation() protocol.Location

func (Method) GetName

func (s Method) GetName() string

func (*Method) GetNameLabel

func (s *Method) GetNameLabel() string

func (*Method) GetParams

func (s *Method) GetParams() []*Parameter

func (Method) GetReturnTypes

func (s Method) GetReturnTypes() TypeComposite

func (*Method) GetScope

func (s *Method) GetScope() string

func (*Method) IsScopeSymbol

func (s *Method) IsScopeSymbol() bool

func (*Method) IsStatic

func (s *Method) IsStatic() bool

IsStatic returns whether a method is static

func (*Method) ReferenceFQN

func (s *Method) ReferenceFQN() string

ReferenceFQN returns the FQN for the method

func (*Method) ReferenceLocation

func (s *Method) ReferenceLocation() protocol.Location

ReferenceLocation returns the location for the method's name

func (*Method) ScopeTypeString

func (s *Method) ScopeTypeString() TypeString

ScopeTypeString returns the class scope

func (*Method) Serialise

func (s *Method) Serialise(e *storage.Encoder)

func (*Method) Visibility

func (s *Method) Visibility() VisibilityModifierValue

Visibility returns the visibility modifier of the method

type MethodAccess

type MethodAccess struct {
	MemberAccessExpression
	// contains filtered or unexported fields
}

func (*MethodAccess) GetLocation

func (s *MethodAccess) GetLocation() protocol.Location

func (*MethodAccess) GetScopeTypes

func (s *MethodAccess) GetScopeTypes() TypeComposite

func (*MethodAccess) GetTypes

func (s *MethodAccess) GetTypes() TypeComposite

func (*MethodAccess) MemberName

func (s *MethodAccess) MemberName() string

func (*MethodAccess) Resolve

func (s *MethodAccess) Resolve(ctx ResolveContext)

func (*MethodAccess) ResolveToHasParams

func (s *MethodAccess) ResolveToHasParams(ctx ResolveContext) []HasParams

type MethodWithScope

type MethodWithScope struct {
	Method *Method
	Scope  Symbol
	Score  int
}

MethodWithScope represents a method with its scope

func MergeMethodWithScope

func MergeMethodWithScope(items ...[]MethodWithScope) []MethodWithScope

MergeMethodWithScope returns a merged methods with scope

type NameIndexable

type NameIndexable interface {
	GetIndexableName() string
	GetIndexCollection() string
}

NameIndexable indicates a symbol is name indexable, i.e. have completion

type Namespace

type Namespace struct {
	Name string
}

type Parameter

type Parameter struct {
	Name  string        `json:"Name"`
	Type  TypeComposite `json:"Type"`
	Value string        `json:"Value"`
	// contains filtered or unexported fields
}

Parameter contains information of a function parameter

func ReadParameter

func ReadParameter(d *storage.Decoder) *Parameter

func (*Parameter) GetDescription

func (s *Parameter) GetDescription() string

func (*Parameter) GetLocation

func (s *Parameter) GetLocation() protocol.Location

func (Parameter) HasValue

func (s Parameter) HasValue() bool

func (Parameter) ToVariable

func (s Parameter) ToVariable() *Variable

func (*Parameter) Write

func (s *Parameter) Write(e *storage.Encoder)

type PropWithScope

type PropWithScope struct {
	Prop  *Property
	Scope Symbol
	Score int
}

PropWithScope represents a property with a scope

func MergePropWithScope

func MergePropWithScope(items ...[]PropWithScope) []PropWithScope

MergePropWithScope returns a merged props with scope

type Property

type Property struct {
	Name               string
	Scope              TypeString
	VisibilityModifier VisibilityModifierValue

	Types TypeComposite
	// contains filtered or unexported fields
}

Property contains information for properties

func ReadProperty

func ReadProperty(d *storage.Decoder) *Property

func (*Property) GetCollection

func (s *Property) GetCollection() string

func (*Property) GetDescription

func (s *Property) GetDescription() string

func (*Property) GetIndexCollection

func (s *Property) GetIndexCollection() string

func (*Property) GetIndexableName

func (s *Property) GetIndexableName() string

func (*Property) GetKey

func (s *Property) GetKey() string

func (*Property) GetLocation

func (s *Property) GetLocation() protocol.Location

func (*Property) GetName

func (s *Property) GetName() string

func (*Property) GetScope

func (s *Property) GetScope() string

func (*Property) IsScopeSymbol

func (s *Property) IsScopeSymbol() bool

func (*Property) IsStatic

func (s *Property) IsStatic() bool

IsStatic returns whether a property is static

func (*Property) ReferenceFQN

func (s *Property) ReferenceFQN() string

ReferenceFQN returns the FQN of the property

func (*Property) ReferenceLocation

func (s *Property) ReferenceLocation() protocol.Location

ReferenceLocation returns the location of the property's name

func (*Property) ScopeTypeString

func (s *Property) ScopeTypeString() TypeString

ScopeTypeString returns the class scope of the property

func (*Property) Serialise

func (s *Property) Serialise(e *storage.Encoder)

func (*Property) Visibility

func (s *Property) Visibility() VisibilityModifierValue

Visibility returns the visibility modifier value for the property

type PropertyAccess

type PropertyAccess struct {
	MemberAccessExpression
	// contains filtered or unexported fields
}

func (*PropertyAccess) GetLocation

func (s *PropertyAccess) GetLocation() protocol.Location

func (*PropertyAccess) GetScopeTypes

func (s *PropertyAccess) GetScopeTypes() TypeComposite

func (*PropertyAccess) GetTypes

func (s *PropertyAccess) GetTypes() TypeComposite

func (*PropertyAccess) MemberName

func (s *PropertyAccess) MemberName() string

func (*PropertyAccess) Resolve

func (s *PropertyAccess) Resolve(ctx ResolveContext)

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query is a wrapper around store

func NewQuery

func NewQuery(store *Store) *Query

NewQuery creates a new query, a query should not outlive a request

func (*Query) GetClassClassConsts

func (q *Query) GetClassClassConsts(class *Class, name string, searchedFQNs map[string]struct{}) InheritedClassConst

GetClassClassConsts returns the inherited class const

func (*Query) GetClassConstructor

func (q *Query) GetClassConstructor(class *Class) MethodWithScope

GetClassConstructor returns the constructor of the given class including the inherited constructor from parent

func (*Query) GetClassConsts

func (q *Query) GetClassConsts(scope string, name string) []*ClassConst

GetClassConsts is a cached proxy to store

func (*Query) GetClassMethods

func (q *Query) GetClassMethods(class *Class, name string, searchedFQNs map[string]struct{}) InheritedMethods

GetClassMethods returns all methods from the given class, its extends and implements

func (*Query) GetClassProps

func (q *Query) GetClassProps(class *Class, name string, searchedFQNs map[string]struct{}) InheritedProps

GetClassProps gets all properties for a class

func (*Query) GetClasses

func (q *Query) GetClasses(name string) []*Class

GetClasses is a cached proxy behind store

func (*Query) GetConsts

func (q *Query) GetConsts(name string) []*Const

GetConsts is a cached proxy behind store

func (*Query) GetDefines

func (q *Query) GetDefines(name string) []*Define

GetDefines is a cached proxy behind store

func (*Query) GetFunctions

func (q *Query) GetFunctions(name string) []*Function

GetFunctions is a cached proxy behind store

func (*Query) GetGlobalVariables

func (q *Query) GetGlobalVariables(name string) []*GlobalVariable

GetGlobalVariables returns global variables with the given name

func (*Query) GetInterfaceClassConsts

func (q *Query) GetInterfaceClassConsts(intf *Interface, name string, searchedFQNs map[string]struct{}) InheritedClassConst

GetInterfaceClassConsts returns the class consts of the interface

func (*Query) GetInterfaceMethods

func (q *Query) GetInterfaceMethods(intf *Interface, name string, searchedFQNs map[string]struct{}) InheritedMethods

GetInterfaceMethods returns all methods from the given interface and its extends

func (*Query) GetInterfaceProps

func (q *Query) GetInterfaceProps(intf *Interface, name string, searchedFQNs map[string]struct{}) InheritedProps

GetInterfaceProps gets all properties for an interface

func (*Query) GetInterfaces

func (q *Query) GetInterfaces(name string) []*Interface

GetInterfaces is a cached proxy behind store

func (*Query) GetMethods

func (q *Query) GetMethods(scope string, name string) []*Method

GetMethods searches for all methods under the given scope, this function does not consider inheritance, if name is empty this will return all methods

func (*Query) GetProps

func (q *Query) GetProps(scope, name string) []*Property

GetProps is a cached proxy to store

func (*Query) GetTraitMethods

func (q *Query) GetTraitMethods(trait *Trait, name string) InheritedMethods

GetTraitMethods returns all methods from the given trait and name

func (*Query) GetTraits

func (q *Query) GetTraits(name string) []*Trait

GetTraits is a cached proxy behind store

func (*Query) SearchClassClassConsts

func (q *Query) SearchClassClassConsts(class *Class, keyword string, searchedFQNs map[string]struct{}) InheritedClassConst

SearchClassClassConsts searches for class consts using fuzzy match

func (*Query) SearchClassMethods

func (q *Query) SearchClassMethods(class *Class, keyword string, searchedFQNs map[string]struct{}) InheritedMethods

SearchClassMethods searches methods using fuzzy

func (*Query) SearchClassProps

func (q *Query) SearchClassProps(class *Class, keyword string, searchedFQNs map[string]struct{}) InheritedProps

SearchClassProps searches for class props using fuzzy match

func (*Query) SearchInterfaceClassConsts

func (q *Query) SearchInterfaceClassConsts(intf *Interface, keyword string, searchedFQNs map[string]struct{}) InheritedClassConst

SearchInterfaceClassConsts searches for class consts using fuzzy match

func (*Query) SearchInterfaceMethods

func (q *Query) SearchInterfaceMethods(intf *Interface, keyword string, searchedFQNs map[string]struct{}) InheritedMethods

SearchInterfaceMethods searches methods using fuzzy

func (*Query) SearchInterfaceProps

func (q *Query) SearchInterfaceProps(intf *Interface, keyword string, searchedFQNs map[string]struct{}) InheritedProps

SearchInterfaceProps searches for class props using fuzzy match

func (Query) Store

func (q Query) Store() *Store

Store returns the store of the query

type RelationMap

type RelationMap map[string]Relations

RelationMap is the map for relationships

func (RelationMap) IsRelated

func (r RelationMap) IsRelated(thisFQN string, otherFQN string) bool

IsRelated checks if this FQN is related to other FQN

func (RelationMap) Merge

func (r RelationMap) Merge(other RelationMap)

Merge merges other relation map to current

func (RelationMap) Relate

func (r RelationMap) Relate(thisFQN string, otherFQN string)

Relate sets the related FQNs

type Relations

type Relations map[string]struct{}

Relations represents the related FQNs

func (Relations) IsRelated

func (r Relations) IsRelated(otherFQN string) bool

IsRelated checks if the other FQN is related

func (Relations) Relate

func (r Relations) Relate(otherFQN string)

Relate sets the related FQNs

type RelativeScope

type RelativeScope struct {
	Types TypeComposite
	// contains filtered or unexported fields
}

func (*RelativeScope) GetLocation

func (s *RelativeScope) GetLocation() protocol.Location

func (*RelativeScope) GetTypes

func (s *RelativeScope) GetTypes() TypeComposite

func (*RelativeScope) Resolve

func (s *RelativeScope) Resolve(ctx ResolveContext)

type ResolveContext

type ResolveContext struct {
	// contains filtered or unexported fields
}

ResolveContext contains query and document

func NewResolveContext

func NewResolveContext(query *Query, document *Document) ResolveContext

NewResolveContext creates a resolve context

type ScopedConstantAccess

type ScopedConstantAccess struct {
	MemberAccessExpression
}

ScopedConstantAccess represents a reference to constant in class access, e.g. ::CONSTANT

func (*ScopedConstantAccess) GetLocation

func (s *ScopedConstantAccess) GetLocation() protocol.Location

func (*ScopedConstantAccess) GetScopeTypes

func (s *ScopedConstantAccess) GetScopeTypes() TypeComposite

GetScopeTypes returns the types of the scope

func (*ScopedConstantAccess) GetTypes

func (s *ScopedConstantAccess) GetTypes() TypeComposite

func (*ScopedConstantAccess) MemberName

func (s *ScopedConstantAccess) MemberName() string

MemberName returns the class constant name

type ScopedMethodAccess

type ScopedMethodAccess struct {
	MemberAccessExpression
	// contains filtered or unexported fields
}

ScopedMethodAccess represents a reference to method in class access, e.g. ::method()

func (*ScopedMethodAccess) GetLocation

func (s *ScopedMethodAccess) GetLocation() protocol.Location

func (*ScopedMethodAccess) GetScopeTypes

func (s *ScopedMethodAccess) GetScopeTypes() TypeComposite

func (*ScopedMethodAccess) GetTypes

func (s *ScopedMethodAccess) GetTypes() TypeComposite

func (*ScopedMethodAccess) MemberName

func (s *ScopedMethodAccess) MemberName() string

func (*ScopedMethodAccess) Resolve

func (s *ScopedMethodAccess) Resolve(ctx ResolveContext)

func (*ScopedMethodAccess) ResolveToHasParams

func (s *ScopedMethodAccess) ResolveToHasParams(ctx ResolveContext) []HasParams

type ScopedPropertyAccess

type ScopedPropertyAccess struct {
	MemberAccessExpression
	// contains filtered or unexported fields
}

ScopedPropertyAccess represents a reference to property in scoped class access, e.g. ::$property

func (*ScopedPropertyAccess) GetLocation

func (s *ScopedPropertyAccess) GetLocation() protocol.Location

func (*ScopedPropertyAccess) GetScopeTypes

func (s *ScopedPropertyAccess) GetScopeTypes() TypeComposite

func (*ScopedPropertyAccess) GetTypes

func (s *ScopedPropertyAccess) GetTypes() TypeComposite

func (*ScopedPropertyAccess) MemberName

func (s *ScopedPropertyAccess) MemberName() string

func (*ScopedPropertyAccess) Resolve

func (s *ScopedPropertyAccess) Resolve(ctx ResolveContext)

type SearchOptions

type SearchOptions struct {
	// contains filtered or unexported fields
}

SearchOptions contains predicates and limiter if applicable for searching symbols

func NewSearchOptions

func NewSearchOptions() SearchOptions

NewSearchOptions creates an empty search option

func (SearchOptions) IsLimitReached

func (s SearchOptions) IsLimitReached() bool

IsLimitReached returns true if the limitter reaches the limit

func (SearchOptions) WithLimit

func (s SearchOptions) WithLimit(limit int) SearchOptions

WithLimit adds a limiter into the search option

func (SearchOptions) WithPredicate

func (s SearchOptions) WithPredicate(predicate func(s Symbol) bool) SearchOptions

WithPredicate adds a predicate into the search option

type SearchResult

type SearchResult struct {
	IsComplete bool
}

type Store

type Store struct {
	FS protocol.FS

	DebouncedDeprecation func(func())
	// contains filtered or unexported fields
}

Store contains information about a given folder and functions for querying symbols

func NewStore

func NewStore(fs protocol.FS, uri protocol.DocumentURI, storePath string) (*Store, error)

NewStore creates a store with the disk storage or returns an error if the disk storage cannot be created

func (*Store) Clear

func (s *Store) Clear()

Clear triggers a disk clear

func (*Store) Close

func (s *Store) Close()

Close triggers close on the fuzzy engine, and closes the disk storage

func (*Store) CloseDocument

func (s *Store) CloseDocument(ctx context.Context, uri protocol.DocumentURI)

CloseDocument syncs the document with the given URI and marks it as close to release memory

func (*Store) CompareAndIndexDocument

func (s *Store) CompareAndIndexDocument(ctx context.Context, uri string) *Document

CompareAndIndexDocument compares the file's hash with the stored one on the disk, and if they are not matched load the document and sync. The pointer to the document is returned

func (*Store) DeleteDocument

func (s *Store) DeleteDocument(uri protocol.DocumentURI)

DeleteDocument deletes all symbols and indexes relating to the URI this returns error if the disk cannot be written

func (*Store) DeleteFolder

func (s *Store) DeleteFolder(uri protocol.DocumentURI)

DeleteFolder searches for documents and triggers `DeleteDocument`

func (*Store) FinishIndexing

func (s *Store) FinishIndexing()

FinishIndexing checks for all URIs that are not removed from the map and delete them, because if the file exists its URI should be removed from the map

func (*Store) GetAllClassConsts

func (s *Store) GetAllClassConsts(scope string) []*ClassConst

GetAllClassConsts returns all the class constants under the given scope. The word class is used loosely in here, which means it can be classes/interfaces/traits

func (*Store) GetAllMethods

func (s *Store) GetAllMethods(scope string) []*Method

GetAllMethods returns all the methods with the given scope. This function can be faster than `SearchMethods` for searching only methods under given scope, because this only scans methods which have the given scope

func (*Store) GetAllProperties

func (s *Store) GetAllProperties(scope string) []*Property

GetAllProperties searches all properties with the given scope from the disk storage

func (*Store) GetClassConsts

func (s *Store) GetClassConsts(scope string, name string) []*ClassConst

GetClassConsts searches all class constants with the given scope and name from the disk storage. The word class is used loosely in here which means it can be interfaces/traits

func (*Store) GetClasses

func (s *Store) GetClasses(name string) []*Class

GetClasses searches all classes with the given name

func (*Store) GetConsts

func (s *Store) GetConsts(name string) []*Const

GetConsts searches all the consts with the given name from the disk storage

func (*Store) GetDefines

func (s *Store) GetDefines(name string) []*Define

GetDefines searches all `define()` with the given name from the disk storage

func (*Store) GetFunctions

func (s *Store) GetFunctions(name string) []*Function

GetFunctions searches all functions with the given name from the disk storage

func (*Store) GetGlobalVariables

func (s *Store) GetGlobalVariables(name string) []*GlobalVariable

GetGlobalVariables searches all global variables with the given name from the disk storage

func (*Store) GetInterfaces

func (s *Store) GetInterfaces(name string) []*Interface

GetInterfaces searches all the interfaces with the given name from the disk storage

func (*Store) GetMethods

func (s *Store) GetMethods(scope string, name string) []*Method

GetMethods searches for all methods with the same scope and name as given

func (*Store) GetOrCreateDocument

func (s *Store) GetOrCreateDocument(ctx context.Context, uri protocol.DocumentURI) *Document

GetOrCreateDocument checks if the store contains the given URI or create a new document with the given URI

func (*Store) GetProperties

func (s *Store) GetProperties(scope string, name string) []*Property

GetProperties searches all properties with the given scope and name from the disk storage

func (*Store) GetReferences

func (s *Store) GetReferences(ref string) []protocol.Location

GetReferences returns the locations of the reference to an FQN

func (*Store) GetStoreVersion

func (s *Store) GetStoreVersion() string

GetStoreVersion returns the version of the disk storage or v0.0.0 if the version is missing from the disk

func (*Store) GetTraits

func (s *Store) GetTraits(name string) []*Trait

GetTraits searches for all the traits with the given name from the disk storage

func (*Store) GetURI

func (s *Store) GetURI() protocol.DocumentURI

GetURI returns the store URI

func (*Store) LoadStubs

func (s *Store) LoadStubs()

LoadStubs loads the defined stubs, compare their hash and index them if needed

func (*Store) Migrate

func (s *Store) Migrate(newVersion string)

Migrate checks for defined version if it is less than clears the store

func (*Store) OpenDocument

func (s *Store) OpenDocument(ctx context.Context, uri protocol.DocumentURI) *Document

OpenDocument loads and index the document with the given URI, at the same time marks it as open to retain it on the memory

func (*Store) PrepareForIndexing

func (s *Store) PrepareForIndexing()

PrepareForIndexing loads all the synced documents from the disk storage into memory, this is to make sure that any deleted documents that are not yet synced, get deleted

func (*Store) PutVersion

func (s *Store) PutVersion(version string)

PutVersion stores the given version on the disk

func (*Store) SaveDocOnStore

func (s *Store) SaveDocOnStore(document *Document)

SaveDocOnStore retains the document in memory

func (*Store) SearchClassConsts

func (s *Store) SearchClassConsts(scope string, keyword string, options SearchOptions) ([]*ClassConst, SearchResult)

SearchClassConsts uses completion index to search class constants matching the given scope and keyword. If the scope is empty all matched class constants are returned. The word class is used loosely in here, which means it can be classes/interfaces/traits

func (*Store) SearchClasses

func (s *Store) SearchClasses(keyword string, options SearchOptions) ([]*Class, SearchResult)

SearchClasses uses the completion index to search for classes with the given keyword. `keyword` can contain scope \Namespace1\Cl

func (*Store) SearchConsts

func (s *Store) SearchConsts(keyword string, options SearchOptions) ([]*Const, SearchResult)

SearchConsts uses completion index to search constants matching the given keyword

func (*Store) SearchDefines

func (s *Store) SearchDefines(keyword string, options SearchOptions) ([]*Define, SearchResult)

SearchDefines uses completion index to search `define()`s matching the given keyword

func (*Store) SearchFunctions

func (s *Store) SearchFunctions(keyword string, options SearchOptions) ([]*Function, SearchResult)

SearchFunctions uses the completion index to search functions matching the given keyword. `keyword` can contain scope

func (*Store) SearchInterfaces

func (s *Store) SearchInterfaces(keyword string, options SearchOptions) ([]*Interface, SearchResult)

SearchInterfaces uses completion index to search for interfaces with the given keyword. `keyword` can contain scope \Namespace1\Cl

func (*Store) SearchMethods

func (s *Store) SearchMethods(scope string, keyword string, options SearchOptions) ([]*Method, SearchResult)

SearchMethods uses completion index to search methods matching the given scope and keyword. This function is slow and should only be used for searching method store-wide, because the completion index will scan through all the methods in the store and compare its scope. If the scope is "" all methods matching will be returned.

func (*Store) SearchNamespaces

func (s *Store) SearchNamespaces(keyword string, options SearchOptions) ([]string, SearchResult)

SearchNamespaces searches namespaces with the given keyword, and keyword can contain a namespace scope, e.g. Namespace1\NestedNams

func (*Store) SearchProperties

func (s *Store) SearchProperties(scope string, keyword string, options SearchOptions) ([]*Property, SearchResult)

SearchProperties uses completion index to search properties matching the given scope and name. If the scope is "", this will forward to `GetAllProperties`, and ignore keyword

func (*Store) SearchTraits

func (s *Store) SearchTraits(keyword string, options SearchOptions) ([]*Trait, SearchResult)

SearchTraits uses completion index to search traits matching the given keyword. `keyword` can contain scope

func (*Store) SyncDocument

func (s *Store) SyncDocument(document *Document)

SyncDocument writes all definition symbols and indexes to the disk or the fuzzy engine

type Symbol

type Symbol interface {
	GetLocation() protocol.Location
}

Symbol is a symbol

type SymbolReference

type SymbolReference interface {
	Symbol
	ReferenceFQN() string
	ReferenceLocation() protocol.Location
}

SymbolReference is a reference to the symbol itself

type Trait

type Trait struct {
	Name TypeString
	// contains filtered or unexported fields
}

Trait contains information of a trait

func ReadTrait

func ReadTrait(d *storage.Decoder) *Trait

func (*Trait) GetChildren

func (s *Trait) GetChildren() []Symbol

func (*Trait) GetCollection

func (s *Trait) GetCollection() string

func (*Trait) GetDescription

func (s *Trait) GetDescription() string

func (*Trait) GetIndexCollection

func (s *Trait) GetIndexCollection() string

func (*Trait) GetIndexableName

func (s *Trait) GetIndexableName() string

func (*Trait) GetKey

func (s *Trait) GetKey() string

func (*Trait) GetLocation

func (s *Trait) GetLocation() protocol.Location

func (*Trait) GetName

func (s *Trait) GetName() string

func (*Trait) Serialise

func (s *Trait) Serialise(e *storage.Encoder)

type TraitAccess

type TraitAccess struct {
	Expression
}

func (*TraitAccess) GetLocation

func (s *TraitAccess) GetLocation() protocol.Location

func (*TraitAccess) GetTypes

func (s *TraitAccess) GetTypes() TypeComposite

type TypeComposite

type TypeComposite struct {
	// contains filtered or unexported fields
}

TypeComposite contains multiple type strings

func ReadTypeComposite

func ReadTypeComposite(d *storage.Decoder) TypeComposite

func (TypeComposite) IsEmpty

func (t TypeComposite) IsEmpty() bool

func (TypeComposite) MarshalJSON

func (t TypeComposite) MarshalJSON() ([]byte, error)

MarshalJSON marshals TypeComposite to JSON

func (TypeComposite) Resolve

func (t TypeComposite) Resolve() []TypeString

Resolve resolves the type to slice of TypeString

func (TypeComposite) ToString

func (t TypeComposite) ToString() string

func (*TypeComposite) Write

func (t *TypeComposite) Write(e *storage.Encoder)

type TypeDeclaration

type TypeDeclaration struct {
	Expression
}

TypeDeclaration is type declaration for a symbol

func (*TypeDeclaration) GetLocation

func (s *TypeDeclaration) GetLocation() protocol.Location

func (*TypeDeclaration) GetTypes

func (s *TypeDeclaration) GetTypes() TypeComposite

type TypeString

type TypeString struct {
	// contains filtered or unexported fields
}

TypeString contains fqn and original name of type

func NewTypeString

func NewTypeString(typeString string) TypeString

func ReadTypeString

func ReadTypeString(d *storage.Decoder) TypeString

func (TypeString) Dearray

func (t TypeString) Dearray() (TypeString, bool)

func (TypeString) FirstPart

func (t TypeString) FirstPart() string

func (TypeString) GetFQN

func (t TypeString) GetFQN() string

GetFQN gets the FQN converted name

func (TypeString) GetFirstAndRestParts

func (t TypeString) GetFirstAndRestParts() (string, []string)

func (TypeString) GetNamespace

func (t TypeString) GetNamespace() string

func (TypeString) GetOriginal

func (t TypeString) GetOriginal() string

GetOriginal gets original name

func (TypeString) GetParts

func (t TypeString) GetParts() []string

func (TypeString) IsEmpty

func (t TypeString) IsEmpty() bool

IsEmpty checks whether TypeString is empty

func (*TypeString) MarshalJSON

func (t *TypeString) MarshalJSON() ([]byte, error)

MarshalJSON is used for json.Marshal

func (*TypeString) SetFQN

func (t *TypeString) SetFQN(fqn string)

func (*TypeString) SetNamespace

func (t *TypeString) SetNamespace(namespace string)

func (TypeString) ToString

func (t TypeString) ToString() string

ToString returns the string representation of the type

func (TypeString) Write

func (t TypeString) Write(e *storage.Encoder)

type UseType

type UseType int

type Variable

type Variable struct {
	Expression
	// contains filtered or unexported fields
}

Variable represents a reference to the variable

func (*Variable) GetDescription

func (s *Variable) GetDescription() string

func (*Variable) GetDetail

func (s *Variable) GetDetail() string

func (*Variable) GetLocation

func (s *Variable) GetLocation() protocol.Location

func (*Variable) GetName

func (s *Variable) GetName() string

func (*Variable) GetTypes

func (s *Variable) GetTypes() TypeComposite

func (*Variable) Resolve

func (s *Variable) Resolve(ctx ResolveContext)

type VariableTable

type VariableTable struct {
	// contains filtered or unexported fields
}

VariableTable holds the range and the variables inside

func (*VariableTable) GetContextualVariables

func (vt *VariableTable) GetContextualVariables(name string) []contextualVariable

GetContextualVariables returns the variable instances with the given name

func (*VariableTable) GetVariables

func (vt *VariableTable) GetVariables(pos protocol.Position) []*Variable

GetVariables returns all the variables in the table

type VisibilityModifierValue

type VisibilityModifierValue int

VisibilityModifierValue is a value of visibility modifier (public, protected, private)

func (VisibilityModifierValue) ToString

func (v VisibilityModifierValue) ToString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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