From c99d2120db01e4d36071e91a9030992fa713da9a 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 eb509b63e..5a06aaf14 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", + "Continue anyway", + ); + + if (answer === "Open a workspace") { + await vscode.commands.executeCommand("workbench.action.files.openFolder"); + } + return; }