-
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
Improve RA version display #3247
Conversation
PS: Thanks @bjorn3 for idea of |
@@ -108,6 +110,8 @@ function isBinaryAvailable(binaryPath: string): boolean { | |||
console.log("Checked binary availablity via --version", res); |
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.
Maybe we can stop logging to console if we add that command?
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.
Keeping it leaves all information necessary for debugging in one place.
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.
Yeah, but I feel we should log less stuff to console, possibly in favor of the output channel.
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 don’t have any strong opinion about it.
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.
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.
FYI just created an issue about logging #3250
@@ -8,6 +8,8 @@ import { BinarySource } from "./interfaces"; | |||
import { fetchArtifactReleaseInfo } from "./fetch_artifact_release_info"; | |||
import { downloadArtifact } from "./download_artifact"; | |||
|
|||
export var ServerVersion = ""; |
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.
Hmm, var
is deprecated.
Now we use the following analogies
Rust let
->TypeScript const
Rust let mut
-> TypeScript let
Also variables in TypeScript are generally camelCase...
Anyway, I'd like to propose the following:
Let's make getServerVersion()
public and add logic for obtaining the commit hash to command handler (to keep it simple).
export function serverVersion(): Cmd {
return ctx => {
const { serverSource } = ctx.config;
if (!serverSource) {
/* no prebuilt binary for this platform and no explicit path to binary specified */
}
if (serverSource.type === BinarySource.GithubRelease) {
const releaseName = getServerVersion(serverSource.storage);
...
}
const serverPath = serverSource.type === BinarySource.ExplicitPath
? serverSource.path
: path.join(serverSource.dir, serverSource.file);
const commitHash = spawnSync(serverPath, ["--version"], { encoding: "utf8" }).stdout;
...
};
}
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.
Hmm, var is deprecated.
Oh.. My main programming language in my current day job is C# 4.0 (Unity). It is so easy to mix up all different languages syntax.. T_T
@@ -108,6 +110,8 @@ function isBinaryAvailable(binaryPath: string): boolean { | |||
console.log("Checked binary availablity via --version", res); |
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.
8b427ae
to
0fa3646
Compare
bors r+ |
c2808d4
to
319a098
Compare
Seem like bors is stuck. Rebased. bors retry |
Build succeeded
|
Also, big 👍 from me on solving the general problem of "how do we find which rust-analyzer is used by this user" :) |
What about adding the release name to the message if the user utilizes prebuilt binaries? |
There are 2 problems of current implementation for displaying current version of RA binary:
If that binary is coming from built by source, the
REV
may not be updated somehow. (See discussion in Zuilp)We must go through the VSCode debugger console to see the output of
console.log
.This PR implemented a new VSCode command "Show RA Version" to display the version, which fixed the first problem. And added some
rerun-if
flags inbuild.rs
to fix the second one.