================
@@ -137,53 +157,59 @@ export class LLDBDapDescriptorFactory
 
     const dbgOptions = {
       env: {
-        ...executable?.options?.env,
         ...configEnvironment,
         ...env,
       },
     };
-    const dbgArgs = executable?.args ?? [];
+    const dbgArgs = getDAPArguments(session);
 
-    const serverMode = config.get<boolean>('serverMode', false);
+    const serverMode = config.get<boolean>("serverMode", false);
     if (serverMode) {
-      const { host, port } = await this.startServer(dapPath, dbgArgs, 
dbgOptions);
+      const { host, port } = await this.startServer(
+        dapPath,
+        dbgArgs,
+        dbgOptions,
+      );
       return new vscode.DebugAdapterServer(port, host);
     }
 
     return new vscode.DebugAdapterExecutable(dapPath, dbgArgs, dbgOptions);
   }
 
-  startServer(dapPath: string, args: string[], options: 
child_process.CommonSpawnOptions): Promise<{ host: string, port: number }> {
-    if (this.server) return this.server;
+  startServer(
+    dapPath: string,
+    args: string[],
+    options: child_process.CommonSpawnOptions,
+  ): Promise<{ host: string; port: number }> {
+    if (this.server) {
+      return this.server;
+    }
 
-    this.server = new Promise(resolve => {
-      args.push(
-        '--connection',
-        'connect://localhost:0'
-      );
+    this.server = new Promise((resolve) => {
+      args.push("--connection", "connect://localhost:0");
       const server = child_process.spawn(dapPath, args, options);
-      server.stdout!.setEncoding('utf8').once('data', (data: string) => {
+      server.stdout!.setEncoding("utf8").once("data", (data: string) => {
         const connection = /connection:\/\/\[([^\]]+)\]:(\d+)/.exec(data);
         if (connection) {
           const host = connection[1];
           const port = Number(connection[2]);
           resolve({ process: server, host, port });
         }
       });
-      server.on('exit', () => {
+      server.on("exit", () => {
         this.server = undefined;
-      })
+      });
     });
     return this.server;
   }
 
   /**
    * Shows a message box when the debug adapter's path is not found
    */
-  static async showLLDBDapNotFoundMessage(path?: string) {
+  static async showLLDBDapNotFoundMessage(path?: string | undefined) {
----------------
vogelsgesang wrote:

Afaict, the `?` already marks `path` as potentially `undefined`? Why add the `| 
undefined` in addition?

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

Reply via email to