-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathxml.ts
More file actions
25 lines (20 loc) · 982 Bytes
/
xml.ts
File metadata and controls
25 lines (20 loc) · 982 Bytes
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import * as vscode from "vscode";
import { extensionRecommendationHandler } from "./handler";
const EXTENSION_NAME = "redhat.vscode-xml";
const RECOMMENDATION_MESSAGE = "XML extension is recommended for better POM editing with schema validation, auto-completion, and formatting.";
function isPomDotXml(uri: vscode.Uri) {
return !!uri.path && uri.path.toLowerCase().endsWith("pom.xml");
}
export function initialize (context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.workspace.onDidOpenTextDocument(e => {
if (isPomDotXml(e.uri)) {
extensionRecommendationHandler(context, EXTENSION_NAME, RECOMMENDATION_MESSAGE);
}
}));
let isPomDotXmlOpened = vscode.workspace.textDocuments.findIndex(doc => isPomDotXml(doc.uri)) !== -1;
if (isPomDotXmlOpened) {
extensionRecommendationHandler(context, EXTENSION_NAME, RECOMMENDATION_MESSAGE);
}
}