-
Notifications
You must be signed in to change notification settings - Fork 82
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
Create fake env when using a package dir as an env #498
base: main
Are you sure you want to change the base?
Conversation
Yeah, probably something like that... I'll also think a bit about this. Should we do this for v0.14.1? I don't feel it fixes a regression, right? This never worked :) |
Yeah, no rush. I just thought I'd put it down while I was thinking about it |
Codecov Report
@@ Coverage Diff @@
## master #498 +/- ##
==========================================
+ Coverage 28.77% 28.78% +<.01%
==========================================
Files 22 22
Lines 1557 1567 +10
==========================================
+ Hits 448 451 +3
- Misses 1109 1116 +7
Continue to review full report at Codecov.
|
Ok, thought about this a bit. I have some basic questions first :) Should we ever load anything that is defined in the current workspace folder via SymbolServer.jl? I had assumed that everything inside the current workspace folder (i.e. the thing open in VS Code) is actually handled by parsing files with CSTParser.jl, and then extracting the information from that? And that SymbolServer.jl is only used for things that are outside of the current workspace folder. If we are loading stuff from the current workspace via SymbolServer.jl, how are we actually handling updates? That stuff gets edited all the time, and we can't rerun SymbolServer.jl after each key stroke, right? In general we are trying to solve a problem for files outside the For those files we seem to have two problems: 1) if they do For 1), it seems to me that ideally we wouldn't modify at all what SymbolServer.jl does, but instead somehow expose the completion information that we already use when someone edits say For 2), things get tricky, because in that situation the files actually really run in a different env than the active env. But that is true not just for the situation where we open the package I think for 2) we probably need a more involved solution, that roughly looks like this: we assign a default active env to the root folder of the workspace, but we enable something where one can attach a different env to child folders as well. So essentially we would have multiple When we resolve names then in a file, we traverse the directory tree, until we find a folder that has an env attached to it and then use that store to resolve names there. These env might sometimes be based on concrete env, but sometimes they will be based on constructed/temp env, for example in the case of the We might need a call to sort this out? |
Oh, and some more random complications: whenever we create a temp env, do we have to instantiate it? I'd hate that because it would start to download stuff... But I also don't see how we could get around that. |
I'm just selectively picking out a few points:
This only acts on the path passed to the environment handling, so I imagine would only ever change if the user clicked the button at the bottom to change environments.
I think in this case the Project.toml has to be considered as its describing what to look for outside of the workspace folder.
Agreed, we could (when editing a package folder) determine which files are using the
I don't understand this? And the rest seems reasonable. A call would probably be useful to sort this out. I think the main thing is that I think this can be fixed without changing any SymServ behaviour (i think the code in this PR is all that would be needed) and that the rest could be handled by the language server |
I've not tried this but feel it should work. When the target env dir is a package it modifies the Project.toml, adding the parent package + packages in
extras
.