-
Notifications
You must be signed in to change notification settings - Fork 90
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
support old hls versions compatible with the requested ghc version #506
Conversation
Hi, many thanks for working in that important feature to handle gracefully ghc deprecation. Dont worry my first experience with typescript also was working with the extension. Better than javascript 😉 I have read the code and i am getting it downloads the info for all releases. However i dont see how it search through them to find the newer hls version with support for the ghc at hand. To test this the more starightforwrd way would be add in the workflow script a ghc version which is not supported (like 8.10.5) and check all tests are green vscode-haskell/.github/workflows/test.yml Line 13 in 627b1da
|
This is here: There must be better ways to do this but my TypeScript foo is lacking. |
oh yeah, it was in front of my eyes, thanks. It looks fine to me if it is searching from newer to older, have you checked the ordering? |
Also i think this is important:
maybe users will prefer upgrade their ghc to use a newer version of hls |
the ordering is the correct one, examining https://api.github.com/repos/haskell/haskell-language-server/releases |
Done with 5178ed2 |
Tests has been succesfull! https://github.com/haskell/vscode-haskell/runs/4298441947?check_suite_focus=true
So the code works as intended 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mduerig looks really good, thanks.
I would change the naming scheme of functions and vars to make them consistent with the actual behaviour and add a window alert the first time the hls obsolete version is downloaded and a warning in the log each time it is used
Will do as soon as I get around to it. Thanks for reviewing. |
* Align identifier names with actual behaviour * rename latestApprovedRelease.cache.json to approvedRelease.cache.json * check for empty array of releases * alert and log when falling back to and older hls version
Another issue appears when upgrading the plugin. In this case |
oh, that's unfortunate, i guess if users had at some point the download active and then change to never-check the extension should be able to reuse the existing executables, am i understanding the issue correctly? not sure what can we do if that is the case, search for the executable in the storage path anyways? |
Correct. Maybe implement a fallback to the old file for |
i would try to not use a file which should be deprecated and forgotten in the code. It even could be deleted by the user to workaround some issue Other possible workarounds
|
…wnloading the releases fails
Here's how this could look like considering the old cache file (
I wouldn't worry too much about "deleted by the user" because in this case the behaviour is the same as before the changes here. In fact, deleting that file is probably the smoothest upgrade path. However, it bumps all GHC versions even for those who chose "never-check". The part about "deprecated and forgotten" is more worrisome...
The problem is that you don't know which version to search for. This information is in |
I think the cleanest upgrade path is to check for existence of |
You dont know but you can compute what is the newest one of all of them as you can extract the hls version from
Fair enough, it is working and we could remove it at some point i guess (or implement the file search in some other pr) |
…te or downloading the releases fails" This reverts commit 15c8951.
Here's the approach outlined before. I prefer this to my other approach because it implements a clean upgrade path and leaves behind less technical debt. |
Agree this could be the better solution, not caching the meta data at all. I guess it would simplify the whole logic overall. But IMO this is out of scope for this PR. I'm fine either way: merge any of the solutions I proposed here and refactor later or discard this PR and wait for the bigger refactoring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree this could be the better solution, not caching the meta data at all. I guess it would simplify the whole logic overall. But IMO this is out of scope for this PR. I'm fine either way: merge any of the solutions I proposed here and refactor later or discard this PR and wait for the bigger refactoring.
Dont worry the pr looks great as is, the final solution is good enough for now, we could refactor afterwards
Thanks a lot for tackle this!
Here's a simplistic PR for addressing #454. Probably too simplistic but maybe something to start with (I've never done any TypeScript before, and JavaScript last time in 1998 lol).
This PR cannot cope with prior versions of
latestApprovedRelease.cache.json
, so make sure to start with a clean local cache (on Linux at:~/.config/Code/User/globalStorage/haskell.haskell
.