From af57ecdf9d303b2b1a3e93caf285795ba0550cab Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Wed, 30 Jan 2019 11:58:42 -0800 Subject: [PATCH] Fix #67544 --- .../client/src/customData.ts | 11 ++++++++--- .../client/src/customData.ts | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/extensions/css-language-features/client/src/customData.ts b/extensions/css-language-features/client/src/customData.ts index 8ba0770235a..b6db79db75d 100644 --- a/extensions/css-language-features/client/src/customData.ts +++ b/extensions/css-language-features/client/src/customData.ts @@ -28,9 +28,14 @@ export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFol wfCSSConfig.workspaceFolderValue.experimental && wfCSSConfig.workspaceFolderValue.experimental.customData ) { - wfCSSConfig.workspaceFolderValue.experimental.customData.forEach(p => [ - dataPaths.push(path.resolve(wf.uri.fsPath, p)) - ]); + const customData = wfCSSConfig.workspaceFolderValue.experimental.customData; + if (Array.isArray(customData)) { + customData.forEach(t => { + if (typeof t === 'string') { + dataPaths.push(path.resolve(wf.uri.fsPath, t)); + } + }); + } } }); diff --git a/extensions/html-language-features/client/src/customData.ts b/extensions/html-language-features/client/src/customData.ts index 8e9bf2863b6..2c8c7615a35 100644 --- a/extensions/html-language-features/client/src/customData.ts +++ b/extensions/html-language-features/client/src/customData.ts @@ -26,11 +26,15 @@ export function getCustomDataPathsInAllWorkspaces(workspaceFolders: WorkspaceFol if ( wfHtmlConfig && wfHtmlConfig.workspaceFolderValue && - wfHtmlConfig.workspaceFolderValue.experimental + wfHtmlConfig.workspaceFolderValue.experimental && + wfHtmlConfig.workspaceFolderValue.experimental.customData ) { - if (wfHtmlConfig.workspaceFolderValue.experimental.customData) { - wfHtmlConfig.workspaceFolderValue.experimental.customData.forEach(t => { - dataPaths.push(path.resolve(wf.uri.fsPath, t)); + const customData = wfHtmlConfig.workspaceFolderValue.experimental.customData; + if (Array.isArray(customData)) { + customData.forEach(t => { + if (typeof t === 'string') { + dataPaths.push(path.resolve(wf.uri.fsPath, t)); + } }); } } @@ -45,7 +49,12 @@ export function getCustomDataPathsFromAllExtensions(): string[] { for (const extension of extensions.all) { const contributes = extension.packageJSON && extension.packageJSON.contributes; - if (contributes && contributes.html && contributes.html.experimental.customData && Array.isArray(contributes.html.experimental.customData)) { + if ( + contributes && + contributes.html && + contributes.html.experimental.customData && + Array.isArray(contributes.html.experimental.customData) + ) { const relativePaths: string[] = contributes.html.customData; relativePaths.forEach(rp => { dataPaths.push(path.resolve(extension.extensionPath, rp)); -- GitLab