-
Notifications
You must be signed in to change notification settings - Fork 161
Use local active toolchain as default for rust-client.channel #220
Conversation
| /** | ||
| * Parses given output of `rustup show` and retrieves the local active toolchain. | ||
| */ | ||
| export function parseActiveToolchain(rustupOutput: string): string { |
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.
This isn't async, since it needs to finish to return a value with which global RLSConfiguration is created.
For the same reason it only parses the result and it's not a complete function that uses CONFIGURATION.rustupPath value, since it's called during CONFIGURATION construction.
As a side note, the configuration probably will need to be redesigned later on, as currently it's a global that's lazily constructed once and doesn't handle 'rust-client.*' value changes
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.
Could you add the 'side note' as a FIXME or file an issue please?
39376b9 to
7cbc5ca
Compare
| /** | ||
| * Parses given output of `rustup show` and retrieves the local active toolchain. | ||
| */ | ||
| export function parseActiveToolchain(rustupOutput: string): string { |
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.
Could you add the 'side note' as a FIXME or file an issue please?
| * Tries to fetch the `rust-client.channel` configuration value. If it's null, | ||
| * then it tries to query active channel using rustup given at `rustupPath`. | ||
| */ | ||
| private static readChannel(rustupPath: string, configuration: WorkspaceConfiguration): string { |
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.
I think this whole function should live in rustup.ts, rather than here.
7cbc5ca to
be6e9fb
Compare
|
Done! Sorry it took so long, I forgot about it 😞 Can't think of a way to reliably test it (especially detecting local overrides) apart from using docker or a separate bash script that sets default toolchain to different one and tests the function output somehow with each change. |
|
Thanks! |
Fixes #179.
This allows the
'rust-client.channel'option to benulland if so, the extension tries to infer the active channel from runningrustup showin current workspace directory.Manually tested with alternating stable/nightly toolchain and also with a toolchain override (servo repo), but it'd be good to also include a test for that.
r? @nrc