Swap the file-path suggestions trie on the UI thread

GetFilePathSuggestionsFunc builds the trie on a worker (the slow
AllRepoFiles walk) and then assigned Model().FilesTrie and refreshed the
suggestions panel from there, racing the UI thread that reads the trie.
Keep the build on the worker but bounce just the model assignment and
the refresh through OnUIThread.
This commit is contained in:
Stefan Haller 2026-07-07 10:20:14 +02:00
parent 6cd93de5b9
commit 12757e2723

View file

@ -137,10 +137,12 @@ func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*type
trie.Insert(patricia.Prefix(file), file)
}
// cache the trie for future use
self.c.Model().FilesTrie = trie
self.c.Contexts().Suggestions.RefreshSuggestions()
self.c.OnUIThread(func() error {
// cache the trie for future use
self.c.Model().FilesTrie = trie
self.c.Contexts().Suggestions.RefreshSuggestions()
return nil
})
return err
})