Skip to content

Commit 9869c62

Browse files
authored
Add support for project-based workflows (intersystems-community#927)
1 parent eef3560 commit 9869c62

37 files changed

+2681
-345
lines changed

docs/ExtensionUI.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,21 @@ Save the change. This change is not thought to have any adverse effects on the u
5858

5959
### Viewing and Editing Source Code on the Server
6060

61-
Expand the target server, then expand its **Namespaces** folder. Hover over the target namespace to reveal its command buttons:
61+
Expand the target server, then expand its **Namespaces** folder. Hover over the target namespace to reveal its command buttons:
6262

6363
![Namespace edit buttons.](../assets/images/namespace-buttons.png "namespace edit buttons")
6464

6565
- Click the **edit pencil** button to add an *isfs://server:namespace/* folder to your VS Code workspace.
6666
- Click the **viewing eye** button to add an *isfs-readonly://server:namespace/* folder to your VS Code workspace.
6767
- Hold the **alt** or **option** key while clicking the edit or view button to add a folder that gives you access to server-side web application files (for example, CSP files).
6868

69+
If you want to add a folder that shows only a single project's contents, expand the target namespace and the **Projects** folder to reveal the projects in the target namespace. Hover over the target project to reveal its command buttons:
70+
71+
![Project edit buttons.](../assets/images/project-buttons.png "project edit buttons")
72+
73+
- Click the **edit pencil** button to add an *isfs://server:namespace/?project=prjname* folder to your VS Code workspace.
74+
- Click the **viewing eye** button to add an *isfs-readonly://server:namespace/?project=prjname* folder to your VS Code workspace.
75+
6976
Once you have added a server-side namespace to the workspace, VS Code opens the Explorer view showing the added namespace. The following screen shot shows the **Sample** and **User** packages in the **src** folder on the client, and the **Sample** and **User** packages in the **USER** namespace on the server, with read-only access.
7077

7178
![Client-side and server-side namespaces.](../assets/images/client-server.png "client-side and server-side namespaces")
@@ -97,32 +104,31 @@ On Windows, the Server Manager can create connection entries for all connections
97104

98105
## ObjectScript View
99106

100-
The InterSystems ObjectScript extension supplies an ObjectScript view container. The button to select this appears in the Activity Bar only when a folder or a workspace that includes a client-side folder is open:
107+
The InterSystems ObjectScript extension supplies an ObjectScript view container. The button to select this appears in the Activity Bar:
101108

102109
![ObjectScript button.](../assets/images/objectscript.png "objectscript button")
103110

104-
When a VS Code workspace is not connected to an InterSystems IRIS server, the ObjectScript view provides a button that lets you select a server and namespace. Once the workspace is connected to an InterSystems IRIS server, the ObjectScript view shows files on the server, grouped by type of file.
111+
This view container contains two views: the ObjectScript Explorer and the Projects Explorer. For more information about the Projects Explorer, see the [Working with Projects](../projects/#explorer) page.
105112

106-
If the workspace is configured for server-side editing, the ObjectScript view is not available. In this configuration, the Explorer view lists files on the server, not on the local machine, making the ObjectScript view irrelevant.
113+
When a VS Code workspace is not connected to an InterSystems IRIS server, the ObjectScript Explorer provides a button that lets you select a server and namespace. Once the workspace is connected to an InterSystems IRIS server, the ObjectScript Explorer shows files on the server, grouped by type of file.
107114

108-
The ObjectScript view provides the following items:
115+
If the workspace is configured for server-side editing, the ObjectScript Explorer is not available. In this configuration, the Explorer view lists files on the server, not on the local machine, making the ObjectScript view irrelevant.
116+
117+
The ObjectScript Explorer provides the following items:
109118

110119
- **Compile** - Compiles files on the server.
111120
- **Delete** - Deletes files from the server.
112121
- **Export** - Exports files to the workspace on the client.
113122
- **Server Command Menu...** - Pick a command from menus configured on the server.
114123
- **Server Source Control...** - Pick a command from menus configured on the server.
115124

116-
The InterSystems IRIS documentation section [Extending Studio](https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=ASC#ASC_Hooks_extending_studio ) describes how to configure menus for source code control and other purposes. Entries from menus named **%SourceMenu** and **%SourceContext** appear in the **Server Source Control...** quickpick provided the source control class doesn't disable the entry, for example, disabling checkout if it knows that the file is already checked out.
125+
The InterSystems IRIS documentation section [Extending Studio](https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=ASC#ASC_Hooks_extending_studio) describes how to configure menus for source code control and other purposes. Entries from menus named **%SourceMenu** and **%SourceContext** appear in the **Server Source Control...** quickpick provided the source control class doesn't disable the entry, for example, disabling checkout if it knows that the file is already checked out.
117126

118127
Entries from menus with any other name appear in the **Server Command Menu...**.
119128

120129
## Views and View Containers
121130

122-
Technically the **InterSystems Tools** and **ObjectScript** entities described above are what VS Code calls [view containers](https://code.visualstudio.com/api/extension-capabilities/extending-workbench#view-container). Each contains a single view:
123-
124-
- In container **InterSystems Tools** is view **Servers**
125-
- In container **ObjectScript** is view **Explorer**
131+
Technically the **InterSystems Tools** and **ObjectScript** entities described above are what VS Code calls [view containers](https://code.visualstudio.com/api/extension-capabilities/extending-workbench#view-container). The **InterSystems Tools** view container has a single view called **Servers**. The **ObjectScript** view container has two views: **Explorer** and **Projects**.
126132

127133
When a VS Code container has only a single view in it the view header merges with the container header, with the two names separated by a colon.
128134

docs/Projects.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
layout: default
3+
title: Working with Projects
4+
permalink: /projects/
5+
nav_order: 9
6+
---
7+
8+
# Working with Projects
9+
10+
A project is a named set of class definitions, routines, include files, web application files or custom documents. All files in a project must be in the same namespace on the same InterSystems server. Each document can be associated with any number of projects. Each namespace can contain any number of projects.
11+
12+
## Why Projects?
13+
14+
You are not required to use projects in VS Code, but you should consider using them if:
15+
16+
* You work [server-side](../serverside) and the `type` and `filter` [query parameters](../serverside/#filters-and-display-options) are not granular enough.
17+
* You work server-side and want to edit CSP and non-CSP files in the same workspace folder.
18+
* You work client-side and want to group together many files to export with a single click.
19+
* You are migrating from InterSystems Studio and want to keep using an existing project.
20+
21+
{: #explorer}
22+
## Projects Explorer
23+
24+
The easiest way to manage projects is using the Projects Explorer, which is in the [ObjectScript view](../extensionui/#objectscript-view):
25+
26+
![Projects Explorer](../assets/images/projects-explorer.png "projects explorer")
27+
28+
Initally, the Projects explorer contains a root node for each server and namespace connection that exists for the current workspace. It can be expanded to show all projects in that namespace on the server, and expanding the project node will show its contents:
29+
30+
![Projects Explorer Expanded](../assets/images/projects-explorer-expanded.png "projects explorer expanded")
31+
32+
You can also add root nodes for namespaces on any server configured using the InterSystems Server Manager extension. To do so, click on the plus (`+`) button at the top of the view.
33+
34+
The following sections will describe how to use the Projects Explorer and other tools to work with projects.
35+
36+
{: #creating}
37+
## Creating Projects
38+
39+
There are two ways to create projects in VS Code:
40+
41+
* Right-click on a server-namespace node in the Projects Explorer and select the `Create Project` menu option.
42+
* Open the command palette and run the `ObjectScript: Create Project` command.
43+
44+
Project names are required to be unique per server-namespace and may optionally have a description. The description is shown when hovering over the project's node in the Projects Explorer or below its name when selecting one in a dropdown menu.
45+
46+
{: #modifying}
47+
## Modifying Projects
48+
49+
There are three ways to add or remove items from a project:
50+
51+
* Using the Projects Explorer:
52+
* To add items, right-click on the project node or one of the document type nodes (i.e. `Classes` or `Routines`) and select the `Add Items to Project...` menu option. If you clicked on a document type node, you will only be shown documents of that type to add.
53+
* To remove an item, right-click on its node and select the `Remove from Project` menu option. If you remove a package or directory node, all of its children will also be removed from the project. You may also right-click on the project node and select the `Remove Items from Project...` menu option to be presented with a multi-select dropdown that allows you to remove multiple items at once.
54+
* Within a workspace folder configured to view or edit documents in a project directly on the server:
55+
* To add items, right-click a root `isfs(-readonly)` folder that has the `project` query parameter in its URI and select the `Add Items to Project...` menu option.
56+
* To remove an item, right-click on its node and select the `Remove from Project` menu option. If you remove a package or directory node, all of its children will also be removed from the project. You may also right-click on a root `isfs(-readonly)` folder that has the `project` query parameter in its URI and select the `Remove Items from Project...` menu option to be presented with a multi-select dropdown that allows you to remove multiple items at once.
57+
* Using commands:
58+
59+
Open the command palette and select the `ObjectScript: Add Items to Project...` or `ObjectScript: Remove Items from Project...` command.
60+
61+
### Add to Project UI
62+
63+
The `Add to Project` command implements a custom multi-select dropdown that is shown regardless of how it is invoked. Items that are in the namespace and not already in the project are shown. The elements of this UI are described in more detail below:
64+
65+
![Add to Project UI](../assets/images/add-to-project.png "add to project UI")
66+
67+
* Title bar row:
68+
* Click the icons to show or hide system and generated items, respectively.
69+
* Input box row:
70+
* Click the check box to select all items that are currently shown.
71+
* Type in the input box to filter the items that are shown.
72+
* Click the **OK** button to add the selected items to the project.
73+
* Item rows:
74+
* Click the check box to select the item. If the item is a package or CSP directory, all of its contents will be selected as well, even though the check boxes for those items don't appear selected.
75+
* The icon preceding the name represents its type. It corresponds to the icons in the Projects Explorer and [ObjectScript Explorer](../extensionui/#objectscript-view).
76+
* The more prominent text is the short name of the item, as it would appear in a file system.
77+
* The less prominent text is the full name of the item, including its package or CSP directory.
78+
* Click the arrow icon at the far right of the row to show or hide its contents.
79+
80+
{: #deleting}
81+
## Deleting Projects
82+
83+
There are two ways to delete projects in VS Code:
84+
85+
* Right-click on a project node in the Projects Explorer and select the `Delete Project` menu option.
86+
* Open the command palette and run the `ObjectScript: Delete Project` command.
87+
88+
{: #server-side}
89+
## Editing Project Contents Server-Side
90+
91+
There are a few methods to create a workspace folder to view or edit documents in a project directly on the server:
92+
93+
* Follow the steps [here](../serverside/#config-server-side) and select the project.
94+
* Right-click in the [Explorer view](../extensionui/#explorer-view) and select the `Add Server Namespace to Workspace` menu option.
95+
* Use the InterSystems Tools view, as described [here](../extensionui/#viewing-and-editing-source-code-on-the-server).
96+
* Right-click on a project node in the [Projects Explorer](../projects/#explorer) and select the `Add Workspace Folder For Project` menu option.
97+
* Add a folder to your `.code-workspace` file directly:
98+
```json
99+
{
100+
"uri": "isfs://myserver:user/?project=prjname",
101+
"name": "prjname"
102+
}
103+
```
104+
105+
{: #client-side}
106+
## Editing Project Contents Client-Side
107+
108+
The entire contents of the project can be easily exported to your local file system for client-side editing. To do so, simply right-click on the project you'd like to export and select the `Export Project Contents` menu option.
109+
110+
## Notes
111+
112+
If you are getting `ERROR #5540: SQLCODE: -99 Message: User abc is not privileged for the operation` when you try to expand the Projects Explorer or view a project's contents in a virtual folder, then grant user abc (or a SQL role they hold) the following SQL permissions:
113+
114+
```SQL
115+
GRANT SELECT, INSERT, UPDATE, DELETE ON %Studio.Project, %Studio.ProjectItem TO abc
116+
GRANT EXECUTE ON %Studio.Project_ProjectItemsList TO abc
117+
```

docs/ServerSide.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,24 @@ Next create a workspace for editing code directly on the server:
2828
1. Pick a namespace from the list retrieved from the target server:
2929

3030
![Choose a namespace.](../assets/images/ss-choose-namespace.png "choose a namespace")
31+
1. Pick if this folder should show a project's contents:
32+
33+
![Choose if project.](../assets/images/ss-is-project.png "choose if project")
34+
1. If yes, pick the project from the list, or click the **+** sign to create a new one:
35+
36+
![Choose project.](../assets/images/ss-pick-project.png "choose project")
3137
1. Pick an access mode from the list:
3238

39+
If no project was selected:
40+
3341
![Choose an access type.](../assets/images/ss-access-type.png "choose an access type")
42+
43+
If a project was selected:
44+
45+
![Choose an access type (project).](../assets/images/ss-access-type-project.png "choose an access type (project")
3446
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.
3547

36-
Note that the ObjectScript button is not visible in the Activity Bar. Because the files listed in the Explorer view are all on the server, it is not needed for this configuration.
48+
Note that the ObjectScript Explorer view is not visible in the ObjectScript view container. Because the files listed in the Explorer view are all on the server, the ObjectScript Explorer is not needed for this configuration.
3749

3850
The `.code-workspace` file is a JSON file which you can edit directly, as described in the section [VS Code Workspaces](../configuration/#code-workspaces). A simple example looks like this:
3951
```json
@@ -136,10 +148,11 @@ Changes you make to files opened from this root folder of your VS Code workspace
136148
The query string of the `uri` property accepts several parameters that control filtering and display of the server-side entities. The examples below access the USER namespace on the server whose definition is named 'myserver'.
137149

138150
- `isfs://myserver:user?type=cls`, shows only classes
139-
- `isfs://myserver:user?type=rtn`, shows only routines, mac, int and inc files
151+
- `isfs://myserver:user?type=rtn`, shows only mac, int and inc files
140152
- `isfs://myserver:user?generated=1`, shows generated files as well as not generated
141153
- `isfs://myserver:user?filter=%Z*.mac,%z*.mac`, comma-delimited list of search options, ignores `type`. The default is `*.cls,*.inc,*.mac,*.int`. To see all files, use `*`.
142-
- `isfs://myserver:user?flat=1`, a flat list of files does not split packages as folders.
154+
- `isfs://myserver:user?flat=1`, a flat list of files. Does not split packages as folders. Cannot be combined with `csp`.
155+
- `isfs://myserver:user?project=prjname`, shows only files in project `prjname`. Cannot be combined with any other parameter.
143156

144157
The options `flat` and `generated` can be combined with each other, and with `type` or `filter`. If `filter` is specified, `type` is ignored.
145158

docs/SettingsReference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The extensions in the InterSystems ObjectScript Extension Pack provide many sett
5959
| `"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. |
6060
| `"objectscript.openClassContracted"` | Automatically collapse all class member folding ranges when a class is opened for the first time. | `boolean` | `false` | |
6161
| `"objectscript.overwriteServerChanges"` | Overwrite a changed server version without confirmation when importing the local file. | `boolean` | `false` | |
62+
| `"objectscript.projects.webAppFileExtensions"` | When browsing a virtual workspace folder that has a project query parameter, all files with these extensions will be automatically treated as web application files. Extensions added here will be appended to the default list and should **NOT** include a dot. | `string[]` | `[]` | Default extensions: `["csp","csr","ts","js","css","scss","sass","less","html","json","md","markdown","png","svg","jpeg","jpg","ico","xml","txt"]` |
6263
| `"objectscript.serverSideEditing"` | Allow editing code directly on the server after opening it from ObjectScript Explorer. | `boolean` | `false` | |
6364
| `"objectscript.serverSourceControl.disableOtherActionTriggers"` | Prevent server-side source control 'other action' triggers from firing. | `boolean` | `false` | |
6465
| `"objectscript.showExplorer"` | Show the ObjectScript Explorer view. | `boolean` | `true` | |

docs/assets/images/add-to-project.png

22.1 KB
Loading
1.93 KB
Loading
9 KB
Loading
28.7 KB
Loading
17.4 KB
Loading
21.1 KB
Loading

0 commit comments

Comments
 (0)