Link Search Menu Expand Document

Configuration

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.

Settings

Many available settings are general to VS Code, and you can learn about them in the Visual Studio Code Documentation. The InterSystems Server Manager and InterSystems ObjectScript extensions supply additional settings you can use to define InterSystems IRIS servers and connections to those servers.

There are several levels on which settings are stored and used:

  • 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.
  • Workspace - Workspace settings are stored in a file inside the workspace and apply to anyone who opens the workspace.
  • 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.

For example, the following screen shot shows the Workspace level selected:

Workspace selected.

See the VS Code documentation section User and Workspace Settings.

Configuring a Server

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:

Define New Server.

Provide the following values when prompted:

  • Name of new server definition - an arbitrary name to identify this server
  • Hostname or IP address of web server - the host for this server
  • Port of web server - the WebServer port number for this server
  • Username - the username to use in logging in to this server.
  • Confirm connection type - the protocol used for connections, possible values are http and https.

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.

You can create a configuration for a server that is not currently running.

Editing a Server Configuration

If you need to modify a server configuration select File > Preferences > Settings (Code > Preferences > Settings on Mac) from the menu. Select the User settings level. Find Extensions in the list in the left pane of the editor window, click to open, then select InterSystems Server Manager from the list to find the InterSystems Server Manager area of the edit pane, as illustrated in the following screen shot:

Server manager settings.

Click Edit in settings.json.

The server configuration in settings.json looks similar to the following, with the values you entered when you configured the server:

{
    "intersystems.servers": {
        "iris-1": {
            "webServer": {
                "scheme": "http",
                "host": "localhost",
                "port": 52773
            },
            "username": "_SYSTEM"
        }
    }
}

The components of the server definition are as follows:

  • iris-1 - An arbitrary name to identify this server
  • webServer - The collection of properties that define the web server
  • scheme - The protocol used for connections
  • host - the host for this server
  • port - the WebServer port number for this server
  • username - the username to use in logging in to this server
  • password - password for the specified username. Entering the password in this file is acceptable only in limited situations with very low need for security.

If you do not store the password securely in the system Keychain or add it to the server definition, anyone using the server needs to supply the password. The InterSystems Server Manager provides the following commands for managing stored passwords in the Command Palette:

  • InterSystems Server Manager: Clear Password from Keychain - remove the password for a selected server
  • InterSystems Server Manager: Store Password in Keychain - select a server or create a new one and enter a password

Configuring a Server Connection

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.

Connection information in the status bar.

You cannot create a connection to a server that is not running.

Click on the server and namespace in the status bar to open a list of actions you can take for this server:

Select action for server.

Editing a Server Connection

If you need to modify a server connection select File > Preferences > Settings (Code > Preferences > Settings on Mac) from the menu. Select the Workspace settings level. Search for objectscript: conn, and click on Edit in settings.json.

The connection configuration looks like this:

"objectscript.conn": {
	"ns": "USER",
	"server": "iris-1",
	"active": true,
},

The components of this configuration are:

  • ns - namespace to use on the server
  • server - server name as specified in the server configuration
  • active - specifies whether the connection is active.

Copyright © 2020 InterSystems Corp. Distributed under an MIT license.