Skip to content

Commit d14c844

Browse files
author
Dave Bartolomeo
committed
Relax linting for debug configuration variable commands
1 parent 809c86f commit d14c844

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

extensions/ql-vscode/test/unit-tests/command-lint.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ type CmdDecl = {
77
title?: string;
88
};
99

10+
type DebuggerDecl = {
11+
variables?: Record<string, string>;
12+
};
13+
1014
describe("commands declared in package.json", () => {
1115
const manifest = readJsonSync(join(__dirname, "../../package.json"));
1216
const commands = manifest.contributes.commands;
1317
const menus = manifest.contributes.menus;
18+
const debuggers = manifest.contributes.debuggers;
1419

1520
const disabledInPalette: Set<string> = new Set<string>();
1621

@@ -60,6 +65,15 @@ describe("commands declared in package.json", () => {
6065
contribContextMenuCmds.add(command);
6166
});
6267

68+
debuggers.forEach((debuggerDecl: DebuggerDecl) => {
69+
if (debuggerDecl.variables !== undefined) {
70+
for (const command of Object.values(debuggerDecl.variables)) {
71+
// Commands used as debug configuration variables need not be enabled in the command palette.
72+
paletteCmds.delete(command);
73+
}
74+
}
75+
});
76+
6377
menus.commandPalette.forEach((commandDecl: CmdDecl) => {
6478
if (commandDecl.when === "false")
6579
disabledInPalette.add(commandDecl.command);
@@ -85,6 +99,9 @@ describe("commands declared in package.json", () => {
8599
it("should have the right commands accessible from the command palette", () => {
86100
paletteCmds.forEach((command) => {
87101
// command ${command} should be enabled in the command palette
102+
if (disabledInPalette.has(command) !== false) {
103+
expect(command).toBe("enabled");
104+
}
88105
expect(disabledInPalette.has(command)).toBe(false);
89106
});
90107

0 commit comments

Comments
 (0)