Skip to content

Fix UndefVarError for PkgEntry #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

visr
Copy link

@visr visr commented Feb 25, 2025

Related to #294, avoids always processing all packages locally when using a custom JULIA_DEPOT_PATH.

The language server showed this log:

┌ Error: Symbol cache downloading: Failed to identify which packages to omit based on the General registry.
│ All packages will be processsed locally
│   err =
│    UndefVarError: `PkgEntry` not defined in `SymbolServer`
│    Suggestion: check for spelling errors or missing imports.
└ @ SymbolServer 

This UndefVarError lead to always erroring on the side of caution as mentioned here:

try
remove_non_general_pkgs!(to_download)
catch err
# if any errors, err on the side of caution and mark all as private, and continue
@error """
Symbol cache downloading: Failed to identify which packages to omit based on the General registry.
All packages will be processsed locally""" err
empty!(to_download)
end

EDIT: it doesn't seem to solve the whole problem.

Fixes julia-vscode#294.

The language server showed this log:

```
┌ Error: Symbol cache downloading: Failed to identify which packages to omit based on the General registry.
│ All packages will be processsed locally
│   err =
│    UndefVarError: `PkgEntry` not defined in `SymbolServer`
│    Suggestion: check for spelling errors or missing imports.
└ @ SymbolServer 
```

This UndefVarError lead to always erroring on the side of caution as mentioned here:

https://github.com/julia-vscode/SymbolServer.jl/blob/2201c26a43013a7bf71b4829ee4967e072070cab/src/SymbolServer.jl#L114-L122
pfitzseb
pfitzseb previously approved these changes Feb 25, 2025
@pfitzseb
Copy link
Member

Thanks!

@flexagoon
Copy link

@pfitzseb could you please merge this? The issue also has a side effect of always writing Pkg logs to ~/.julia regardless of the depot path, so it's pretty annoying

@visr
Copy link
Author

visr commented May 6, 2025

Would be great to have this merged.

@pfitzseb
Copy link
Member

pfitzseb commented May 7, 2025

This doesn't actually fix the issue on 1.6 or earlier:

julia> VERSION
v"1.6.7"

julia> using Pkg.Registry: PkgEntry
ERROR: UndefVarError: PkgEntry not defined

Comment on lines 56 to +58
return reg["packages"]
end
return Dict{UUID, PkgEntry}()
return Dict{String, Any}()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this empty Dict is the same type as reg["packages"]. The difference was already handled in remove_non_general_pkgs!.

@visr
Copy link
Author

visr commented May 20, 2025

Ok I've addressed that now.

Running this code locally still results in get_general_pkgs() being empty since my depot isn't in my homedir. I guess that means this doesn't fix #294, just a surface issue on top?

See also this discussion: #263 (comment)

How can we better find the General registry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants