-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature: "Download latest language server" command for VS Code #3073
Comments
Is there any way around setting |
|
What I mean is: shouldn't only published versions of the client attempt to download the server? |
I am thinking that we might actually want want to have an explicit setting for "download the server",
|
I think another configuration property will bring unnecessary complexity and more invariants to preserve. Besides that, bundled binary should be the unspoken default and when we introduce
|
The problem with that is that they'll see the message every time, until they remove ra-lsp-server from path. But maybe that's OK? But, in general, there's a value in distinguishing between "no config is specified, so use a default" and "a default is explicitly specified", as the latter allows smother evolution (you can change the default without breaking existing users). |
My main concern is not to burden the users with tons of configuration and reading up the docs on them. The common user should download the extension and it should just work. If she uses some platform where we don't have suitable prebuilt binaries, then she should just build them herself and opt in to specify {
"rust-analyzer.raLspServerPath": null
} Though this is too unintuitive, as for me. |
I understand your concern too, maybe we need to investigate how other LSP projects tackle this. |
|
The approach of {
"rust-analyzer.language-server": {
"path": "/some/path" // "ra_lsp_server" is not treated specially (it just works through $PATH as now)
},
// "path" and "prebuilt" are mutually exclusive
"rust-analyzer.language-server": {
"download": "latest" // or "2020-02-10" or semver version if we switch to that...
// latest means autoupdates are "on" (when we implement them)
}
} Or if you don't like nesting, we may change these to |
I'd accept any config shape. I just want to get this work done by the upcoming release so that the users will be able to upgrade to the latest |
I actually think that Internally, we definitely should have a single config
Extenally, I think it would be useful if this config maps to a single property in the config. If there are two properties, we'll have trouble validating them both, and that wold be unclear for the user which one take precedence. The problem is that we don't have enums in JSON, but strings seems to be pretty self-explanatory:
Of course, by making certain string magical, we prevent cases like "what If I have a binary whcih is literarly called |
Yes, internally it will map to a single enum config property too. This already looks almost exactly like the Well, I am glad that we accepted the proposal to simplify the config to a single property. Though I am not sure that we should change the config in scope if implementing the Also, I'd like to add some bits to the initial algorithm for the command in the description.
For the first impl, I suggest to only override the |
@matklad, I have reevaluated this issue and I've found some drastic flaw in our current downloading process. I know you said that this might not be an issue, but please-please evaluate the following rationale carefully and rationally (very please):
Based on these statements I have concluded the following:
Based on the conclusions I'd like to propose the following:
If you have arguments to this, please refer to a specific statement and propose a better solution! I'd like you to think of not the closest, but more distant future. We've already implemented a solution for near-future, now we should improve it and make our release process stable and not care about it thereafter. |
- We cannot guarantee that in case of version drift between the frontend
and lsp server everything works fine.
I don’t thinks this is a significant problem, I feel “update to the latest
version” will work fine in the majority of cases, and will be simpler than
keeping explicit versions database. It also allows us to release servers
faster than clients, which is something we want for deploying hot fixes.
But my primary consideration is doing the simplest thing possible first.
…On Saturday, 15 February 2020, Veetaha ***@***.***> wrote:
@matklad <https://github.com/matklad>, I have reevaluated this issue and
I've found some drastic flaw in our current downloading process.
I know you said that this might not be an issue, but please-please
evaluate the following rationale carefully and rationally (very please):
- We download ra_lsp_server into globalStoragePath which (I checked)
is not cleared when you uninstall the extension, and probably (not checked)
also not cleared when you updated the extension through the marketplace.
- When the user updates to a new version of vscode TypeScript
extension we only check that the binary at globalStoragePath is
available, but we don't ensure that it's version is compatible with the
updated TypeScript extension. (I know you said not bothering about versions
and just suppose the user always has latest lsp server and frontend, but in
the current implementation we are actually creating the version
inconsistency ourselves!)
- We cannot guarantee that in case of version drift between the
frontend and lsp server everything works fine.
Based on these statements I have concluded the following:
- We *must* keep the version of lsp server and frontend equal to each
other by default. If the user wants to update his lsp server, he *is
ought to* update the frontend too (otherwise version drift).
- The user *may* opt in using a custom implementation of ra_lsp_server
(e.g. built from sources) by specifying a path to it, so that he manually
manages keeps the versions of his lsp server and frontend in sync.
Based on the conclusions I'd like to propose the following:
- We do not provide a "Download latest language server" command (close
*this* issue).
- The TypeScript extension never downloads the latest version of
ra_lsp_server, but instead downloads the version that is equal to the
version of TypeScript frontend itself.
- We check the availability of a new rust-analyzer release each time
the extension is activated and issue a pop-up info message that proposes
the user to update his extension (if she has auto-updates from marketplace
turned off).
- Upon extension activation we check the version of ra_lsp_server and
compare it with the version of TypeScript frontend itself. If they mismatch
we do download *the same* released version of ra_lsp_server from
github and override the existing binary.
If you have arguments to this, please refer to a specific statement and
propose a better solution! I'd like you to think of not the closest, but
more distant future. We've already implemented a solution for near-future,
now we should improve it and make our release process stable and not care
about it thereafter.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3073>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANB3M5KGLETRM2EBMM5BHDRC7VWFANCNFSM4KSEU7MA>
.
|
@matklad, I agree on doing the simplest possible thing first! It may seem that keeping versions in sync is the harder thing, though trust me, I didn't propose to keep explicit versions database in no sentence! And what do you mean by versions database? All the versions are kept at GitHub releases automatically and we just need to specify the release name to fetch the appropriate one for our TypeScript extension frontend. So upon each release we hardcode its name in our binaries so that the frontend knows which Besides that single statement, do you have arguments for the rest of my thinking? |
I am actually fine with either solution, but (without examining details to close), Like, we already have code to download the server. We only need to a) shutdown the existing server But, again, I haven't looked closely at the relevant APIs so I might be mistaking. |
The task is to implement
"Download latest language server"
command that the users will be able to use thru the command palette (by pressing Ctrl+Shift+P).This command does the following:
ra_lsp_server
prebuilt binary is greater or equal to the released one just exits earlyra_lsp_server
, then it is stopped$__RA_LSP_SERVER_DEBUG
env variable or"rust-analyzer.raLspServerPath"
are pointing to the prebuilt binary, i.e.~/.config/Code/User/globalStorage/matklad.rust-analyzer/ra_lsp_server-linux
the lsp server is shutdown.ra_lsp_server
process is not affected.ra_lsp_server-(linux|mac|windows.exe)
binary and stores (overwrites if it already exists) it inglobalStoragePath
ra_lsp_process
with the new downloaded binary if it was stopped.Notes:
I have already tried to implement this but failed to do this because I estimated that it would bring a lot of changes to code in existing PR. This is due to the design of our
class Config
inconfig.ts
. I initially wanted to update the config withWorkspaceConfig["update"]
method so that when issuing"Download latest language server"
commandrust-analyzer.raLspServer
setting is overwritten in the user'ssettings.json
. But this is a bit complex with the current config design and it is compilated to decide which VS Code config to update since it has the notion of default, user, workspace and workspace folder configs that are merged in lower-scope-first priority. Not sure whether we should try to overwritesettings.json
or not when issuing this command.What are you thoughts @matklad, @lnicola, @kiljacken, @bjorn3?
The text was updated successfully, but these errors were encountered: