Skip to content

Commit 6ada70a

Browse files
authored
Add objectscript.insertStubContent setting (#1765)
1 parent b1f9368 commit 6ada70a

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
@@ -1547,6 +1547,11 @@
15471547
"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.",
15481548
"type": "boolean",
15491549
"default": false
1550+
},
1551+
"objectscript.insertStubContent": {
1552+
"description": "If true, stub content will be inserted when a blank new class or routine file is created in a client-side workspace folder.",
1553+
"type": "boolean",
1554+
"default": true
15501555
}
15511556
}
15521557
},

src/extension.ts

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

0 commit comments

Comments
 (0)