提交 33783baa 编写于 作者: P Pine Wu

Fix #64022

上级 b1bf8102
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import { workspace, WorkspaceFolder } from 'vscode';
import { workspace, WorkspaceFolder, extensions } from 'vscode';
interface ExperimentalConfig {
experimental?: {
......@@ -12,14 +12,11 @@ interface ExperimentalConfig {
};
}
export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFolder[] | undefined) {
export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFolder[] | undefined): string[] {
const dataPaths: string[] = [];
if (!workspaceFolders) {
return {
dataPaths
};
return dataPaths;
}
workspaceFolders.forEach(wf => {
......@@ -39,7 +36,22 @@ export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFol
}
});
return {
dataPaths
};
return dataPaths;
}
export function getCustomDataPathsFromAllExtensions(): string[] {
const dataPaths: string[] = [];
for (const extension of extensions.all) {
const contributes = extension.packageJSON && extension.packageJSON.contributes;
if (contributes && contributes.html && contributes.html.customData && Array.isArray(contributes.html.customData)) {
const relativePaths: string[] = contributes.html.customData;
relativePaths.forEach(rp => {
dataPaths.push(path.resolve(extension.extensionPath, rp));
});
}
}
return dataPaths;
}
......@@ -13,7 +13,7 @@ import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, Re
import { EMPTY_ELEMENTS } from './htmlEmptyTagsShared';
import { activateTagClosing } from './tagClosing';
import TelemetryReporter from 'vscode-extension-telemetry';
import { getCustomDataPathsInAllWorkspaces } from './customData';
import { getCustomDataPathsInAllWorkspaces, getCustomDataPathsFromAllExtensions } from './customData';
namespace TagCloseRequest {
export const type: RequestType<TextDocumentPositionParams, string, any, any> = new RequestType('html/tag');
......@@ -50,7 +50,10 @@ export function activate(context: ExtensionContext) {
let documentSelector = ['html', 'handlebars', 'razor'];
let embeddedLanguages = { css: true, javascript: true };
let { dataPaths } = getCustomDataPathsInAllWorkspaces(workspace.workspaceFolders);
let dataPaths = [
...getCustomDataPathsInAllWorkspaces(workspace.workspaceFolders),
...getCustomDataPathsFromAllExtensions()
];
// Options to control the language client
let clientOptions: LanguageClientOptions = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册