Configure and Perform Server Actions within VS Code
Once you have connected your Visual Studio Code (VS Code) environment to an InterSystems® server, the InterSystems ObjectScript extension for VS Code provides access to the Server Actions menu, which allows you to execute various operations on the connected server, as described in Perform a Server Action.
By default, the Server Actions menu includes options to open the server’s Management Portal, access any InterSystems Studio add-ins which are available on the server, execute server-side source control commandsOpens in a new tab, and more.
The Server Actions menu is also extensible: Add Custom Options describes how to configure the ObjectScript extension to execute custom Server Actions.
Perform a Server Action
Clicking on the server and namespace in the status bar opens the menu of Server Actions which you can perform on the server, as illustrated in the following image:
Alternatively, you can access this Server Actions menu by opening the Command Palette and selecting the ObjectScript: Server Actions... command.
Studio Add-ins
By selecting Open Studio Add-in from the Server Actions menu, you can access InterSystems Studio add-in wizards which are available on the server, directly within VS Code. The wizards provide the same options within VS Code as they did within InterSystems Studio. As such, refer to the documentation for your desired add-in for further instructions.
Custom Server-Side Menus (Source Control or Other)
The Server Actions menu options Server Source Control... and Server Command Menu... allow you access custom menus which you have implemented on your server by defining classes which extend %Studio.Extension.Base or %Studio.SourceControl.Base.
Refer to Adding Custom Menus (in the InterSystems Studio documentation) and Source Control IntegrationOpens in a new tab (in the InterSystems IRIS documentation) for instructions on how to configure menus for source code control and other purposes. Entries from menus named %SourceMenu and %SourceContext appear in the Server Source Control menu, provided the source control class does not disable the entry. (For example, the source control class may disable checkout if the file is already checked out.)
If your source control class implements a UserAction() which opens a web page, you may need to modify your implementation so that the user action functions as desired when VS Code displays the web page within an iframe. See Adapting Web Page User Actions for VS Code for guidance.
Add Custom Options to the Server Actions Menu
You can add custom entries to the Server Actions menu by modifying the objectscript.conn.links configuration object in the user-level settings.json for the ObjectScript extension. This object consists of key-value pairs where the key is the label displayed in the menu and the value is the URI the action opens. The following variables are available for substitution in the URI:
-
${host} — the hostname of the connected server. For example: localhost
-
${port} — the port of the connected server.
-
${serverURL} — the full connection string for the server, including the protocol, <baseURL> for your instance, and path prefix. For example: http://localhost:443/pathPrefix
-
${ns} — the namespace that you are connected to. The value is URL encoded. For example: %25SYS or USER
-
${namespace} — The raw namespace parameter for the connection. For example, user
-
${classname} — the name of the class which is currently open, or an empty string if the currently opened document is not a class.
-
${classnameEncoded} — a URL encoded version of ${classname}.
-
${project} — the name of the server-side project which is currently open, or an empty string if no project is open.
-
${username} — the username for the user account you are currently using to connect to the server.
Here is an example of a custom server action configuration:
"objectscript.conn": {
"links": {
"Portal Explorer": "${serverUrl}/csp/sys/exp/%25CSP.UI.Portal.ClassList.zen?$NAMESPACE=${ns}"
},
}
The preceding server action configuration adds an entry to the Server Actions menu, as illustrated in the following image: