Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless committed Nov 13, 2024
2 parents 70b4dc2 + 30d621c commit b7f620c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 51 deletions.
13 changes: 9 additions & 4 deletions libs/vscode/nx-cloud-view/src/lib/cloud-onboarding-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import {
CancellationToken,
commands,
Disposable,
ExtensionContext,
tasks,
Uri,
Expand All @@ -37,18 +38,18 @@ export class CloudOnboardingViewProvider implements WebviewViewProvider {
private _view: WebviewView | undefined;
private _webviewSourceUri: Uri;

private _refreshSubscription: Disposable;

constructor(private extensionContext: ExtensionContext) {
this._webviewSourceUri = Uri.joinPath(
this.extensionContext.extensionUri,
'nx-cloud-onboarding-webview'
);

const sub = onWorkspaceRefreshed(async () => {
this._refreshSubscription = onWorkspaceRefreshed(async () => {
await this.refresh();
});
if (sub) {
extensionContext.subscriptions.push(sub);
}
extensionContext.subscriptions.push(this._refreshSubscription);
}

async resolveWebviewView(
Expand All @@ -73,6 +74,10 @@ export class CloudOnboardingViewProvider implements WebviewViewProvider {
webviewView.webview.onDidReceiveMessage((event) => {
this.handleWebviewMessage(event);
});

webviewView.onDidDispose(() => {
this._refreshSubscription.dispose();
});
}

async refresh() {
Expand Down
7 changes: 6 additions & 1 deletion libs/vscode/nx-commands-view/src/lib/nx-commands-provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { GlobalConfigurationStore } from '@nx-console/vscode/configuration';
import { onWorkspaceRefreshed } from '@nx-console/vscode/lsp-client';
import {
getNxlsClient,
onWorkspaceRefreshed,
} from '@nx-console/vscode/lsp-client';
import { getNxWorkspace } from '@nx-console/vscode/nx-workspace';
import { AbstractTreeProvider } from '@nx-console/vscode/utils';
import { commands, ExtensionContext } from 'vscode';
Expand All @@ -14,6 +17,8 @@ export class NxCommandsTreeProvider extends AbstractTreeProvider<NxCommandsTreeI
);

onWorkspaceRefreshed(() => this.refresh());

getNxlsClient().showRefreshLoadingAtLocation({ viewId: 'nxCommands' });
}

getParent(_: NxCommandsTreeItem) {
Expand Down
32 changes: 3 additions & 29 deletions libs/vscode/nx-project-view/src/lib/init-nx-project-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export function initNxProjectView(

AtomizerDecorationProvider.register(context);

listenToLoadingEventsAndShowBar(context);
context.subscriptions.push(
getNxlsClient().showRefreshLoadingAtLocation({ viewId: 'nxProjects' })
);

return nxProjectsTreeProvider;
}
Expand Down Expand Up @@ -61,31 +63,3 @@ export async function showProjectConfiguration(selection: NxTreeItem) {
const target = viewItem.nxTarget;
return revealNxProject(project, root, target);
}

function listenToLoadingEventsAndShowBar(context: ExtensionContext) {
const client = getNxlsClient();
context.subscriptions.push(
client.onNotification(NxWorkspaceRefreshStartedNotification, () => {
const refreshPromise = new Promise<void>((resolve) => {
const disposable = client.onNotification(
NxWorkspaceRefreshNotification,
() => {
disposable?.dispose();
resolve();
}
);
});

window.withProgress(
{
location: { viewId: 'nxProjects' },
cancellable: false,
title: 'Refreshing Nx workspace',
},
async () => {
await refreshPromise;
}
);
})
);
}
17 changes: 0 additions & 17 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,6 @@
"extract-dependencies": {
"cache": true
},
"@nx/jest:jest": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true,
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"@nx/eslint:lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"@nx/esbuild:esbuild": {
"cache": true,
"dependsOn": ["^build"],
Expand Down

0 comments on commit b7f620c

Please sign in to comment.