From cbd0d01aee46f461013e8fdc269e956e2d83fb00 Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 20 Apr 2026 07:22:15 -0400 Subject: [PATCH] Add `objectscript.insertStubContent` setting --- package.json | 5 +++++ src/extension.ts | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f0ad7432..40c2ed7c 100644 --- a/package.json +++ b/package.json @@ -1561,6 +1561,11 @@ "description": "If true, REST requests and responses to and from InterSystems servers will be logged to the ObjectScript Output channel. This should only be enabled when debugging a potential issue.", "type": "boolean", "default": false + }, + "objectscript.insertStubContent": { + "description": "If true, stub content will be inserted when a blank new class or routine file is created in a client-side workspace folder.", + "type": "boolean", + "default": true } } }, diff --git a/src/extension.ts b/src/extension.ts index 775b926c..860018e5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -807,6 +807,7 @@ function sendWsFolderTelemetryEvent(wsFolders: readonly vscode.WorkspaceFolder[] dockerCompose: !serverSide ? String(typeof conf.get("conn.docker-compose") == "object") : undefined, "config.conn.links": String(Object.keys(conf.get("conn.links", {})).length), "config.refreshClassesOnSync": !serverSide ? conf.get("refreshClassesOnSync") : undefined, + "config.insertStubContent": !serverSide ? conf.get("insertStubContent") : undefined, }); }); } @@ -1409,8 +1410,14 @@ export async function activate(context: vscode.ExtensionContext): Promise { vscode.workspace.onDidCreateFiles((e: vscode.FileCreateEvent) => e.files // Attempt to fill in stub content for classes and routines that - // are not server-side files and were not created due to an export - .filter((f) => notIsfs(f) && isClassOrRtn(f.path) && !exportedUris.has(f.toString())) + // are client-side files and were not created due to an export + .filter( + (f) => + notIsfs(f) && + isClassOrRtn(f.path) && + !exportedUris.has(f.toString()) && + vscode.workspace.getConfiguration("objectscript", f).get("insertStubContent") + ) .forEach(async (uri) => { // Need to wait in case file was created using "Save As..." // because in that case the file gets created without