From c0f8d12673f87fe5331fd22a0f9ff0bbb2eb2e25 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 29 Aug 2017 18:01:32 +0200 Subject: [PATCH] IntelliSense not work in settings.json . Fixes #33069 --- extensions/json/client/src/jsonMain.ts | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/extensions/json/client/src/jsonMain.ts b/extensions/json/client/src/jsonMain.ts index ecbb69fb490..a4b6a17445d 100644 --- a/extensions/json/client/src/jsonMain.ts +++ b/extensions/json/client/src/jsonMain.ts @@ -204,28 +204,30 @@ function getSettings(): Settings { } let folders = workspace.workspaceFolders; - folders.forEach(folder => { - let jsonConfig = workspace.getConfiguration('json', folder.uri); - let schemaConfigInfo = jsonConfig.inspect('schemas'); - let folderSchemas = schemaConfigInfo.workspaceFolderValue; - if (Array.isArray(folderSchemas)) { - folderSchemas.forEach(schema => { - let url = schema.url; - if (!url && schema.schema) { - url = schema.schema.id; - } - if (url && url[0] === '.') { - url = Uri.file(path.normalize(path.join(folder.uri.fsPath, url))).toString(); - } - let fileMatch = schema.fileMatch; + if (folders) { + folders.forEach(folder => { + let jsonConfig = workspace.getConfiguration('json', folder.uri); + let schemaConfigInfo = jsonConfig.inspect('schemas'); + let folderSchemas = schemaConfigInfo.workspaceFolderValue; + if (Array.isArray(folderSchemas)) { + folderSchemas.forEach(schema => { + let url = schema.url; + if (!url && schema.schema) { + url = schema.schema.id; + } + if (url && url[0] === '.') { + url = Uri.file(path.normalize(path.join(folder.uri.fsPath, url))).toString(); + } + let fileMatch = schema.fileMatch; - if (fileMatch) { - fileMatch = fileMatch.map(m => path.join(folder.uri.path + '*', m)); - } - schemas.push({ url, fileMatch, schema: schema.schema }); - }); - }; - }); + if (fileMatch) { + fileMatch = fileMatch.map(m => path.join(folder.uri.path + '*', m)); + } + schemas.push({ url, fileMatch, schema: schema.schema }); + }); + }; + }); + } return settings; }