noverify
noverify copied to clipboard
Store all definition positions instead of only 1
If a symbol (function, class, etc) is defined more than once inside a project (or even a file), we could store a slice of positions instead of trying to choose one to keep and throwing away all other locations.
Proposed change: change the pos
field to be a slice of positions. A position at positions[0]
should probably map to a currently selected pos
.
info := meta.Info.GetFunction(name)
if len(info.Positions) == 1 {
// Function is globally unique
} else {
// More than 1 definition found
}
An alternative structure for indexing: https://gitlab.com/Serenata/Serenata/-/tree/master/src/Indexing/Structures
An ideia: Instead of keep a separated index for classes/traits/funcions..., rewrite the funcions getClass/getTrait... to search in all files and return an array
It's totally possible to store all definitions instead of one. That's more precise than choosing one definition and only add new positions for it. In the long run, I guess it's more right thing to do.
If we'll track autoload/require paths in the future, it will be possible to infer which definition is being used. That would be pretty neat.