This commit is contained in:
Pine Wu
2019-08-27 09:25:15 -07:00
parent 04d52502b8
commit 739ae7737a
6 changed files with 80 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import * as path from 'path';
import { workspace, WorkspaceFolder, extensions } from 'vscode';
interface ExperimentalConfig {
customData?: string[];
experimental?: {
customData?: string[];
};
@@ -23,6 +24,17 @@ export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFol
const allHtmlConfig = workspace.getConfiguration(undefined, wf.uri);
const wfHtmlConfig = allHtmlConfig.inspect<ExperimentalConfig>('html');
if (wfHtmlConfig && wfHtmlConfig.workspaceFolderValue && wfHtmlConfig.workspaceFolderValue.customData) {
const customData = wfHtmlConfig.workspaceFolderValue.customData;
if (Array.isArray(customData)) {
customData.forEach(t => {
if (typeof t === 'string') {
dataPaths.push(path.resolve(wf.uri.fsPath, t));
}
});
}
}
if (
wfHtmlConfig &&
wfHtmlConfig.workspaceFolderValue &&
@@ -52,6 +64,19 @@ export function getCustomDataPathsFromAllExtensions(): string[] {
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));
});
}
if (
contributes &&
contributes.html &&
contributes.html.experimental &&
contributes.html.experimental.customData &&
Array.isArray(contributes.html.experimental.customData)
) {