[Lldb-commits] [lldb] [lldb-dap] show dialog when executable is not found (PR #104711)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 19 13:50:31 PDT 2024


================
@@ -23,31 +22,41 @@ function createDefaultLLDBDapOptions(): LLDBDapOptions {
         return packageJSONExecutable;
       }
 
-      try {
-        const fileStats = await fs.stat(path);
-        if (!fileStats.isFile() && !fileStats.isSymbolicLink()) {
-          throw new Error(`Error: ${path} is not a file`);
-        }
-      } catch (err) {
-        const error: Error = err as Error;
-        const openSettingsAction = "Open Settings";
-        const callBackValue = await vscode.window.showErrorMessage(
-          error.message,
-          { modal: true },
-          openSettingsAction,
-        );
-        if (openSettingsAction === callBackValue) {
-          vscode.commands.executeCommand(
-            "workbench.action.openSettings",
-            "lldb-dap.executable-path",
-          );
-        }
-      }
+      vscode.workspace.fs.stat(vscode.Uri.file(path)).then(
----------------
walter-erquinigo wrote:

could you make `createDefaultLLDBDapOptions` be an async function so that you can use `await` instead of `then`? it's way more readable

https://github.com/llvm/llvm-project/pull/104711


More information about the lldb-commits mailing list