Skip to content

Commit

Permalink
Refactor OrgChangeNotifier and Copilot Notification
Browse files Browse the repository at this point in the history
  • Loading branch information
amitjoshi committed Sep 30, 2024
1 parent 805dda8 commit bac7eed
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ export async function activate(
_context.subscriptions.push(cli);
_context.subscriptions.push(pacTerminal);

// Init OrgChangeNotifier instance
OrgChangeNotifier.createOrgChangeNotifierInstance(pacTerminal.getWrapper());

let copilotNotificationShown = false;

const workspaceFolders =
Expand Down Expand Up @@ -234,24 +231,23 @@ export async function activate(
}

if (!copilotNotificationShown) {
if (workspaceContainsPortalConfigFolder(workspaceFolders)) {
let telemetryData = '';
let listOfActivePortals = [];
try {
listOfActivePortals = getPortalsOrgURLs(workspaceFolders, _telemetry);
telemetryData = JSON.stringify(listOfActivePortals);
_telemetry.sendTelemetryEvent("VscodeDesktopUsage", { listOfActivePortals: telemetryData, countOfActivePortals: listOfActivePortals.length.toString() });
oneDSLoggerWrapper.getLogger().traceInfo("VscodeDesktopUsage", { listOfActivePortals: telemetryData, countOfActivePortals: listOfActivePortals.length.toString() });
} catch (exception) {
const exceptionError = exception as Error;
_telemetry.sendTelemetryException(exceptionError, { eventName: 'VscodeDesktopUsage' });
oneDSLoggerWrapper.getLogger().traceError(exceptionError.name, exceptionError.message, exceptionError, { eventName: 'VscodeDesktopUsage' });
}

// Show Copilot notification after ECS initialization and workspace check
showNotificationForCopilot(_telemetry, telemetryData, listOfActivePortals.length.toString());
copilotNotificationShown = true;
let telemetryData = '';
let listOfActivePortals = [];
try {
listOfActivePortals = getPortalsOrgURLs(workspaceFolders, _telemetry);
telemetryData = JSON.stringify(listOfActivePortals);
_telemetry.sendTelemetryEvent("VscodeDesktopUsage", { listOfActivePortals: telemetryData, countOfActivePortals: listOfActivePortals.length.toString() });
oneDSLoggerWrapper.getLogger().traceInfo("VscodeDesktopUsage", { listOfActivePortals: telemetryData, countOfActivePortals: listOfActivePortals.length.toString() });
} catch (exception) {
const exceptionError = exception as Error;
_telemetry.sendTelemetryException(exceptionError, { eventName: 'VscodeDesktopUsage' });
oneDSLoggerWrapper.getLogger().traceError(exceptionError.name, exceptionError.message, exceptionError, { eventName: 'VscodeDesktopUsage' });
}

// Show Copilot notification after ECS initialization and workspace check
showNotificationForCopilot(_telemetry, telemetryData, listOfActivePortals.length.toString());
copilotNotificationShown = true;

}

})
Expand All @@ -261,6 +257,9 @@ export async function activate(

if (workspaceContainsPortalConfigFolder(workspaceFolders)) {

// Init OrgChangeNotifier instance
OrgChangeNotifier.createOrgChangeNotifierInstance(pacTerminal.getWrapper());

vscode.workspace.onDidOpenTextDocument(didOpenTextDocument);
vscode.workspace.textDocuments.forEach(didOpenTextDocument);

Expand Down

0 comments on commit bac7eed

Please sign in to comment.