Skip to content

Commit c730ec9

Browse files
Merge branch 'master' into fix-192
2 parents 08ef7a5 + b345ea8 commit c730ec9

17 files changed

+382
-73
lines changed
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
module.exports = {
2-
parser: "@typescript-eslint/parser",
3-
parserOptions: {
4-
ecmaVersion: 2018,
5-
sourceType: "module",
6-
project: "./tsconfig.json"
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"ecmaVersion": 2018,
5+
"sourceType": "module",
6+
"project": "./tsconfig.json"
77
},
8-
env: {
9-
es6: true,
10-
node: true
8+
"env": {
9+
"es6": true,
10+
"node": true
1111
},
12-
extends: [
12+
"extends": [
1313
"eslint:recommended",
1414
"plugin:@typescript-eslint/recommended",
1515
"plugin:@typescript-eslint/eslint-recommended",
1616
"prettier",
1717
"prettier/@typescript-eslint",
1818
"plugin:prettier/recommended"
1919
],
20-
plugins: ["@typescript-eslint"],
21-
rules: {
20+
"plugins": [
21+
"@typescript-eslint"
22+
],
23+
"rules": {
2224
"@typescript-eslint/no-explicit-any": 0,
2325
"@typescript-eslint/explicit-function-return-type": 0,
2426
"@typescript-eslint/no-unused-vars": 0
2527
}
26-
};
28+
}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
node_modules/
22
.idea
33
*.iml
4-
.vscode/**
54
.vscode-test/
65
out/
76
dist/

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"esbenp.prettier-vscode",
4+
"dbaeumer.vscode-eslint",
5+
"EditorConfig.EditorConfig"
6+
]
7+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[typescript]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"editor.formatOnSave": true
5+
},
6+
}

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
# Change Log
22

3+
## [0.8.7]
4+
- Use `intersystems.servers` object for more flexible connection definitions.
5+
- Recommend [intersystems-community.servermanager](https://marketplace.visualstudio.com/items?itemName=intersystems-community.servermanager) extension for management of `intersystems.servers` definitions.
6+
- Support server-side source control and other server-side commands.
7+
- Add `isfs-readonly` scheme to give readonly access to server code.
8+
- Improve class snippets and implement snippets for routines.
9+
- Be less strict about spaces in header of routines.
10+
- Handle `objectscript.format.commandCase` set to invalid value.
11+
- Make command titles conform to VS Code style.
12+
- Support compilation for more file types.
13+
- Display CSP and Other files in ObjectScript Explorer.
14+
- Add option to show system files in ObjectScript Explorer.
15+
- Make `View Another Namespace...` command in ObjectScript Explorer only apply to the selected server.
16+
- Fix several issues with terminal in Docker.
17+
- Fix some debugging issues.
18+
- Respect original EndOfLine in file when loading changes from server.
19+
- Alert on import error.
20+
- Resolve diagnostic issue in html style block.
21+
- Added diagnostic to warn if non-latin characters found in class element.
22+
- Webpack extension to reduce size.
23+
24+
## [0.8.6] - 2020-04-23
25+
- Support $ETRAP system variable.
26+
- Fix opening Docker terminal.
27+
28+
## [0.8.5] - 2020-04-20
29+
- Fix errors in embedded JS code.
30+
- Fix diagnostic error for values in quotes.
31+
32+
## [0.8.3] - 2020-03-23
33+
- Support for custom address in isfs.
34+
- Multi select in explorer view for mass export.
35+
36+
## [0.8.2] - 2020-03-04
37+
- Show current place (label+pos^routine) in status bar for INT code.
38+
- Fix syntax highlighting.
39+
- Support for ${namespace} in links.
40+
41+
## [0.8.1] - 2020-02-06
42+
- Some small fixes in filtering for isfs.
43+
- Fixed connection info in Explorer.
44+
- Extra links for server.
45+
- Support creating classes, routines, webapp files on isfs.
46+
- Some fixes in formatting provider.
47+
- Option to suppress error messages.
48+
- Ignore case for script and sql in diagnostics.
49+
- Option to disable `debug this method` action.
50+
- Password prompt, live connection status.
51+
352
## [0.8.0]
453
- "Debug this ClassMethod" feature added, to quickly debug any classmethod in a class
554
- Change variable value while debugging

README.md

Lines changed: 98 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@
1010

1111
[InterSystems](http://www.intersystems.com/our-products/) ObjectScript language support for Visual Studio Code.
1212

13-
14-
[CaretDev](https://caretdev.com/#products) provides commercial support services. [Request a Quote](https://caretdev.com/contact-us/).
15-
16-
On-line course from CaretDev - [Developing with VSCode ObjectScript – Easy Start](https://caretdev.com/courses/).
17-
18-
1913
## Features
2014

2115
- InterSystems ObjectScript code highlighting support.
2216
![example](https://raw.githubusercontent.com/intersystems-community/vscode-objectscript/master/images/screenshot.png)
23-
- Debugging ObjectScript code
17+
- Debugging ObjectScript code.
2418
- Intellisense support for commands, system functions, and class members.
2519
- Export existing sources to the working directory: press Cmd/Ctrl+Shift+P, type 'ObjectScript', press Enter.
26-
- Save and compile a class: press <kbd>Ctrl</kbd>+<kbd>F7</kbd> (<kbd>⌘</kbd>+<kbd>F7</kbd>) or select "ObjectScript: Save and compile" from <kbd>Cmd</kbd>/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> menu.
27-
- Server Explorer with possibility to export items![ServerExplorer](https://raw.githubusercontent.com/intersystems-community/vscode-objectscript/master/images/explorer.png)
28-
- Edit directly on server
20+
- Save and compile a class: press <kbd>Ctrl</kbd>+<kbd>F7</kbd> (<kbd>⌘</kbd>+<kbd>F7</kbd>) or select "ObjectScript: Import and Compile Current File" from <kbd>Cmd</kbd>/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> menu.
21+
- Direct access to edit or view server code VSCode Explorer via `isfs` and `isfs-readonly` FileSystemProviders (e.g. using a [multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces)).
22+
- Server Explorer view (ObjectScript: Explorer) with ability to export items to working directory. ![ServerExplorer](https://raw.githubusercontent.com/intersystems-community/vscode-objectscript/master/images/explorer.png)
2923

3024
## Installation
3125

@@ -35,33 +29,109 @@ Open VSCode. Go to extensions and search for "ObjectScript" like it is shown on
3529
Or install from ObjectScript extension page on [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript)
3630
![installation](https://raw.githubusercontent.com/intersystems-community/vscode-objectscript/master/images/installation.gif)
3731

38-
## Configure connection
32+
## Configure Connection
33+
34+
To be able to use many features you first need to configure the connection to your IRIS/Caché/Ensemble server(s) in your [VSCode settings](https://code.visualstudio.com/docs/getstarted/settings). If you are unfamiliar with how settings work and how they are edited, use that link.
35+
36+
We recommend you define server connections in the `intersystems.servers` object whose structure is defined by the [InterSystems Server Manager](https://marketplace.visualstudio.com/items?itemName=intersystems-community.servermanager) helper extension. Install this extension to get assistance when editing the JSON definition. For example:
37+
38+
```json
39+
"intersystems.servers": {
40+
"local": {
41+
"webServer": {
42+
"scheme": "http",
43+
"host": "127.0.0.1",
44+
"port": 52773
45+
},
46+
"description": "My local IRIS",
47+
"username": "me"
48+
}
49+
}
50+
```
51+
Setting the `username` property is optional. If omitted it will be prompted for when connecting.
52+
53+
By defining connections in your User Settings they become available for use by any workspace you open in VSCode.
54+
55+
### Client-side Editing
56+
57+
A workspace consisting of a local working directory in which you edit InterSystems source files and manage them using client-side source control (e.g. Git) will use the `objectscript.conn` settings object to access the server for export (compile) and debug, and also for import. This is usually defined in Workspace Settings, for example in the `.vscode/settings.json` file of your working directory.
58+
59+
We recommend that `objectscript.conn` uses its `server` property to point to an entry in `intersystems.servers`. For example:
3960

40-
To be able to use many plugin features, you need to configure the connection to Caché/IRIS server first. You can create or edit existing `.vscode/settings.json` file. So, your settings file may look something like this.
41-
```JSON
61+
```json
4262
"objectscript.conn": {
4363
"active": true,
44-
"label": "LOCAL",
45-
"host": "127.0.0.1",
46-
"port": 52773,
47-
"username": "user",
48-
"password": "password",
49-
"ns": "USER",
50-
"https": false
64+
"server": "local",
65+
"ns": "USER"
5166
}
52-
```
67+
```
68+
69+
The mandatory `ns` property defines which server namespace you will work with. If `username` is set here it overrides that setting from the `intersystems.servers` entry.
70+
71+
### Server-side Editing
72+
73+
To edit code directly in one or more namespaces on one or more servers (local or remote) we recommend creating a workspace definition file (XYZ.code-workspace) in which you specify one or more root folders that directly access namespaces via the `isfs` or `isfs-readonly` URI schemes. The only difference between these two schemes is that any file opened from a folder using the `isfs-readonly` scheme will be set as readonly in VSCode and thus protected against changing.
74+
75+
1. Start VSCode.
76+
2. If your last-used folder opens, use 'Close Folder' on the 'File' menu ('Code' menu on macOS). Or if what opened was your last-used workspace, use 'Close Workspace'.
77+
3. Use 'Save Workspace As...' to create an empty file with a .code-workspace extension.
78+
4. Use the Command Palette to run 'Preferences: Open Workspace Settings (JSON)'.
79+
5. Add a `folders` array that defines one or more root folders for your workspace. The `uri` property of each folder specifies whether to use `isfs` or `isfs-readonly`, and which entry within `intersystems.servers` to get the connection definition from. All example here reference one named `local`. Add a `ns` query parameter to specify which namespace to access. Optionally add a `label` property to set the display name of the folder in Explorer. Optionally add a workspace-specific `settings` object to hide the ObjectScript Explorer view, which is not usually needed when working server-side in this way.
80+
81+
```json
82+
{
83+
"folders": [
84+
{
85+
"name": "local:USER",
86+
"uri": "isfs://local/?ns=USER"
87+
},
88+
{
89+
"name": "local:USER (readonly)",
90+
"uri": "isfs-readonly://local/?ns=USER"
91+
}
92+
],
93+
"settings": {
94+
"objectscript.showExplorer": false
95+
}
96+
}
97+
```
98+
99+
To access the server-side files of a web application, format your `uri` property like this:
53100

54-
Or you can edit it through settings editor. Which you can open from menu *Code* > *Preferences* > *Settings* for macOS or *File* > *Preferences* > *Settings* for Windows, search for "workspace settings" through Command Palette [<kbd>⌘⇧P</kbd>/<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>] or by shortcut [<kbd>⌘</kbd>+<kbd>,</kbd>/<kbd>Ctrl</kbd>+<kbd>,</kbd>].
101+
```json
102+
{
103+
"uri": "isfs://local/csp/user/?&csp&ns=USER"
104+
}
105+
```
106+
The `csp` query parameter indicates web application files are to be shown. The uri path specifies which application. The `ns` parameter must specify the same namespace the application is configured to use.
107+
108+
To see only classes in the X.Y package, format the uri like this:
109+
110+
```json
111+
{
112+
"uri": "isfs://local/X/Y?ns=USER&type=cls"
113+
}
114+
```
55115

56-
- Find a 'objectscript', do not forget to set `active` to `true`
57-
`port` should follow to web port of instance (usually by default, `57772` for Caché/Ensemble, `52773` for IRIS) ![Settings UI](https://raw.githubusercontent.com/intersystems-community/vscode-objectscript/master/images/settings.png)
58-
- Change settings according to your Caché/IRIS instance
59-
- You will see related output in "Output" while switched to "ObjectScript" channel (right drop-down menu on top of the output window)
116+
Other query parameters that can be specified:
117+
- `type=cls` to show only classes, or `type=rtn` to show only routines.
118+
- `flat=1` to flatten the hierarchy.
119+
- `generated=1` to show generated items.
120+
- `filter=filterspec` to use a filter specification formatted in the same way as used in InterSystems Studio's File Open dialog (e.g. `filter=Ensem*.inc`).
60121

61122
## Notes
62123

63-
For Caché/IRIS instance with maximum security level, add `%Development` role for `/api/atelier/` web-application ( [More](https://community.intersystems.com/post/using-atelier-rest-api) )
64-
If you are getting `ERROR #5540: SQLCODE: -99 Message: User xxx is not privileged for the operation` when you try to get/refresh class/routine/includes lists, grant a following SQL Procedure to your user on target namespace.
124+
Connection-related output appears in the "Output" view while switched to the "ObjectScript" channel using the drop-down menu on the view titlebar.
125+
126+
For Caché/IRIS instance with maximum security level, add `%Development` role for `/api/atelier/` web-application ([read more](https://community.intersystems.com/post/using-atelier-rest-api)).
127+
128+
If you are getting `ERROR #5540: SQLCODE: -99 Message: User xxx is not privileged for the operation` when you try to get/refresh class/routine/includes lists, grant your username (or a SQL role you hold) execute permission for the following SQL Procedure in the target namespace.
65129
```SQL
66130
GRANT EXECUTE ON %Library.RoutineMgr_StudioOpenDialog TO xxx
67131
```
132+
133+
## Support and Training
134+
135+
[CaretDev](https://caretdev.com/#products) provides commercial support services. [Request a Quote](https://caretdev.com/contact-us/).
136+
137+
On-line course from CaretDev - [Developing with VSCode ObjectScript – Easy Start](https://caretdev.com/courses/).

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"onCommand:vscode-objectscript.explorer.openClass",
5959
"onCommand:vscode-objectscript.explorer.openRoutine",
6060
"onCommand:vscode-objectscript.compileFolder",
61+
"onCommand:vscode-objectscript.importFolder",
6162
"onLanguage:objectscript",
6263
"onLanguage:objectscript-class",
6364
"onLanguage:objectscript-macros",
@@ -262,7 +263,12 @@
262263
"explorer/context": [
263264
{
264265
"command": "vscode-objectscript.compileFolder",
265-
"when": "vscode-objectscript.connectActive",
266+
"when": "vscode-objectscript.connectActive && resourceScheme == file",
267+
"group": "objectscript@1"
268+
},
269+
{
270+
"command": "vscode-objectscript.importFolder",
271+
"when": "vscode-objectscript.connectActive && resourceScheme == file",
266272
"group": "objectscript@1"
267273
},
268274
{
@@ -478,6 +484,11 @@
478484
"command": "vscode-objectscript.compileFolder",
479485
"title": "Import and Compile"
480486
},
487+
{
488+
"category": "ObjectScript",
489+
"command": "vscode-objectscript.importFolder",
490+
"title": "Import without Compilation"
491+
},
481492
{
482493
"category": "ObjectScript",
483494
"command": "vscode-objectscript.serverCommands.sourceControl",
@@ -610,6 +621,10 @@
610621
"file": {
611622
"description": "Name of docker-compose file.",
612623
"type": "string"
624+
},
625+
"envFile": {
626+
"description": "Name of env-file for docker-compose configuration.",
627+
"type": "string"
613628
}
614629
}
615630
}

src/api/atelier.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface Document {
3131
status: string;
3232
enc: boolean;
3333
flags: number;
34-
content: string[];
34+
content: string[] | Buffer;
3535
ext: string;
3636
}
3737

src/api/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export class AtelierAPI {
378378
}
379379

380380
// api v1+
381-
public getDoc(name: string, format?: string): Promise<Atelier.Response> {
381+
public getDoc(name: string, format?: string): Promise<Atelier.Response<Atelier.Document>> {
382382
let params = {};
383383
if (format) {
384384
params = {
@@ -397,12 +397,16 @@ export class AtelierAPI {
397397
// v1+
398398
public putDoc(
399399
name: string,
400-
data: { enc: boolean; content: string[] },
400+
data: { enc: boolean; content: string[]; mtime: number },
401401
ignoreConflict?: boolean
402402
): Promise<Atelier.Response> {
403403
const params = { ignoreConflict };
404404
name = this.transformNameIfCsp(name);
405-
return this.request(1, "PUT", `${this.ns}/doc/${name}`, data, params);
405+
const headers = {};
406+
if (!ignoreConflict && data.mtime && data.mtime > 0) {
407+
headers["IF_NONE_MATCH"] = new Date(data.mtime).toISOString().replace(/T|Z/g, " ").trim();
408+
}
409+
return this.request(1, "PUT", `${this.ns}/doc/${name}`, data, params, headers);
406410
}
407411

408412
// v1+

0 commit comments

Comments
 (0)