From f9fa75d2d132e2ef327b81a6d0e6b0f79932ef04 Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Fri, 19 Jan 2024 15:02:42 +0530 Subject: [PATCH] Use `PackageFromDir()` for CompletionStore --- internal/lsp/completion.go | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/internal/lsp/completion.go b/internal/lsp/completion.go index 7d58f65..c0cfa56 100644 --- a/internal/lsp/completion.go +++ b/internal/lsp/completion.go @@ -194,28 +194,11 @@ func InitCompletionStore(dirs []string) *CompletionStore { } for _, p := range pkgDirs { - files, err := ListGnoFiles(p) + pkg, err := PackageFromDir(p, false) if err != nil { - // Ignore error - // Continue with rest of the packages continue } - symbols := []*Symbol{} - for _, file := range files { - symbols = append(symbols, getSymbols(file)...) - } - // convert to import path: - // get path relative to dir, and convert separators to slashes. - ip := strings.ReplaceAll( - strings.TrimPrefix(p, p+string(filepath.Separator)), - string(filepath.Separator), "/", - ) - - pkgs = append(pkgs, &Package{ - Name: filepath.Base(p), - ImportPath: ip, - Symbols: symbols, - }) + pkgs = append(pkgs, pkg) } return &CompletionStore{