Auto merge of #14366 - Veykril:linked-proj, r=Veykril

feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects

cc https://github.com/rust-lang/rust-analyzer/issues/13226 https://github.com/rust-lang/rust-analyzer/issues/9661
This commit is contained in:
bors 2023-03-28 07:05:43 +00:00
commit 5bba438c9c
6 changed files with 74 additions and 15 deletions

View file

@ -82,6 +82,7 @@ export class Ctx {
private state: PersistentState;
private commandFactories: Record<string, CommandFactory>;
private commandDisposables: Disposable[];
private unlinkedFiles: vscode.Uri[];
get client() {
return this._client;
@ -94,11 +95,11 @@ export class Ctx {
) {
extCtx.subscriptions.push(this);
this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
this.statusBar.show();
this.workspace = workspace;
this.clientSubscriptions = [];
this.commandDisposables = [];
this.commandFactories = commandFactories;
this.unlinkedFiles = [];
this.state = new PersistentState(extCtx.globalState);
this.config = new Config(extCtx);
@ -218,7 +219,8 @@ export class Ctx {
this.outputChannel,
initializationOptions,
serverOptions,
this.config
this.config,
this.unlinkedFiles
);
this.pushClientCleanup(
this._client.onNotification(ra.serverStatus, (params) =>
@ -335,6 +337,7 @@ export class Ctx {
setServerStatus(status: ServerStatusParams | { health: "stopped" }) {
let icon = "";
const statusBar = this.statusBar;
statusBar.show();
statusBar.tooltip = new vscode.MarkdownString("", true);
statusBar.tooltip.isTrusted = true;
switch (status.health) {