================
@@ -0,0 +1,37 @@
+import * as vscode from "vscode";
+
+export class LaunchUriHandler implements vscode.UriHandler {
+    async handleUri(uri: vscode.Uri) {
+        try {
+            const params = new URLSearchParams(uri.query);
+            if (uri.path == '/launch/config') {
+                const configJson = params.get("config");
+                if (configJson === null) {
+                    throw new Error("Missing `config` URI parameter");
+                }
+                // Build the debug config
+                let debugConfig: vscode.DebugConfiguration = {
+                    type: 'lldb-dap',
+                    request: 'launch',
+                    name: '',
+                };
+                Object.assign(debugConfig, JSON.parse(configJson));
----------------
vogelsgesang wrote:

> I meant the type validation in the c++ land, we do some basic checks on the 
> types but we don't really report errors if something fails, for example:

Agree, we should probably verify the launch configurations in C++ more closely. 
I think we should take a similar approach to #130090 also for our launch 
config. That would be a different PR, though.

> We could do a basic sanity check on the typescript side of things to see if 
> the URL parameters look like they're correct.

I think we should keep the TypeScript layer as thin as possible. Implementing 
the validation in C++ has the benefit that it is reusable across clients (not 
only VS-Code). Furthermore, testing the C++ code is much easier. We have no 
test infrastructure in place for our TypeScript code

https://github.com/llvm/llvm-project/pull/125843
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to