[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 9 11:28:11 PST 2024


================
@@ -0,0 +1,57 @@
+import * as vscode from "vscode";
+import { LLDBDapOptions } from "./types";
+import { DisposableContext } from "./disposable-context";
+import { LLDBDapDescriptorFactory } from "./debug-adapter-factory";
+import * as fs from 'fs/promises'
+
+/**
+ * This creates the configurations for this project if used as a standalone
+ * extension.
+ */
+function createDefaultLLDBDapOptions(): LLDBDapOptions {
+  return {
+    debuggerType: "lldb-dap",
+    async createDapExecutableCommand(
+      session: vscode.DebugSession,
+      packageJSONExecutable: vscode.DebugAdapterExecutable | undefined,
+    ): Promise<vscode.DebugAdapterExecutable | undefined> {
+      const path = vscode.workspace
+        .getConfiguration("lldb-dap", session.workspaceFolder)
+        .get<string>("executable-path");
+      if (path) {
+        return new vscode.DebugAdapterExecutable(path, []);
+      }
+      return packageJSONExecutable;
+    },
+  };
+}
+
+/**
+ * This class represents the extension and manages its life cycle. Other extensions
+ * using it as as library should use this class as the main entry point.
+ */
+export class LLDBDapExtension extends DisposableContext {
+  private lldbDapOptions: LLDBDapOptions;
+
+  constructor(lldbDapOptions: LLDBDapOptions) {
+    super();
+    this.lldbDapOptions = lldbDapOptions;
+
+    vscode.window.showInformationMessage(this.lldbDapOptions.debuggerType);
----------------
walter-erquinigo wrote:

Ahh, good catch!

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


More information about the lldb-commits mailing list