Fixed isolated file indexing

This commit is contained in:
Martino Ferrari
2026-02-02 14:26:19 +01:00
parent d4075ff809
commit ff19fef779
6 changed files with 66 additions and 9 deletions

View File

@@ -182,7 +182,13 @@ func (pt *ProjectTree) AddFile(file string, config *parser.Configuration) {
}
if config.Package == nil {
pt.populateNode(pt.Root, file, config)
node := &ProjectNode{
Children: make(map[string]*ProjectNode),
Metadata: make(map[string]string),
Variables: make(map[string]VariableInfo),
}
pt.IsolatedFiles[file] = node
pt.populateNode(node, file, config)
return
}

View File

@@ -716,9 +716,16 @@ func HandleCompletion(params CompletionParams) *CompletionList {
return nil
}
func suggestGAMSignals(_ *index.ProjectNode, direction string) *CompletionList {
func suggestGAMSignals(container *index.ProjectNode, direction string) *CompletionList {
var items []CompletionItem
// Find scope root
root := container
for root.Parent != nil {
root = root.Parent
}
var walk func(*index.ProjectNode)
processNode := func(node *index.ProjectNode) {
if !isDataSource(node) {
return
@@ -776,7 +783,13 @@ func suggestGAMSignals(_ *index.ProjectNode, direction string) *CompletionList {
}
}
Tree.Walk(processNode)
walk = func(n *index.ProjectNode) {
processNode(n)
for _, child := range n.Children {
walk(child)
}
}
walk(root)
if len(items) > 0 {
return &CompletionList{Items: items}