mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-27 20:35:09 +00:00
Don't try to enable proposed API's on stable
This commit is contained in:
parent
f9494f1147
commit
be4977da7f
3 changed files with 17 additions and 21 deletions
|
@ -99,9 +99,11 @@ export async function createClient(config: Config, serverPath: string): Promise<
|
||||||
// Note that while the CallHierarchyFeature is stable the LSP protocol is not.
|
// Note that while the CallHierarchyFeature is stable the LSP protocol is not.
|
||||||
res.registerFeature(new CallHierarchyFeature(res));
|
res.registerFeature(new CallHierarchyFeature(res));
|
||||||
|
|
||||||
|
if (config.package.enableProposedApi) {
|
||||||
if (config.highlightingSemanticTokens) {
|
if (config.highlightingSemanticTokens) {
|
||||||
res.registerFeature(new SemanticTokensFeature(res));
|
res.registerFeature(new SemanticTokensFeature(res));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,11 @@ export class Config {
|
||||||
]
|
]
|
||||||
.map(opt => `${this.rootSection}.${opt}`);
|
.map(opt => `${this.rootSection}.${opt}`);
|
||||||
|
|
||||||
readonly packageJsonVersion: string = vscode
|
readonly package: {
|
||||||
.extensions
|
version: string;
|
||||||
.getExtension(this.extensionId)!
|
releaseTag: string | undefined;
|
||||||
.packageJSON
|
enableProposedApi: boolean | undefined;
|
||||||
.version;
|
} = vscode.extensions.getExtension(this.extensionId)!.packageJSON;
|
||||||
|
|
||||||
readonly releaseTag: string | undefined = vscode
|
|
||||||
.extensions
|
|
||||||
.getExtension(this.extensionId)!
|
|
||||||
.packageJSON
|
|
||||||
.releaseTag ?? undefined;
|
|
||||||
|
|
||||||
private cfg!: vscode.WorkspaceConfiguration;
|
private cfg!: vscode.WorkspaceConfiguration;
|
||||||
|
|
||||||
|
@ -62,7 +56,7 @@ export class Config {
|
||||||
const enableLogging = this.cfg.get("trace.extension") as boolean;
|
const enableLogging = this.cfg.get("trace.extension") as boolean;
|
||||||
log.setEnabled(enableLogging);
|
log.setEnabled(enableLogging);
|
||||||
log.debug(
|
log.debug(
|
||||||
"Extension version:", this.packageJsonVersion,
|
"Extension version:", this.package.version,
|
||||||
"using configuration:", this.cfg
|
"using configuration:", this.cfg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,9 @@ async function bootstrap(config: Config, state: PersistentState): Promise<string
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bootstrapExtension(config: Config, state: PersistentState): Promise<void> {
|
async function bootstrapExtension(config: Config, state: PersistentState): Promise<void> {
|
||||||
if (config.releaseTag === undefined) return;
|
if (config.package.releaseTag === undefined) return;
|
||||||
if (config.channel === "stable") {
|
if (config.channel === "stable") {
|
||||||
if (config.releaseTag === NIGHTLY_TAG) {
|
if (config.package.releaseTag === NIGHTLY_TAG) {
|
||||||
vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension.
|
vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension.
|
||||||
To switch to stable, uninstall the extension and re-install it from the marketplace`);
|
To switch to stable, uninstall the extension and re-install it from the marketplace`);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
|
||||||
}
|
}
|
||||||
return explicitPath;
|
return explicitPath;
|
||||||
};
|
};
|
||||||
if (config.releaseTag === undefined) return "rust-analyzer";
|
if (config.package.releaseTag === undefined) return "rust-analyzer";
|
||||||
|
|
||||||
let binaryName: string | undefined = undefined;
|
let binaryName: string | undefined = undefined;
|
||||||
if (process.arch === "x64" || process.arch === "x32") {
|
if (process.arch === "x64" || process.arch === "x32") {
|
||||||
|
@ -211,21 +211,21 @@ async function getServer(config: Config, state: PersistentState): Promise<string
|
||||||
await state.updateServerVersion(undefined);
|
await state.updateServerVersion(undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.serverVersion === config.packageJsonVersion) return dest;
|
if (state.serverVersion === config.package.version) return dest;
|
||||||
|
|
||||||
if (config.askBeforeDownload) {
|
if (config.askBeforeDownload) {
|
||||||
const userResponse = await vscode.window.showInformationMessage(
|
const userResponse = await vscode.window.showInformationMessage(
|
||||||
`Language server version ${config.packageJsonVersion} for rust-analyzer is not installed.`,
|
`Language server version ${config.package.version} for rust-analyzer is not installed.`,
|
||||||
"Download now"
|
"Download now"
|
||||||
);
|
);
|
||||||
if (userResponse !== "Download now") return dest;
|
if (userResponse !== "Download now") return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
const release = await fetchRelease(config.releaseTag);
|
const release = await fetchRelease(config.package.releaseTag);
|
||||||
const artifact = release.assets.find(artifact => artifact.name === binaryName);
|
const artifact = release.assets.find(artifact => artifact.name === binaryName);
|
||||||
assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
|
assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
|
||||||
|
|
||||||
await download(artifact.browser_download_url, dest, "Downloading rust-analyzer server", { mode: 0o755 });
|
await download(artifact.browser_download_url, dest, "Downloading rust-analyzer server", { mode: 0o755 });
|
||||||
await state.updateServerVersion(config.packageJsonVersion);
|
await state.updateServerVersion(config.package.version);
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue