Skip to content

Commit c0f8d12

Browse files
committed
IntelliSense not work in settings.json . Fixes microsoft#33069
1 parent 7dc1ddd commit c0f8d12

1 file changed

Lines changed: 24 additions & 22 deletions

File tree

extensions/json/client/src/jsonMain.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,30 @@ function getSettings(): Settings {
204204
}
205205

206206
let folders = workspace.workspaceFolders;
207-
folders.forEach(folder => {
208-
let jsonConfig = workspace.getConfiguration('json', folder.uri);
209-
let schemaConfigInfo = jsonConfig.inspect<JSONSchemaSettings[]>('schemas');
210-
let folderSchemas = schemaConfigInfo.workspaceFolderValue;
211-
if (Array.isArray(folderSchemas)) {
212-
folderSchemas.forEach(schema => {
213-
let url = schema.url;
214-
if (!url && schema.schema) {
215-
url = schema.schema.id;
216-
}
217-
if (url && url[0] === '.') {
218-
url = Uri.file(path.normalize(path.join(folder.uri.fsPath, url))).toString();
219-
}
220-
let fileMatch = schema.fileMatch;
221-
222-
if (fileMatch) {
223-
fileMatch = fileMatch.map(m => path.join(folder.uri.path + '*', m));
224-
}
225-
schemas.push({ url, fileMatch, schema: schema.schema });
226-
});
227-
};
228-
});
207+
if (folders) {
208+
folders.forEach(folder => {
209+
let jsonConfig = workspace.getConfiguration('json', folder.uri);
210+
let schemaConfigInfo = jsonConfig.inspect<JSONSchemaSettings[]>('schemas');
211+
let folderSchemas = schemaConfigInfo.workspaceFolderValue;
212+
if (Array.isArray(folderSchemas)) {
213+
folderSchemas.forEach(schema => {
214+
let url = schema.url;
215+
if (!url && schema.schema) {
216+
url = schema.schema.id;
217+
}
218+
if (url && url[0] === '.') {
219+
url = Uri.file(path.normalize(path.join(folder.uri.fsPath, url))).toString();
220+
}
221+
let fileMatch = schema.fileMatch;
222+
223+
if (fileMatch) {
224+
fileMatch = fileMatch.map(m => path.join(folder.uri.path + '*', m));
225+
}
226+
schemas.push({ url, fileMatch, schema: schema.schema });
227+
});
228+
};
229+
});
230+
}
229231
return settings;
230232
}
231233

0 commit comments

Comments
 (0)