Skip to content

Commit 8281f40

Browse files
shati-patelaeisenberg
authored andcommitted
Add command to copy version information
1 parent fce9bbc commit 8281f40

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ assignees: ''
1010
**Describe the bug**
1111
A clear and concise description of what the bug is.
1212

13-
**To Reproduce**
13+
**Version**
14+
The CodeQL and VS Code version in which the bug occurs.
15+
<!-- To copy version information for the CodeQL extension, click "CodeQL CLI vX.X.X" in the status bar at the bottom of the screen.
16+
To copy detailed version information for VS Code itself, see https://code.visualstudio.com/docs/supporting/FAQ#_how-do-i-find-the-version. -->
17+
18+
**To reproduce**
1419
Steps to reproduce the behavior.
1520

1621
**Expected behavior**

extensions/ql-vscode/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@
242242
"command": "codeQL.openDocumentation",
243243
"title": "CodeQL: Open Documentation"
244244
},
245+
{
246+
"command": "codeQL.copyVersion",
247+
"title": "CodeQL: Copy Version Information"
248+
},
245249
{
246250
"command": "codeQLDatabases.chooseDatabaseFolder",
247251
"title": "Choose Database from Folder",

extensions/ql-vscode/src/extension.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
window
1414
} from 'vscode';
1515
import { LanguageClient } from 'vscode-languageclient';
16+
import * as os from 'os';
1617
import * as path from 'path';
1718
import { testExplorerExtensionId, TestHub } from 'vscode-test-adapter-api';
1819

@@ -700,6 +701,14 @@ async function activateWithInstalledDistribution(
700701
commandRunner('codeQL.openDocumentation', async () =>
701702
env.openExternal(Uri.parse('https://codeql.github.com/docs/'))));
702703

704+
ctx.subscriptions.push(
705+
commandRunner('codeQL.copyVersion', async () => {
706+
const text = `CodeQL extension version: ${extension?.packageJSON.version} \nCodeQL CLI version: ${await cliServer.getVersion()} \nPlatform: ${os.platform()} ${os.arch()}`;
707+
env.clipboard.writeText(text);
708+
helpers.showAndLogInformationMessage(text);
709+
}));
710+
711+
703712
logger.log('Starting language server.');
704713
ctx.subscriptions.push(client.start());
705714

extensions/ql-vscode/src/status-bar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class CodeQlStatusBarHandler extends DisposableObject {
1919
this.push(this.item);
2020
this.push(workspace.onDidChangeConfiguration(this.handleDidChangeConfiguration, this));
2121
this.push(distributionConfigListener.onDidChangeConfiguration(() => this.updateStatusItem()));
22-
this.item.command = 'codeQL.openDocumentation';
22+
this.item.command = 'codeQL.copyVersion';
2323
this.updateStatusItem();
2424
}
2525

@@ -37,7 +37,7 @@ export class CodeQlStatusBarHandler extends DisposableObject {
3737

3838
private async updateStatusItem() {
3939
const canary = CANARY_FEATURES.getValue() ? ' (Canary)' : '';
40-
// since getting the verison may take a few seconds, initialize with some
40+
// since getting the version may take a few seconds, initialize with some
4141
// meaningful text.
4242
this.item.text = `CodeQL${canary}`;
4343

0 commit comments

Comments
 (0)