Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions workspaces/bi/bi-extension/src/project-explorer/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,15 @@
dataProvider.revealInTreeView(event.documentUri, event.projectPath, event.position, event.view);
}
);

// Register the refresh command
commands.registerCommand(isInWI ? WI_PROJECT_EXPLORER_VIEW_REFRESH_COMMAND : BI_COMMANDS.REFRESH_COMMAND, () => dataProvider.refresh());
commands.registerCommand(BI_COMMANDS.REFRESH_COMMAND, () => {
if (isInWI) {
commands.executeCommand(WI_PROJECT_EXPLORER_VIEW_REFRESH_COMMAND);
return;
}
dataProvider.refresh()

Check warning on line 92 in workspaces/bi/bi-extension/src/project-explorer/activate.ts

View workflow job for this annotation

GitHub Actions / Build / Build repo

Missing semicolon
});
}

function registerBallerinaCommands(
Expand Down
4 changes: 2 additions & 2 deletions workspaces/mi/mi-extension/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const COMMANDS = {
OPEN_DSS_SERVICE_DESIGNER: "MI.project-explorer.open-dss-service-designer",
ADD_MEDIATOR: "MI.addMediator",
REFRESH_COMMAND: 'MI.project-explorer.refresh',
WI_PROJECT_EXPLORER_VIEW_REFRESH: 'wso2-integrator.explorer.refresh',
ADD_COMMAND: 'MI.project-explorer.add',
ADD_ARTIFACT_COMMAND: 'MI.project-explorer.add.artifact',
ADD_API_COMMAND: 'MI.project-explorer.add-api',
Expand Down Expand Up @@ -131,7 +132,7 @@ export const DEFAULT_PROJECT_VERSION = "1.0.0";

export const READONLY_MAPPING_FUNCTION_NAME = "mapFunction";

export const REFRESH_ENABLED_DOCUMENTS = ["SynapseXml", "typescript", "markdown", "json"];
export const REFRESH_ENABLED_DOCUMENTS = ["xml", "SynapseXml", "typescript", "markdown", "json"];

export enum EndpointTypes {
DEFAULT_ENDPOINT = "DEFAULT_ENDPOINT",
Expand Down Expand Up @@ -206,5 +207,4 @@ export const ERROR_MESSAGES = {

export const WI_EXTENSION_ID = 'wso2.wso2-integrator';
export const WI_PROJECT_EXPLORER_VIEW_ID = 'wso2-integrator.explorer';
export const WI_PROJECT_EXPLORER_VIEW_REFRESH_COMMAND = 'wso2-integrator.explorer.refresh';
export const MI_PROJECT_EXPLORER_VIEW_ID = 'MI.project-explorer';
10 changes: 8 additions & 2 deletions workspaces/mi/mi-extension/src/project-explorer/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as vscode from 'vscode';
import { ProjectExplorerEntry, ProjectExplorerEntryProvider } from './project-explorer-provider';
import { getStateMachine, openView, refreshUI } from '../stateMachine';
import { EVENT_TYPE, MACHINE_VIEW, VisualizerLocation } from '@wso2/mi-core';
import { COMMANDS, WI_PROJECT_EXPLORER_VIEW_REFRESH_COMMAND } from '../constants';
import { COMMANDS } from '../constants';
import { ExtensionContext, TreeItem, Uri, ViewColumn, commands, window, workspace } from 'vscode';
import path = require("path");
import { deleteRegistryResource, deleteDataMapperResources, deleteSchemaResources } from '../util/fileOperations';
Expand Down Expand Up @@ -52,7 +52,13 @@ export async function activateProjectExplorer(treeviewId: string, context: Exten
const runtimeVersion = projectDetailsRes.primaryDetails.runtimeVersion.value;
const isRegistrySupported = compareVersions(runtimeVersion, RUNTIME_VERSION_440) < 0;

commands.registerCommand(isInWI ? WI_PROJECT_EXPLORER_VIEW_REFRESH_COMMAND : COMMANDS.REFRESH_COMMAND, () => { return projectExplorerDataProvider.refresh(); });
commands.registerCommand(COMMANDS.REFRESH_COMMAND, () => {
if (isInWI) {
commands.executeCommand(COMMANDS.WI_PROJECT_EXPLORER_VIEW_REFRESH);
return;
}
return projectExplorerDataProvider.refresh();
});

commands.registerCommand(COMMANDS.ADD_ARTIFACT_COMMAND, (entry: ProjectExplorerEntry) => {
openView(EVENT_TYPE.OPEN_VIEW, { view: MACHINE_VIEW.ADD_ARTIFACT, projectUri: entry.info?.path });
Expand Down
2 changes: 1 addition & 1 deletion workspaces/mi/mi-extension/src/stateMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ export const getStateMachine = (projectUri: string, context?: VisualizerLocation
if (!workspaces) {
console.warn('No workspace folder is open.');
}
log(vscode.extensions.all.map(ext => ext.id).join(', '));

stateService = interpret(stateMachine.withContext({
projectUri: projectUri,
langClient: null,
Expand Down
15 changes: 7 additions & 8 deletions workspaces/mi/mi-extension/src/visualizer/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,8 @@ export function activateVisualizer(context: vscode.ExtensionContext, firstProjec
// Listen for pom changes and update dependencies
context.subscriptions.push(
// Handle the text change and diagram update with rpc notification
vscode.workspace.onDidChangeTextDocument(async function (document) {
const projectUri = vscode.workspace.getWorkspaceFolder(document.document.uri)?.uri.fsPath;

vscode.workspace.onDidChangeTextDocument(async function (e : vscode.TextDocumentChangeEvent) {
const projectUri = vscode.workspace.getWorkspaceFolder(e.document.uri)?.uri.fsPath;
if (!projectUri) {
return;
}
Expand All @@ -221,19 +220,19 @@ export function activateVisualizer(context: vscode.ExtensionContext, firstProjec
return;
}

if (!REFRESH_ENABLED_DOCUMENTS.includes(document.document.languageId) || !projectUri) {
if (!REFRESH_ENABLED_DOCUMENTS.includes(e.document.languageId) || !projectUri) {
return;
}

if (webview?.getWebview()?.active || AiPanelWebview.currentPanel?.getWebview()?.active) {
await document.document.save();
if (!getStateMachine(projectUri).context().view?.endsWith('Form') && document?.document?.uri?.fsPath?.includes(artifactsDir)) {
await e.document.save();
if (!getStateMachine(projectUri).context().view?.endsWith('Form') && e?.document?.uri?.fsPath?.includes(artifactsDir)) {
refreshDiagram(projectUri);
}
}

if (document.document.uri.fsPath.endsWith('pom.xml')) {
const projectUri = vscode.workspace.getWorkspaceFolder(document.document.uri)?.uri.fsPath;
if (e.document.uri.fsPath.endsWith('pom.xml')) {
const projectUri = vscode.workspace.getWorkspaceFolder(e.document.uri)?.uri.fsPath;
const langClient = getStateMachine(projectUri!).context().langClient;

const confirmUpdate = await vscode.window.showInformationMessage(
Expand Down
Loading