Skip to content

Commit 0c52e61

Browse files
authored
Add objectscript.importOnSave setting (#985)
1 parent f7c5660 commit 0c52e61

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

docs/SettingsReference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ The extensions in the InterSystems ObjectScript Extension Pack provide many sett
6666
| `"objectscript.format.commandCase"` | Case for commands. | `"upper"`, `"lower"` or `"word"` | `"word"` | Has no effect if the `InterSystems Language Server` extension is installed and enabled. |
6767
| `"objectscript.format.functionCase"` | Case for system functions and system variables. | `"upper"`, `"lower"` or `"word"` | `"word"` | Has no effect if the `InterSystems Language Server` extension is installed and enabled. |
6868
| `"objectscript.ignoreInstallServerManager"` | Do not offer to install the [intersystems-community.servermanager](https://marketplace.visualstudio.com/items?itemName=intersystems-community.servermanager) extension. | `boolean` | `false` | |
69+
| `"objectscript.importOnSave"` | Automatically save a client-side InterSystems file on the server when saved in the editor. | `boolean` | `true` | |
6970
| `"objectscript.multilineMethodArgs"` | List method arguments on multiple lines, if the server supports it. | `boolean` | `false` | Only supported on IRIS 2019.1.2, 2020.1.1+, 2021.1.0+ and subsequent versions! On all other versions, this setting will have no effect. |
7071
| `"objectscript.openClassContracted"` | Automatically collapse all class member folding ranges when a class is opened for the first time. | `boolean` | `false` | |
7172
| `"objectscript.overwriteServerChanges"` | Overwrite a changed server version without confirmation when importing the local file. | `boolean` | `false` | |

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,11 @@
12981298
"type": "string",
12991299
"pattern": "^[^.]+$"
13001300
}
1301+
},
1302+
"objectscript.importOnSave": {
1303+
"description": "Automatically save a client-side InterSystems file on the server when saved in the editor.",
1304+
"type": "boolean",
1305+
"default": true
13011306
}
13021307
}
13031308
},

src/extension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,10 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
10231023
}
10241024
}),
10251025
vscode.workspace.onDidSaveTextDocument((file) => {
1026+
if (!schemas.includes(file.uri.scheme) && !config("importOnSave")) {
1027+
// Don't save this local file on the server
1028+
return;
1029+
}
10261030
if (schemas.includes(file.uri.scheme) || languages.includes(file.languageId)) {
10271031
if (documentBeingProcessed !== file) {
10281032
return importAndCompile(false, file, config("compileOnSave"));

0 commit comments

Comments
 (0)