Skip to content

Commit 7e52e73

Browse files
authored
Merge pull request #618 from intersystems-community/revise-serverside
Revise serverside
2 parents bf2d52c + e03bcef commit 7e52e73

13 files changed

+87
-37
lines changed

docs/.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"objectscript.conn": {
3+
"server": "default~iris",
4+
"ns": "USER",
5+
"active": true
6+
}
7+
}

docs/Configuration.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,27 @@ nav_order: 3
66
---
77
# Configuration
88

9-
VS Code settings enable you to customize various aspects of its function. The InterSystems-provided extensions enable you to define InterSystems IRIS servers and the connections to those servers.
9+
VS Code settings enable you to customize various aspects of its function. The InterSystems extensions provide settings used to configure VS Code for ObjectScript development.
1010

1111
## Settings
1212

13-
Many available settings are general to VS Code, and you can learn about them in the [Visual Studio Code Documentation](https://code.visualstudio.com/docs). The InterSystems Server Manager and InterSystems ObjectScript extensions supply specific settings used to configure VS Code for ObjectScript development.
13+
Many available settings are general to VS Code, and you can learn about them in the [Visual Studio Code Documentation](https://code.visualstudio.com/docs). The InterSystems Server Manager and InterSystems ObjectScript extensions supply additional settings you can use to define InterSystems IRIS servers and connections to those servers.
14+
1415
There are several levels on which settings are stored and used:
1516

1617
- **User** - User settings are stored in a file location specific to you and apply globally to any instance of VS Code or any VS Code workspace that you open.
1718
- **Workspace** - Workspace settings are stored in a file inside the workspace and apply to anyone who opens the workspace.
1819
- **Folder** - If more than one folder is present in the workspace, you can select the folder where the settings file is stored by selecting from the Folder drop down list.
1920

20-
For example, the following screen shot shows Workspace selected:
21+
For example, the following screen shot shows the Workspace level selected:
2122

2223
![Workspace selected.](../assets/images/ClickWorkspace.png "workspace selected")
2324

2425
See the VS Code documentation section [User and Workspace Settings](https://code.visualstudio.com/docs/getstarted/settings).
2526

2627
## Configuring a Server
2728

28-
First, configure one or more servers. Select **View > Command Palette > InterSystems Server Manager: Store Password in Keychain**. This command lets you define a new server, as well as storing a password. Click the plus sign in the upper right corner of the dialog, as shown:
29+
First, configure one or more servers. Select **View > Command Palette > InterSystems Server Manager: Store Password in Keychain**. This command lets you define a new server and securely store a password in the system keychain. Click the plus sign in the upper right corner of the dialog, as shown:
2930

3031
![Define New Server.](../assets/images/new-server.png "define new server")
3132

@@ -37,7 +38,9 @@ Provide the following values when prompted:
3738
- **Username** - the username to use in logging in to this server.
3839
- **Confirm connection type** - the protocol used for connections, possible values are **http** and **https**.
3940

40-
Once you have entered these values, the server definition is stored in your user settings. At that point another prompt appears, asking for a password to store in the system Keychain. Enter the password for the username supplied earlier to complete the process.
41+
Once you have entered these values, the server definition is stored in your user settings. At that point another prompt appears, asking for a password to store in the system keychain. Enter the password for the username supplied earlier to complete the process. Storing a password is optional. You can terminate the process and store the server configuration by pressing either **Escape** or **Return**. If you do not store a password, users are prompted for a password each time they connect to the server.
42+
43+
You can create a configuration for a server that is not currently running.
4144

4245
## Editing a Server Configuration
4346

@@ -80,7 +83,15 @@ If you do not store the password securely in the system Keychain or add it to th
8083

8184
## Configuring a Server Connection
8285

83-
Open the folder where you want client-side files to be located. Select the **ObjectScript Explorer** button which has been added to the Activity Bar. Select the **Choose Server and Namespace** button. This action opens a dialog that lets you select a server, or create a new one. Once you have selected a server and namespace, connection configuration is complete.
86+
Open the folder where you want client-side files to be located. Select the **ObjectScript Explorer** button on the Activity Bar. Select the **Choose Server and Namespace** button. This action opens a dialog that lets you select a server, or create a new one. Once you have selected a server and namespace, connection configuration is complete. VS Code adds the server and namespace to the status bar, as shown in the following screen shot.
87+
88+
![Connection information in the status bar.](../assets/images/action-for-server-start.png "connection information in the status bar")
89+
90+
You cannot create a connection to a server that is not running.
91+
92+
Click on the server and namespace in the status bar to open a list of actions you can take for this server:
93+
94+
![Select action for server.](../assets/images/action-for-server.png "select action for server")
8495

8596
## Editing a Server Connection
8697

@@ -92,7 +103,7 @@ The connection configuration looks like this:
92103
"objectscript.conn": {
93104
"ns": "USER",
94105
"server": "iris-1",
95-
"active": true,
106+
"active": true,
96107
},
97108
```
98109

docs/RunDebug.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,28 @@ nav_order: 4
66
---
77
# Running and Debugging
88

9-
In order to run or debug an ObjectScript class or routine, you must create a launch configuration. Click the run button in the Activity Bar:
9+
The InterSystems ObjectScript Extension provides support for ObjectScript debugging. It takes advantage of the debugging capabilities built into VS Code, so you may find these VS Code documentation resources useful:
10+
11+
- [Node.js debugging in VS Code](https://code.visualstudio.com/docs/editor/debugging)
12+
- [Debugging](https://code.visualstudio.com/docs/editor/debugging)
13+
14+
## Launch Configurations
15+
16+
In order to run or debug an ObjectScript class or routine, you must create a launch configuration. Some other languages default to running the currently active file, but to run ObjectScript, you must specify the routine or ClassMethod to use.
17+
18+
Click the run button in the Activity Bar:
19+
20+
![Run button.](../assets/images/run.png "run button")
1021

1122
If no launch configurations are available, you are prompted to create one:
1223

1324
![Create launch configuration.](../assets/images/CreateLaunchConfig.png "create launch configuration")
1425

15-
Clicking the link creates and opens a `launch.json` file containing the following default information:
26+
Clicking the link opens a dialog containing a list of debug environments. Select **ObjectScript Debug**.
27+
28+
![Select debug environment.](../assets/images/debug-environment.png "select debug environment")
29+
30+
Once you have chosen a debug environment, VS Code creates and opens a `launch.json` file containing the following default content:
1631

1732
```json
1833
{
@@ -33,7 +48,7 @@ These attributes are mandatory for any launch configuration:
3348
- **request** - Identifies the type of action for this launch configuration. Possible values are `launch` and `attach`.
3449
- **name** - An arbitrary name to identify the configuration. This name appears in the Start Debugging drop down list.
3550

36-
In addition, for an **objectscript** configuration, you need to supply the attribute **program**, which specifies the executable or file to run when launching the debugger, as shown in the following example:
51+
In addition, for an **objectscript** configuration, you need to supply the attribute **program**, which specifies the routine or ClassMethod to run when launching the debugger, as shown in the following example:
3752

3853
```json
3954
"launch": {
@@ -49,10 +64,19 @@ In addition, for an **objectscript** configuration, you need to supply the attri
4964
{
5065
"type": "objectscript",
5166
"request": "launch",
52-
"name": "ObjectScript Debug GoodbyWorld",
53-
"program": "##class(Test.MyOtherClass).GoodbyWorld()",
67+
"name": "ObjectScript Debug GoodbyeWorld",
68+
"program": "##class(Test.MyOtherClass).GoodbyeWorld()",
5469
},
5570
]
5671
}
5772
```
5873

74+
## Launching a ClassMethod or Routine
75+
76+
You can select a launch configuration from the list VS Code provides in the Run and Debug field at the top of the debug side bar:
77+
78+
![Select launch configuration.](../assets/images/select-config.png "select launch configuration")
79+
80+
Clicking on the green arrow runs the currently selected launch configuration.
81+
82+
Debugging commands and items on the **Run** menu function much as they do for other languages supported by VS Code. For information on VS Code debugging, see the documentation resources listed at the start of this section.

docs/ServerSide.md

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,63 @@ title: Server-side Editing
44
permalink: /serverside/
55
nav_order: 5
66
---
7-
# VS Code Workspaces
7+
{: #code-workspaces}
8+
# VS Code Workspaces
89

9-
To work with VS Code, you need to open a workspace. A VS Code workspace is usually just the root folder of your project. Workspace settings as well as debugging and task configurations are stored in the root folder in a folder called .vscode.
10+
To work with VS Code, you need to open a workspace. A VS Code workspace can be just the root folder of your project. Workspace settings as well as debugging and task configurations are stored in the root folder in a folder called .vscode.
1011

1112
If you need to have more than one root folder in a VS Code workspace, use a feature called multi-root workspaces. See [Multi-root Workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces) in the VS Code documentation.
1213

13-
A multi root workspace contains a \*.code-workspace file. The file can have any name followed by *.code-workspace*, for example `test.code-workspace`. The .code-workspace file stores information about what folders are in the workspace. Other settings that would otherwise be stored in the settings.json or launch.json file can be stored in the .code-workspace file. You can optionally have a workspace file even if you are not using the multi-root feature.
14+
A multi root workspace contains a \*.code-workspace file. The file can have any name followed by *.code-workspace*, for example `test.code-workspace`. The .code-workspace file stores information about what folders are in the workspace. Other settings that would otherwise be stored in the settings.json or launch.json files can be stored in the .code-workspace file. You can optionally have a workspace file even if you are not using the multi-root feature.
1415

15-
To edit a *.code-workspace* file in VS Code using the **InterSystems ObjectScript** extension, select **File > Preferences > Settings** (**Code > Preferences > Settings** on Mac) and select the Workspace option. When you click **Edit in settings.json**, VS Code opens the *.code-workspace* file for that workspace.
16+
To edit a *.code-workspace* file in VS Code using the **InterSystems ObjectScript** extension, select **File > Preferences > Settings** (**Code > Preferences > Settings** on Mac) and select the Workspace level. Search for **objectscript: conn**, and click on *Edit in settings.json*. VS Code opens the *.code-workspace* file for that workspace.
1617

1718
The **InterSystems ObjectScript** extension uses the multi-root workspaces feature to support ObjectScript development on the InterSystems server.
1819

19-
# Server-side Source Control
20+
# Configuration for Server-side Editing
2021

21-
You can configure the InterSystems ObjectScript extension to edit code directly on the server, using the [multi-root workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces) VS Code feature. This type of configuration is useful in cases where source code is stored in a Source Code Management (SCM) product interfaced to the server. For example you might already be using the Source Control menu in InterSystems Studio or Portal, implemented by a source control class that extends `%Studio.SourceControl.Base`.
22+
You can configure the InterSystems ObjectScript extension to edit code directly on the server, using the [multi-root workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces) VS Code feature. This type of configuration is useful in cases where source code is stored in a Source Code Management (SCM) product interfaced to the server. For example you might already be using the Source Control menu in InterSystems Studio or Portal, implemented by a source control class that extends `%Studio.SourceControl.Base`.
2223

2324
First configure the `intersystems.servers` entry for your server, as described in [Configuration](../configuration).
2425

25-
Next create a workspace for editing code direct on the server:
26+
Next create a workspace for editing code directly on the server:
2627

27-
1. Open VS Code. If a folder or workspace is already open, close it, for example by pressing <kbd>Ctrl/Cmd</kbd>+<kbd>K</kbd>, releasing that keypair, then pressing <kbd>F</kbd>.
28+
1. Open VS Code. You must perform the following steps starting with no folder or workspace open, so if a folder or workspace is already open, close it.
29+
1. Open the Explorer view if it is not already visible.
30+
1. Click the button labeled **Choose Server and Namespace** in the Explorer view, as shown in the following screen shot:
2831

29-
2. Open the Explorer view (<kbd>Ctrl/Cmd</kbd>+<kbd>Shift</kbd>+<kbd>E</kbd>) if it is not already visible.
32+
![Explorer view.](../assets/images/ss-explorer-view.png "explorer view")
33+
1. Pick a server from the list, or click the **+** sign to create a new server configuration:
3034

31-
3. When the button labeled "Choose Server and Namespace" appears, click it.
35+
![Choose a server.](../assets/images/ss-choose-server.png "choose a server")
36+
1. Enter credentials if prompted.
37+
1. Pick a namespace from the list retrieved from the target server:
3238

33-
4. Pick a server from your `intersystems.servers` settings object, or create a new server configuration.
39+
![Choose a namespace.](../assets/images/ss-choose-namespace.png "choose a namespace")
40+
1. Pick an access mode from the list:
3441

35-
5. Enter credentials if prompted.
42+
![Choose an access type.](../assets/images/ss-access-type.png "choose an access type")
43+
1. If you want to reopen this workspace in the future, use the command **File > Save Workspace As...** to save it as a `.code-workspace` file.
3644

37-
6. Pick a namespace from the list retrieved from the target server.
45+
Note that the ObjectScript button is not vivible in the Activity Bar, because the files listed in the Explorer view are all on the server, so it is not needed for this configuration.
3846

39-
7. Pick an access mode (Editable or Read-only).
40-
41-
8. If you want to reopen this workspace in future, save it as a `.code-workspace` file.
42-
43-
> Pro tip: The .code-workspace file you just created is a JSON file which can be edited directly. The Command Palette command `Preferences: Open Workspace Settings (JSON)` gets you there quickly. A simple example looks like this:
47+
The `.code-workspace` file is a JSON file which you can edit directly, as described in the section [VS Code Workspaces](#code-workspaces). A simple example looks like this:
4448
```json
4549
{
4650
"folders": [
4751
{
48-
"name": "test:USER",
49-
"uri": "isfs://test:user/"
52+
"name": "iris184:USER",
53+
"uri": "isfs://iris184/user"
5054
}
5155
],
5256
"settings": {}
5357
}
5458
```
55-
> The `name` property sets how the root folder is labeled and can be edited to suit your needs.
59+
- The `name` property provides a name for this server-side workspace.
60+
- The `uri` property indicates the location of resources on the server. The supplied value has three components:
61+
- The first component can be either `isfs` or `isfs-readonly`. These values specify that this folder is on an InterSystems IRIS server. `isfs-readonly` specifies read-only access.
62+
- The value following `://` specifies the name of the server.
63+
- The value follosing `/` specifies the namespace.
5664

5765
To add more root folders to your workspace, giving you access to code in a different namespace, or on a different server, use the context menu on your existing root folder to invoke the `Add Server Namespace to Workspace...` command. This command is also available on the Command Palette.
5866

@@ -61,12 +69,12 @@ An example of a two-folder workspace in which the second folder gives read-only
6169
{
6270
"folders": [
6371
{
64-
"name": "test:USER",
65-
"uri": "isfs://test:user/"
72+
"name": "iris184:USER",
73+
"uri": "isfs://iris184/user"
6674
},
6775
{
68-
"name": "test:%SYS (read-only)",
69-
"uri": "isfs-readonly://test:%sys/"
76+
"name": "iris184:%SYS (read-only)",
77+
"uri": "isfs-readonly://iris184/%sys"
7078
}
7179
],
7280
"settings": {}
6.27 KB
Loading
44.7 KB
Binary file not shown.
20.8 KB
Loading
8.28 KB
Loading

docs/assets/images/select-config.png

12.1 KB
Loading

docs/assets/images/ss-access-type.png

15.6 KB
Loading

0 commit comments

Comments
 (0)