Skip to content

Commit 34028fc

Browse files
authored
Replace Processes/Workflows view with Project view (#117)
--------- Signed-off-by: Ben Sherman <[email protected]>
1 parent 5e40e5d commit 34028fc

39 files changed

+442
-761
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,25 @@ Related blog posts:
4444

4545
- [Bringing Seqera AI to the Nextflow VS Code extension](https://seqera.io/blog/seqera-ai--nextflow-vs-code/)
4646

47-
### Workflows and Processes View
47+
### Project view
4848

49-
The extension provides custom views for managing Nextflow workflows and processes.
49+
The extension provides a custom view for Nextflow projects. The Project view uses the language server to provide an overview of your pipeline project.
5050

51-
The Workflows view provides a comprehensive overview of your pipeline project. It infers the structure of your pipeline from the include declarations in your scripts.
51+
The list view lists all processes and workflows, as well as any associated [nf-test](https://www.nf-test.com/) files, in alphabetical order:
5252

53-
Here is an eaxmple from the [nf-core/rnaseq](https://github.com/nf-core/rnaseq) pipeline:
53+
![Project List View](images/project_view_list.png)
5454

55-
![Workflows View](images/workflow_view.png)
55+
The tree view shows processes and workflows organized by call hierarchy:
5656

57-
The Processes view provides a comprehensive list of all processes in your pipeline, as well as any associated [nf-test](https://www.nf-test.com/) files.
57+
![Project Tree View](images/project_view_tree.png)
5858

59-
This view helps you:
60-
- Monitor test coverage across your entire pipeline
61-
- Quickly identify untested processes
62-
- Easily navigate to a process definition (or corresponding test) by name
59+
*Examples taken from the [nf-core/fetchngs](https://github.com/nf-core/fetchngs) pipeline.*
60+
61+
The Project view allows you to:
6362

64-
![Process View](images/process_view.png)
63+
- See the structure of your pipeline
64+
- Navigate to a process, workflow, or test by name
65+
- Monitor test coverage across your entire pipeline
6566

6667
## Installation
6768

images/process_view.png

-188 KB
Binary file not shown.

images/project_view_list.png

386 KB
Loading

images/project_view_tree.png

370 KB
Loading

images/workflow_view.png

-373 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,8 @@
302302
"views": {
303303
"nextflow": [
304304
{
305-
"id": "workflows",
306-
"name": "Workflows",
307-
"type": "webview"
308-
},
309-
{
310-
"id": "processes",
311-
"name": "Processes",
305+
"id": "project",
306+
"name": "Project",
312307
"type": "webview"
313308
},
314309
{

src/webview/WebviewProvider/index.ts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ import * as fs from "fs";
33
import * as path from "path";
44

55
import {
6-
buildList,
7-
buildTree,
6+
fetchComputeEnvs,
7+
fetchDataLinks,
8+
fetchDatasets,
9+
fetchPipelines,
810
fetchPlatformData,
911
fetchRuns,
1012
getRepoInfo,
11-
fetchPipelines,
12-
fetchDatasets,
13-
fetchDataLinks,
14-
fetchComputeEnvs
13+
queryWorkspace
1514
} from "./lib";
1615
import { AuthProvider, getAccessToken } from "../../auth";
17-
import { FileNode } from "./lib/workspace/types";
1816
import { jwtExpired } from "../../auth/AuthProvider/utils/jwt";
1917
import { sleep } from "./lib/utils";
2018

@@ -24,7 +22,7 @@ class WebviewProvider implements vscode.WebviewViewProvider {
2422

2523
constructor(
2624
private readonly _context: vscode.ExtensionContext,
27-
private readonly viewID: "workflows" | "processes" | "userInfo" | "modules",
25+
private readonly viewID: "project" | "userInfo",
2826
private readonly _authProvider?: AuthProvider
2927
) {
3028
this._extensionUri = _context.extensionUri;
@@ -40,7 +38,7 @@ class WebviewProvider implements vscode.WebviewViewProvider {
4038
const { command, workspaceId } = message;
4139
switch (command) {
4240
case "openFile":
43-
this.openFile(message.file);
41+
this.openFile(message.path, message.line);
4442
break;
4543
case "openChat":
4644
this.openChat();
@@ -153,28 +151,18 @@ class WebviewProvider implements vscode.WebviewViewProvider {
153151
const accessToken = await this.getAccessToken();
154152
if (!accessToken) return;
155153
await fetchPlatformData(accessToken, view.webview, _context, refresh);
156-
} else {
157-
const fileList = buildList();
158-
view.webview.postMessage({
159-
fileList,
160-
tree: buildTree(fileList.files)
161-
});
154+
}
155+
if (viewID === "project") {
156+
const nodes = await queryWorkspace();
157+
view.webview.postMessage({ nodes });
162158
}
163159
}
164160

165-
public async openFileEvent(filePath: string) {
166-
this._currentView?.webview.postMessage({
167-
command: "fileOpened",
168-
filePath
169-
});
170-
}
171-
172-
private async openFile(file: FileNode) {
173-
const doc = await vscode.workspace.openTextDocument(file.filePath);
161+
private async openFile(filePath: string, line: number) {
162+
const doc = await vscode.workspace.openTextDocument(filePath);
174163
await vscode.window.showTextDocument(doc, {
175-
selection: new vscode.Range(file.line || 0, 0, file.line || 0, 0)
164+
selection: line != -1 ? new vscode.Range(line, 0, line, 0) : undefined
176165
});
177-
this.openFileEvent(file.filePath);
178166
}
179167

180168
private async openChat() {

src/webview/WebviewProvider/lib/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ export { default as fetchPlatformData } from "./platform/fetchPlatformData";
22
export { default as getAuthState } from "./platform/getAuthState";
33
export * from "./platform/utils";
44

5-
export { default as buildList } from "./workspace/buildList";
6-
export { default as buildTree } from "./workspace/buildTree";
5+
export { queryWorkspace } from "./workspace/queryWorkspace";

src/webview/WebviewProvider/lib/workspace/buildList.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/webview/WebviewProvider/lib/workspace/buildTree.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)