-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathindex.ts
More file actions
32 lines (26 loc) · 1.02 KB
/
index.ts
File metadata and controls
32 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import * as vscode from "vscode";
import { initialize as initHandler, extensionRecommendationHandler } from "./handler";
import { isExtensionInstalled, getExtensionContext, getInstalledExtension } from "../utils";
import { initialize as initXmlRecommendation } from "./xml";
export function initialize(_context: vscode.ExtensionContext) {
initHandler();
initXmlRecommendation(_context);
}
export async function validateAndRecommendExtension(extName: string, message: string, isForce: boolean = false) {
if (isExtensionInstalled(extName)) {
return true;
}
await extensionRecommendationHandler(getExtensionContext(), extName, message, isForce);
return false;
}
export async function validateExtensionInstalled(extName: string, version: string) {
if(!isExtensionInstalled(extName)) {
return false;
}
if(version && getInstalledExtension(extName)?.packageJSON.version >= version) {
return true;
}
return false;
}