Documentation
¶
Index ¶
- type PartialIndex
- type PartialLoadedIndex
- func (p *PartialLoadedIndex) GetSymbolInformation(symbol string) (*model.SymbolInformation, string, error)
- func (p *PartialLoadedIndex) GetSymbolInformationFromDescriptors(descriptors []model.Descriptor, version string) (*model.SymbolInformation, string, error)
- func (p *PartialLoadedIndex) Implementations(symbol string) ([]string, error)
- func (p *PartialLoadedIndex) LoadDocument(relativeDocPath string) (*model.Document, error)
- func (p *PartialLoadedIndex) LoadIndex(indexPath string, indexReader scanner.ScipReader) error
- func (p *PartialLoadedIndex) LoadIndexFile(file string) error
- func (p *PartialLoadedIndex) References(symbol string) (map[string][]*model.Occurrence, error)
- func (p *PartialLoadedIndex) SetDocumentLoadedCallback(callback func(*model.Document))
- func (p *PartialLoadedIndex) Tidy() error
- type SymbolPrefixTree
- type SymbolPrefixTreeNode
- func (t *SymbolPrefixTreeNode) AddSymbol(relativeDocPath string, info *model.SymbolInformation, revision int64) (node *SymbolPrefixTreeNode, isNew bool)
- func (t *SymbolPrefixTreeNode) GetNode(symbol string) *SymbolPrefixTreeNode
- func (t *SymbolPrefixTreeNode) Merge(other *SymbolPrefixTreeNode)
- func (t *SymbolPrefixTreeNode) PruneNodes(docPath string, revision int64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PartialIndex ¶
type PartialIndex interface {
SetDocumentLoadedCallback(func(*model.Document))
LoadIndex(indexPath string, indexReader scanner.ScipReader) error
LoadIndexFile(file string) error
LoadDocument(relativeDocPath string) (*model.Document, error)
GetSymbolInformation(symbol string) (*model.SymbolInformation, string, error)
GetSymbolInformationFromDescriptors(descriptors []model.Descriptor, version string) (*model.SymbolInformation, string, error)
References(symbol string) (map[string][]*model.Occurrence, error)
Implementations(symbol string) ([]string, error)
Tidy() error
}
PartialIndex is a partial index of a SCIP index
func NewPartialLoadedIndex ¶
func NewPartialLoadedIndex(indexFolder string) PartialIndex
NewPartialLoadedIndex creates a new PartialLoadedIndex
type PartialLoadedIndex ¶
type PartialLoadedIndex struct {
// PrefixTreeRoot is the root of the symbol prefix tree
PrefixTreeRoot *SymbolPrefixTree
// LoadedDocuments maps a document path to the SCIP Document
LoadedDocuments map[string]*model.Document
// DocTreeNodes maps a document path to each of the symbol prefix tree nodes that the doc refers to
DocTreeNodes map[string]*docNodes
ImplementorsBySymbol map[string]map[string]struct{}
// contains filtered or unexported fields
}
PartialLoadedIndex is a partial index of a SCIP index
func (*PartialLoadedIndex) GetSymbolInformation ¶
func (p *PartialLoadedIndex) GetSymbolInformation(symbol string) (*model.SymbolInformation, string, error)
GetSymbolInformation returns the symbol information for a given symbol as well as the document path where it was found
func (*PartialLoadedIndex) GetSymbolInformationFromDescriptors ¶
func (p *PartialLoadedIndex) GetSymbolInformationFromDescriptors(descriptors []model.Descriptor, version string) (*model.SymbolInformation, string, error)
GetSymbolInformationFromDescriptors accepts a slice of descriptors and returns the matching symbol information If version is specified, it will return the symbol information for the specified version If version is not specified, it will return the symbol information for the first version it finds
func (*PartialLoadedIndex) Implementations ¶
func (p *PartialLoadedIndex) Implementations(symbol string) ([]string, error)
Implementations returns the list of implementing symbols for a given abstract/interface symbol
func (*PartialLoadedIndex) LoadDocument ¶
func (p *PartialLoadedIndex) LoadDocument(relativeDocPath string) (*model.Document, error)
LoadDocument loads a document into the PartialLoadedIndex
func (*PartialLoadedIndex) LoadIndex ¶
func (p *PartialLoadedIndex) LoadIndex(indexPath string, indexReader scanner.ScipReader) error
LoadIndex loads a SCIP index into the PartialLoadedIndex
func (*PartialLoadedIndex) LoadIndexFile ¶
func (p *PartialLoadedIndex) LoadIndexFile(file string) error
LoadIndexFile loads a SCIP index file into the PartialLoadedIndex
func (*PartialLoadedIndex) References ¶
func (p *PartialLoadedIndex) References(symbol string) (map[string][]*model.Occurrence, error)
References returns the occurrences of a symbol in the index
func (*PartialLoadedIndex) SetDocumentLoadedCallback ¶
func (p *PartialLoadedIndex) SetDocumentLoadedCallback(callback func(*model.Document))
SetDocumentLoadedCallback sets the callback for when a document is loaded
func (*PartialLoadedIndex) Tidy ¶
func (p *PartialLoadedIndex) Tidy() error
Tidy prunes nodes for documents that were updated in the current revision
type SymbolPrefixTree ¶
type SymbolPrefixTree struct {
SymbolPrefixTreeNode
}
SymbolPrefixTree is a tree of SymbolPrefixTreeNodes
func NewSymbolPrefixTree ¶
func NewSymbolPrefixTree() *SymbolPrefixTree
NewSymbolPrefixTree creates a new SymbolPrefixTree
type SymbolPrefixTreeNode ¶
type SymbolPrefixTreeNode struct {
// Reference to the parent to make computing the identifier easier
Parent *SymbolPrefixTreeNode
// Preamble defines the part before the descriptor for this tree
Preamble string
// SymbolVersions is a map of symbol versions to their symbol information
SymbolVersions map[string]*struct {
// Info is the symbol information
// (if nil, no symbol by this name exists)
Info *model.SymbolInformation
// DocumentPath is the path to the document that this node belongs to
DocumentPath string
}
// Children defines any symbols further down the tree
Children map[model.Descriptor]*SymbolPrefixTreeNode
// Revision is the revision number when this node was last updated
Revision int64
}
SymbolPrefixTreeNode is a walkable tree that maps out all external symbols in loaded indices eg a symbol with path com.uber.devexp.Converter# will map down the tree as com->uber->devexp->Converter This tree can be used to lookup symbols by their path (and thus provide hover info), or to walk the tree for completion results. Leaf nodes are identified by the presence of the Info field.
func (*SymbolPrefixTreeNode) AddSymbol ¶
func (t *SymbolPrefixTreeNode) AddSymbol(relativeDocPath string, info *model.SymbolInformation, revision int64) (node *SymbolPrefixTreeNode, isNew bool)
AddSymbol adds a symbol to the tree
func (*SymbolPrefixTreeNode) GetNode ¶
func (t *SymbolPrefixTreeNode) GetNode(symbol string) *SymbolPrefixTreeNode
GetNode returns the node for the given symbol
func (*SymbolPrefixTreeNode) Merge ¶
func (t *SymbolPrefixTreeNode) Merge(other *SymbolPrefixTreeNode)
Merge merges another tree into this one
func (*SymbolPrefixTreeNode) PruneNodes ¶
func (t *SymbolPrefixTreeNode) PruneNodes(docPath string, revision int64)
PruneNodes removes nodes that are older than the given revision