Skip to content

Commit 7288712

Browse files
committed
Unscope mock commands
This reverts commit 57ba12d.
1 parent 74ae5a7 commit 7288712

File tree

4 files changed

+18
-37
lines changed

4 files changed

+18
-37
lines changed

extensions/ql-vscode/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -647,16 +647,16 @@
647647
"enablement": "codeql.hasQLSource"
648648
},
649649
{
650-
"command": "codeQLMockGitHubApiServer.startRecording",
651-
"title": "CodeQL Mock GitHub API Server: Start Scenario Recording"
650+
"command": "codeQL.mockGitHubApiServer.startRecording",
651+
"title": "CodeQL: Mock GitHub API Server: Start Scenario Recording"
652652
},
653653
{
654-
"command": "codeQLMockGitHubApiServer.saveScenario",
655-
"title": "CodeQL Mock GitHub API Server: Save Scenario"
654+
"command": "codeQL.mockGitHubApiServer.saveScenario",
655+
"title": "CodeQL: Mock GitHub API Server: Save Scenario"
656656
},
657657
{
658-
"command": "codeQLMockGitHubApiServer.cancelRecording",
659-
"title": "CodeQL Mock GitHub API Server: Cancel Scenario Recording"
658+
"command": "codeQL.mockGitHubApiServer.cancelRecording",
659+
"title": "CodeQL: Mock GitHub API Server: Cancel Scenario Recording"
660660
}
661661
],
662662
"menus": {
@@ -1118,16 +1118,16 @@
11181118
"when": "false"
11191119
},
11201120
{
1121-
"command": "codeQLMockGitHubApiServer.startRecording",
1122-
"when": "config.codeQL.variantAnalysis.mockGitHubApiServer && !codeQLMockGitHubApiServer.recording"
1121+
"command": "codeQL.mockGitHubApiServer.startRecording",
1122+
"when": "config.codeQL.variantAnalysis.mockGitHubApiServer && !codeQL.mockGitHubApiServer.recording"
11231123
},
11241124
{
1125-
"command": "codeQLMockGitHubApiServer.saveScenario",
1126-
"when": "config.codeQL.variantAnalysis.mockGitHubApiServer && codeQLMockGitHubApiServer.recording"
1125+
"command": "codeQL.mockGitHubApiServer.saveScenario",
1126+
"when": "config.codeQL.variantAnalysis.mockGitHubApiServer && codeQL.mockGitHubApiServer.recording"
11271127
},
11281128
{
1129-
"command": "codeQLMockGitHubApiServer.cancelRecording",
1130-
"when": "config.codeQL.variantAnalysis.mockGitHubApiServer && codeQLMockGitHubApiServer.recording"
1129+
"command": "codeQL.mockGitHubApiServer.cancelRecording",
1130+
"when": "config.codeQL.variantAnalysis.mockGitHubApiServer && codeQL.mockGitHubApiServer.recording"
11311131
}
11321132
],
11331133
"editor/context": [

extensions/ql-vscode/src/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,19 +1195,19 @@ async function activateWithInstalledDistribution(
11951195
ctx.subscriptions.push(mockServer);
11961196
ctx.subscriptions.push(
11971197
commandRunner(
1198-
'codeQLMockGitHubApiServer.startRecording',
1198+
'codeQL.mockGitHubApiServer.startRecording',
11991199
async () => await mockServer.startRecording(),
12001200
)
12011201
);
12021202
ctx.subscriptions.push(
12031203
commandRunner(
1204-
'codeQLMockGitHubApiServer.saveScenario',
1204+
'codeQL.mockGitHubApiServer.saveScenario',
12051205
async () => await mockServer.saveScenario(),
12061206
)
12071207
);
12081208
ctx.subscriptions.push(
12091209
commandRunner(
1210-
'codeQLMockGitHubApiServer.cancelRecording',
1210+
'codeQL.mockGitHubApiServer.cancelRecording',
12111211
async () => await mockServer.cancelRecording(),
12121212
)
12131213
);

extensions/ql-vscode/src/mocks/mock-gh-api-server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class MockGitHubApiServer extends DisposableObject {
6060

6161
this.recorder.start();
6262
// Set a value in the context to track whether we are recording. This allows us to use this to show/hide commands (see package.json)
63-
await commands.executeCommand('setContext', 'codeQLMockGitHubApiServer.recording', true);
63+
await commands.executeCommand('setContext', 'codeQL.mockGitHubApiServer.recording', true);
6464

6565
await window.showInformationMessage('Recording scenario. To save the scenario, use the "CodeQL Mock GitHub API Server: Save Scenario" command.');
6666
}
@@ -72,7 +72,7 @@ export class MockGitHubApiServer extends DisposableObject {
7272
}
7373

7474
// Set a value in the context to track whether we are recording. This allows us to use this to show/hide commands (see package.json)
75-
await commands.executeCommand('setContext', 'codeQLMockGitHubApiServer.recording', false);
75+
await commands.executeCommand('setContext', 'codeQL.mockGitHubApiServer.recording', false);
7676

7777
if (!this.recorder.isRecording) {
7878
void window.showErrorMessage('No scenario is currently being recorded.');
@@ -118,7 +118,7 @@ export class MockGitHubApiServer extends DisposableObject {
118118

119119
private async stopRecording(): Promise<void> {
120120
// Set a value in the context to track whether we are recording. This allows us to use this to show/hide commands (see package.json)
121-
await commands.executeCommand('setContext', 'codeQLMockGitHubApiServer.recording', false);
121+
await commands.executeCommand('setContext', 'codeQL.mockGitHubApiServer.recording', false);
122122

123123
await this.recorder.stop();
124124
await this.recorder.clear();

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ describe('commands declared in package.json', function() {
2727
const scopedCmds: Set<string> = new Set<string>();
2828
const commandTitles: { [cmd: string]: string } = {};
2929

30-
// These are commands which are only used for testing/development
31-
const testCmds = new Set<string>();
32-
3330
commands.forEach((commandDecl: CmdDecl) => {
3431
const { command, title } = commandDecl;
3532
if (
@@ -51,13 +48,6 @@ describe('commands declared in package.json', function() {
5148
expect(title).not.to.be.undefined;
5249
commandTitles[command] = title!;
5350
}
54-
else if (
55-
command.match(/^codeQLMockGitHubApiServer\./)
56-
) {
57-
testCmds.add(command);
58-
expect(title).not.to.be.undefined;
59-
commandTitles[command] = title!;
60-
}
6151
else {
6252
expect.fail(`Unexpected command name ${command}`);
6353
}
@@ -92,22 +82,13 @@ describe('commands declared in package.json', function() {
9282
scopedCmds.forEach(command => {
9383
expect(commandTitles[command], `command ${command} should not be prefixed with 'CodeQL: ', since it is accessible from an extension-controlled context`).not.to.match(/^CodeQL: /);
9484
});
95-
96-
testCmds.forEach(command => {
97-
expect(commandTitles[command], `command ${command} should be prefixed with 'CodeQL ', since it is a testing/development command`).to.match(/^CodeQL /);
98-
expect(commandTitles[command], `command ${command} should not be prefixed with 'CodeQL: ', since it is a testing/development command`).not.to.match(/^CodeQL: /);
99-
});
10085
});
10186

10287
it('should have the right commands accessible from the command palette', function() {
10388
paletteCmds.forEach(command => {
10489
expect(disabledInPalette.has(command), `command ${command} should be enabled in the command palette`).to.be.false;
10590
});
10691

107-
testCmds.forEach(command => {
108-
expect(disabledInPalette.has(command), `command ${command} should be enabled in the command palette`).to.be.false;
109-
});
110-
11192
// Commands in contribContextMenuCmds may reasonbly be enabled or
11293
// disabled in the command palette; for example, codeQL.runQuery
11394
// is available there, since we heuristically figure out which

0 commit comments

Comments
 (0)