From 8281f408dc3d0ac1d70c7825afdd8e4db751fcba Mon Sep 17 00:00:00 2001 From: Shati Patel <42641846+shati-patel@users.noreply.github.com> Date: Fri, 23 Apr 2021 17:31:46 +0100 Subject: [PATCH] Add command to copy version information --- .github/ISSUE_TEMPLATE/bug_report.md | 7 ++++++- extensions/ql-vscode/package.json | 4 ++++ extensions/ql-vscode/src/extension.ts | 9 +++++++++ extensions/ql-vscode/src/status-bar.ts | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 80ee28226..88719291d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -10,7 +10,12 @@ assignees: '' **Describe the bug** A clear and concise description of what the bug is. -**To Reproduce** +**Version** +The CodeQL and VS Code version in which the bug occurs. + + +**To reproduce** Steps to reproduce the behavior. **Expected behavior** diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index 3bc839763..dfbe4f2e4 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -242,6 +242,10 @@ "command": "codeQL.openDocumentation", "title": "CodeQL: Open Documentation" }, + { + "command": "codeQL.copyVersion", + "title": "CodeQL: Copy Version Information" + }, { "command": "codeQLDatabases.chooseDatabaseFolder", "title": "Choose Database from Folder", diff --git a/extensions/ql-vscode/src/extension.ts b/extensions/ql-vscode/src/extension.ts index ec76182c1..1eb228f33 100644 --- a/extensions/ql-vscode/src/extension.ts +++ b/extensions/ql-vscode/src/extension.ts @@ -13,6 +13,7 @@ import { window } from 'vscode'; import { LanguageClient } from 'vscode-languageclient'; +import * as os from 'os'; import * as path from 'path'; import { testExplorerExtensionId, TestHub } from 'vscode-test-adapter-api'; @@ -700,6 +701,14 @@ async function activateWithInstalledDistribution( commandRunner('codeQL.openDocumentation', async () => env.openExternal(Uri.parse('https://codeql.github.com/docs/')))); + ctx.subscriptions.push( + commandRunner('codeQL.copyVersion', async () => { + const text = `CodeQL extension version: ${extension?.packageJSON.version} \nCodeQL CLI version: ${await cliServer.getVersion()} \nPlatform: ${os.platform()} ${os.arch()}`; + env.clipboard.writeText(text); + helpers.showAndLogInformationMessage(text); + })); + + logger.log('Starting language server.'); ctx.subscriptions.push(client.start()); diff --git a/extensions/ql-vscode/src/status-bar.ts b/extensions/ql-vscode/src/status-bar.ts index b9ecbb691..78ac9a9b6 100644 --- a/extensions/ql-vscode/src/status-bar.ts +++ b/extensions/ql-vscode/src/status-bar.ts @@ -19,7 +19,7 @@ export class CodeQlStatusBarHandler extends DisposableObject { this.push(this.item); this.push(workspace.onDidChangeConfiguration(this.handleDidChangeConfiguration, this)); this.push(distributionConfigListener.onDidChangeConfiguration(() => this.updateStatusItem())); - this.item.command = 'codeQL.openDocumentation'; + this.item.command = 'codeQL.copyVersion'; this.updateStatusItem(); } @@ -37,7 +37,7 @@ export class CodeQlStatusBarHandler extends DisposableObject { private async updateStatusItem() { const canary = CANARY_FEATURES.getValue() ? ' (Canary)' : ''; - // since getting the verison may take a few seconds, initialize with some + // since getting the version may take a few seconds, initialize with some // meaningful text. this.item.text = `CodeQL${canary}`;