Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMPscript extensions checker #29

Merged
merged 2 commits into from
Mar 18, 2024
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
31 changes: 31 additions & 0 deletions src/vscode/src/checks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as vscode from 'vscode';

export function extensionsChecks() {
const extensionHandlers = {
// "publisher.extensionName":
"sergey-agadzhanov.AMPscript": {
// handler returns false if the extension is incompatible, true otherwise.
// handler can also run additional actions in the case there's a need.
handler: () => {
vscode.window.showInformationMessage(`The extension MCFS [AMPScript] is incompatible with AMPscript Core and will prevent AMPscript Core from debugging AMPscript.`);
return false;
}
}
};

let allSupported = true;
for (let extensionId in extensionHandlers) {
const extension = vscode.extensions.getExtension(extensionId);
if (extension) {
const handler = extensionHandlers[extensionId as keyof typeof extensionHandlers].handler;
if (handler) {
const result = handler();
if (result === false) {
allSupported = false;
}
}
}
}
return allSupported;
}
3 changes: 3 additions & 0 deletions src/vscode/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as vscode from 'vscode';
import * as path from 'path';
import TelemetryReporter from '@vscode/extension-telemetry';
import registerCommands from './commands';
import { extensionsChecks } from './checks';

// the application insights key (also known as instrumentation key)
const applicationInsightsKey = 'd3cdabd2-8a47-44c7-92bd-7c786d2dd3bd';
Expand All @@ -21,6 +22,8 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('ampscript', provider));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('JSON', provider));
context.subscriptions.push(reporter);
console.log(`Extension starting`);
extensionsChecks();
}

// This method is called when your extension is deactivated
Expand Down
Loading