Skip to content

Commit cbd0d01

Browse files
committed
Add objectscript.insertStubContent setting
1 parent 000de6c commit cbd0d01

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,11 @@
15611561
"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.",
15621562
"type": "boolean",
15631563
"default": false
1564+
},
1565+
"objectscript.insertStubContent": {
1566+
"description": "If true, stub content will be inserted when a blank new class or routine file is created in a client-side workspace folder.",
1567+
"type": "boolean",
1568+
"default": true
15641569
}
15651570
}
15661571
},

src/extension.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ function sendWsFolderTelemetryEvent(wsFolders: readonly vscode.WorkspaceFolder[]
807807
dockerCompose: !serverSide ? String(typeof conf.get("conn.docker-compose") == "object") : undefined,
808808
"config.conn.links": String(Object.keys(conf.get("conn.links", {})).length),
809809
"config.refreshClassesOnSync": !serverSide ? conf.get("refreshClassesOnSync") : undefined,
810+
"config.insertStubContent": !serverSide ? conf.get("insertStubContent") : undefined,
810811
});
811812
});
812813
}
@@ -1409,8 +1410,14 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
14091410
vscode.workspace.onDidCreateFiles((e: vscode.FileCreateEvent) =>
14101411
e.files
14111412
// Attempt to fill in stub content for classes and routines that
1412-
// are not server-side files and were not created due to an export
1413-
.filter((f) => notIsfs(f) && isClassOrRtn(f.path) && !exportedUris.has(f.toString()))
1413+
// are client-side files and were not created due to an export
1414+
.filter(
1415+
(f) =>
1416+
notIsfs(f) &&
1417+
isClassOrRtn(f.path) &&
1418+
!exportedUris.has(f.toString()) &&
1419+
vscode.workspace.getConfiguration("objectscript", f).get<boolean>("insertStubContent")
1420+
)
14141421
.forEach(async (uri) => {
14151422
// Need to wait in case file was created using "Save As..."
14161423
// because in that case the file gets created without

0 commit comments

Comments
 (0)