-
Notifications
You must be signed in to change notification settings - Fork 79
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
refactor: Do not use .metals for checking the metals version #1076
Conversation
@tanishiking I initially wanted to store it in inside settings but vscode doesn't allow writing into unknown fields. Every setting must be declared in |
Are you talking about the coursier mirror settings? Lines 28 to 31 in bfc4de1
https://scalameta.org/metals/docs/troubleshooting/proxy/ I don't have a plan to replace it with something else at least in this PR. I don't have a context why metals-vscode has settings to edit the coursier mirror properties, but I'm wondering why users want to configure it via metals-vscode instead of setting global coursier mirrors properties by themselves. |
It's just a bit more convenient for the users to have it metals instead of manually searching how to do it. |
return needCheckForUpdates(serverVersion, suggestUpgradeSetting.target); | ||
return needCheckForUpdates( | ||
serverVersion, | ||
suggestUpgradeSetting.target, |
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.
If I understand correctly, depending on where user set checkForUpdates
switch then version will be stored in that scope (global vs workspace), I'm right?
Here, because it's a simple boolean there are no such cases like with server version itself (where empty string in workspace is treated as a valid value and global setting is discarded)
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.
If I understand correctly, depending on where user set checkForUpdates switch then version will be stored in that scope (global vs workspace), I'm right?
Yes, you're right!
Here, because it's a simple boolean there are no such cases like with server version itself
What do you mean?
This is the same behavior with the previous one.
Do you mean, we should check for updating both Global and Workspace settings, even if suggetUpgradeSetting
is true
only in Global
or Workspace
?
In that case, I agree, but I think we can work on that in another issue / PR #1071
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.
@tanishiking I honestly don't remember what I was thinking and what I meant 😅 (even after reading my comment)
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.
haha, no worries! sorry for my delayed reply
8787175
to
dacf72c
Compare
Ok, it would be awesome if we could completely remove the usage of |
Also added unit test (while refactoring the project structure) for |
I understand what you mean, but it was really complicated for people to find the right place for where to put the file and it is far from obvious. Maybe it would be better to have mirror as a parameter in that case, but I think last time I checked that was not possible. And this was hard to get working right 😅 |
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.
Looks good!
I see, thank you for sharing the background! |
partially tackle #1143
This PR replaces
$PROJECT_DIR/.metals/versions-meta.json
and$HOME/.metals/versions-meta.json"
toworkspaceState
andglobalState
respectively.I remember someone has trouble because Metals creates
.metals
in their home directory (on Discord, but I couldn't find the link to the discussion).Anyway, it's best practice to use
context.globalState
(orworkspaceState
) for managing the state of the extension.