Skip to content

Commit f463886

Browse files
generateOptionsSchema: a few improvements for debugging logging (#6286)
This PR makes three small improvements to `generateOptionsSchema` in preparation for some improvements to debugger logging: 1. Instead of exposing all of the debugger logging options for unit tests, just expose the non-diagnostic logic options. These options can be turned on for unit tests like any other kind of debugging (ex: `csharp.debug.logging.engineLogging`). 2. Support `deprecationMessage`. This is VSCode's way of deprecating settings. 3. Add a launch.json configuration for debugging the `generateOptionsSchema` code
1 parent 4c6d5f2 commit f463886

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

.vscode/launch.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,17 @@
290290
"NEW_DEPS_ID": "Razor"
291291
},
292292
"cwd": "${workspaceFolder}"
293-
}
293+
},
294+
{
295+
"type": "node",
296+
"request": "launch",
297+
"name": "Generate debugger options schema",
298+
"preLaunchTask": "build",
299+
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
300+
"args": [
301+
"generateOptionsSchema"
302+
],
303+
"cwd": "${workspaceFolder}"
304+
}
294305
]
295306
}

package.json

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,21 +1407,6 @@
14071407
"markdownDescription": "%generateOptionsSchema.logging.programOutput.markdownDescription%",
14081408
"default": true
14091409
},
1410-
"engineLogging": {
1411-
"type": "boolean",
1412-
"markdownDescription": "%generateOptionsSchema.logging.engineLogging.markdownDescription%",
1413-
"default": false
1414-
},
1415-
"browserStdOut": {
1416-
"type": "boolean",
1417-
"markdownDescription": "%generateOptionsSchema.logging.browserStdOut.markdownDescription%",
1418-
"default": true
1419-
},
1420-
"elapsedTiming": {
1421-
"type": "boolean",
1422-
"markdownDescription": "%generateOptionsSchema.logging.elapsedTiming.markdownDescription%",
1423-
"default": false
1424-
},
14251410
"threadExit": {
14261411
"type": "boolean",
14271412
"markdownDescription": "%generateOptionsSchema.logging.threadExit.markdownDescription%",
@@ -5002,4 +4987,4 @@
50024987
}
50034988
]
50044989
}
5005-
}
4990+
}

src/tools/generateOptionsSchema.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,22 @@ function generateLocForProperty(key: string, prop: any, keyToLocString: any): vo
217217
prop.settingsDescription = `%${settingsDescriptionKey}%`;
218218
}
219219

220+
if (prop.deprecationMessage) {
221+
const descriptionKey = `${key}.deprecationMessage`;
222+
if (!keyToLocString[descriptionKey]) {
223+
const comments: string[] = generateCommentArrayForDescription(prop.deprecationMessage);
224+
if (comments.length > 0) {
225+
keyToLocString[descriptionKey] = {
226+
message: prop.deprecationMessage,
227+
comments: comments,
228+
};
229+
} else {
230+
keyToLocString[descriptionKey] = prop.deprecationMessage;
231+
}
232+
}
233+
prop.deprecationMessage = `%${descriptionKey}%`;
234+
}
235+
220236
if (prop.enum && prop.enumDescriptions) {
221237
for (let i = 0; i < prop.enum.length; i++) {
222238
const enumName = prop.enum[i];
@@ -325,6 +341,19 @@ export function GenerateOptionsSchema() {
325341
delete unitTestDebuggingOptions.processName;
326342
delete unitTestDebuggingOptions.processId;
327343
delete unitTestDebuggingOptions.pipeTransport;
344+
345+
// Remove diagnostic log logging options -- these should be set using the global option
346+
const allowedLoggingOptions = ['exceptions', 'moduleLoad', 'programOutput', 'threadExit', 'processExit'];
347+
const diagnosticLogOptions = Object.keys(unitTestDebuggingOptions.logging.properties).filter((x) => {
348+
if (allowedLoggingOptions.indexOf(x) >= 0) {
349+
return false;
350+
}
351+
return true;
352+
});
353+
for (const key of diagnosticLogOptions) {
354+
delete unitTestDebuggingOptions.logging.properties[key];
355+
}
356+
328357
// Add the additional options we do want
329358
unitTestDebuggingOptions['type'] = {
330359
type: 'string',

0 commit comments

Comments
 (0)