================ @@ -0,0 +1,103 @@ +import * as vscode from "vscode"; +import * as child_process from "child_process"; +import * as util from "util"; +import { LLDBDapServer } from "./lldb-dap-server"; +import { createDebugAdapterExecutable } from "./debug-adapter-factory"; +import { ConfigureButton, showErrorMessage } from "./ui/show-error-message"; +import { ErrorWithNotification } from "./ui/error-with-notification"; + +const exec = util.promisify(child_process.execFile); + +/** + * Determines whether or not the given lldb-dap executable supports executing + * in server mode. + * + * @param exe the path to the lldb-dap executable + * @returns a boolean indicating whether or not lldb-dap supports server mode + */ +async function isServerModeSupported(exe: string): Promise<boolean> { + const { stdout } = await exec(exe, ["--help"]); + return /--connection/.test(stdout); +} + +export class LLDBDapConfigurationProvider + implements vscode.DebugConfigurationProvider +{ + constructor(private readonly server: LLDBDapServer) {} + + async resolveDebugConfiguration( + folder: vscode.WorkspaceFolder | undefined, + debugConfiguration: vscode.DebugConfiguration, ---------------- ashgti wrote:
I wonder if we should have our own type + validator for the debugConfiguration Something along the lines of: ```ts interface LLDBDebugConfiguration extends vscode.DebugConfiguration { type: 'lldb-dap'; request: 'launch' | 'attach'; program: string; args?: string[]; env?: Record<string, string>; debugAdapterHostname?: string; initCommands?: string[]; stopOnEntry?: boolean; } ... async resolveDebugConfiguration(folder, config) { assert(config, isLLDBDebugConfiguration); // config is of type LLDBDebugConfiguration ``` [TypeScript Playground example](https://www.typescriptlang.org/play/?target=9#code/PTAEFkEECUGkC5QDUCGAbAlgExQFwwPYB2oAEgKZoAO5ATgM4BQjuAnjaAMLG7kAeuUAF5Q9XLQxEA5gG0AugG4W7cqAAKeABbDR4ybMXM2HACoqA4gFcUtLAB5JoApcEmAfDoDejUKAAUAG7oiJZEANZEBADuRACUiEFooBj0oCZKvoHBoKER0UQANKAAxjz8uIjcRLwCRVRaAPyIGria8aCJyanpPqBS1rYAcigAtuSIYhLSSgC+yhyw5KyomDi4BLR27l6gMmrJJGFLBABmaXKIZjRWNvYme3JuCqAzSownocX4xKBY5CeScg3WxbNxZVZ4DaIcEhc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hn0+T8nQd9Iaw27QjTRGNKA41-t6ImggybRjAdzvof9vhM3Sh3nvNJaA-ApCFqdQj9B0PSHHph4KRAAjAdScQd9SsVa2BI6e9h3VK27prXWugDam1vjo3hhjBG2P6A4yDDtuAu09rCjhhSQnm0iehkdWGrGyNsUo70Ydo7x2TsE+g0jkEKKwQ4wLEM1693EBdYa-ablGBKpMEG3CmhVCwN9BlZg8sSG8DEJAegjzz2H0SLCPICJ3m3E+XdNwRRKX9ooxi8QrAMVYf8yC72-YYuMtPCUPAcb-DkEyRTegFE-TIYzJwMNUhNC4HTEUArp510+dwH5gLfhPCGRoF6r9fqii7kDUB0Mobw3QYOJ2gg3be04erigKSAAmOQdQk0psLJoDAVkBYvu3RZp1VmD2us8puJrLW0vtc9YN7rP6pJ9cA8G2D8HCaSek5NxA025sLeo7Rl2AskModTaGVb63CZbqvVx29+39qbiAA) This would help with the inline type validation being performed here. I could also follow up this CL with some of these validations. I think they could also help the URL launching service as well. https://github.com/llvm/llvm-project/pull/129262 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits