From 20ec61bc8c108a5399bd699f470c5516808869fb Mon Sep 17 00:00:00 2001 From: William Zhao Date: Tue, 28 Jul 2026 15:55:39 -0700 Subject: [PATCH 1/2] add initial mandolin changes --- package.json | 42 +++++++++++++++++++++++++++++++++++++++++- src/extension.ts | 20 ++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 89ce4b3..8b4ddf6 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,47 @@ "markdownDescription": "Optional path to a .config.luau file containing lute lint configuration." } } - } + }, + "breakpoints": [{ "language": "luau" }], + "debuggers": [ + { + "type": "lute", + "label": "Lute Debugger", + "languages": ["luau"], + "configurationAttributes": { + "launch": { + "required": ["program"], + "properties": { + "program": { + "type": "string", + "description": "Absolute path to the Luau file to debug.", + "default": "${file}" + } + } + } + }, + "initialConfigurations": [ + { + "type": "lute", + "request": "launch", + "name": "Debug Luau File", + "program": "${file}" + } + ], + "configurationSnippets": [ + { + "label": "Lute Debug: Launch", + "description": "A new configuration for debugging a Luau file", + "body": { + "type": "lute", + "request": "launch", + "name": "Debug Luau File", + "program": "^\"\\${file}\"" + } + } + ] + } + ] }, "repository": { "type": "git", diff --git a/src/extension.ts b/src/extension.ts index 06a5785..7e3fb6e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -321,6 +321,26 @@ export async function activate(context: vscode.ExtensionContext) { vscode.workspace.textDocuments.forEach(lint); + context.subscriptions.push( + vscode.debug.registerDebugAdapterDescriptorFactory("lute", { + createDebugAdapterDescriptor(_session) { + const bundledLutePath = vscode.Uri.joinPath( + context.extensionUri, + "bin", + "lute" + ).fsPath; + const lutePath = + vscode.workspace + .getConfiguration("mandolin") + .get("luteExecPath", "") || + lutePathResult?.lutePath || + bundledLutePath; + log(`Starting debug adapter: ${lutePath} debug serve`); + return new vscode.DebugAdapterExecutable(lutePath, ["debug", "serve"]); + }, + }) + ); + log("Mandolin !"); } From e098afe6cf6a449692557dee0116c915a7cdbe50 Mon Sep 17 00:00:00 2001 From: William Zhao Date: Thu, 6 Aug 2026 18:05:30 -0700 Subject: [PATCH 2/2] add cwd to extension --- src/extension.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 7e3fb6e..cb284b3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -335,8 +335,17 @@ export async function activate(context: vscode.ExtensionContext) { .get("luteExecPath", "") || lutePathResult?.lutePath || bundledLutePath; - log(`Starting debug adapter: ${lutePath} debug serve`); - return new vscode.DebugAdapterExecutable(lutePath, ["debug", "serve"]); + const debugCwd = lutePathResult?.foremanToml + ? path.dirname(lutePathResult.foremanToml) + : _session.workspaceFolder?.uri.fsPath; + log( + `Starting debug adapter: ${lutePath} debug serve (cwd: ${debugCwd ?? `process default (${process.cwd()})`})` + ); + return new vscode.DebugAdapterExecutable( + lutePath, + ["debug", "serve"], + debugCwd ? { cwd: debugCwd } : undefined + ); }, }) );