From 1874bf217e0ade5b6bdb6e9c31621cb940d53c8d Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Mon, 10 Jun 2024 16:27:11 -0400 Subject: [PATCH] Display warning when launching with no workspaces --- vscode/src/extension.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vscode/src/extension.ts b/vscode/src/extension.ts index eb509b63e7..495218ef61 100644 --- a/vscode/src/extension.ts +++ b/vscode/src/extension.ts @@ -8,6 +8,19 @@ export async function activate(context: vscode.ExtensionContext) { await migrateManagerConfigurations(); if (!vscode.workspace.workspaceFolders) { + // We currently don't support usage without any workspace folders opened. Here we warn the user, point to the issue + // and offer to open a folder instead + const answer = await vscode.window.showWarningMessage( + `Using the Ruby LSP without any workspaces opened is currently not supported + ([learn more](https://github.com/Shopify/ruby-lsp/issues/1780))`, + "Open a workspace", + "Cancel", + ); + + if (answer === "Open a workspace") { + await vscode.commands.executeCommand("workbench.action.files.openFolder"); + } + return; }