diff --git a/package-lock.json b/package-lock.json index fbf93747..7e73b17b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-objectscript", - "version": "3.0.0-SNAPSHOT", + "version": "3.0.3-SNAPSHOT", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vscode-objectscript", - "version": "3.0.0-SNAPSHOT", + "version": "3.0.3-SNAPSHOT", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 358971bf..0cef7ac6 100644 --- a/package.json +++ b/package.json @@ -1476,9 +1476,19 @@ "default": false }, "objectscript.autoAdjustName": { - "markdownDescription": "Automatically modify the class name or ROUTINE header of a file in a client-side workspace folder to match the file's path when copying or moving a file. Uses the `#objectscript.export#` settings to determine the new name.", - "type": "boolean", - "default": false + "markdownDescription": "Automatically modify the class name or ROUTINE header of a file in a client-side workspace folder to match the file's path when: (Uses the `#objectscript.export#` settings to determine the new name.)", + "type": "string", + "enum": [ + "Never", + "Create", + "Create, Copy and Move" + ], + "enumDescriptions": [ + "Do not automatically adjust the name.", + "Create a matching class name / ROUTINE header when the file is first created.", + "Create or update an existing class name / ROUTINE header when the file is created, copied or moved." + ], + "default": "Create" }, "objectscript.compileOnSave": { "description": "Automatically compile an InterSystems file when saved in the editor.", diff --git a/src/extension.ts b/src/extension.ts index 523039a3..c634fbc7 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1262,12 +1262,16 @@ export async function activate(context: vscode.ExtensionContext): Promise { // No workspace folders are open return; } + if (vscode.workspace.getConfiguration("objectscript").get("autoAdjustName") === "Never") { + // Don't modify a file with content unless the user opts in + return; + } const sourceContent = await vscode.workspace.fs.readFile(uri); if ( - sourceContent.length && - !vscode.workspace.getConfiguration("objectscript").get("autoAdjustName") + sourceContent.length > 0 && + vscode.workspace.getConfiguration("objectscript").get("autoAdjustName") === "Create" ) { - // Don't modify a file with content unless the user opts in + // It has content, but user opted to not modify existing files return; } const workspacePath = uriOfWorkspaceFolder(workspace).fsPath;