================ @@ -14,10 +14,49 @@ export class LLDBDapDescriptorFactory this.lldbDapOptions = lldbDapOptions; } + public static async validateDebugAdapterPath(pathUri: vscode.Uri) { + try { + const fileStats = await vscode.workspace.fs.stat(pathUri); + if (!(fileStats.type & vscode.FileType.File)) { + this.showLLDBDapNotFoundMessage(pathUri.path); + } + } catch (err) { + this.showLLDBDapNotFoundMessage(pathUri.path); + } + } + async createDebugAdapterDescriptor( session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined, ): Promise<vscode.DebugAdapterDescriptor | undefined> { + const config = vscode.workspace.getConfiguration( + "lldb-dap", + session.workspaceFolder, + ); + const customPath = config.get<string>("executable-path"); + const path: string = customPath ? customPath : executable!!.command; + + await LLDBDapDescriptorFactory.validateDebugAdapterPath( + vscode.Uri.file(path), + ); return this.lldbDapOptions.createDapExecutableCommand(session, executable); ---------------- walter-erquinigo wrote:
What if `validateDebugAdapterPath` returns a boolean, and then, in the case of success, you return `createDapExecutableCommand`, and otherwise you throw an exception? I have the impression that that would be managed better by the IDE, otherwise you could be launching a session with a missing binary https://github.com/llvm/llvm-project/pull/104711 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits