Skip to content

Commit 8a671be

Browse files
committed
Merge remote-tracking branch 'origin/main' into koesie10/refactor-common-components
2 parents 3817133 + 0476815 commit 8a671be

49 files changed

Lines changed: 736 additions & 71 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
"runtimeArgs": [
3636
"--inspect=9229"
3737
],
38+
"env": {
39+
"LANG": "en-US"
40+
},
3841
"args": [
3942
"--exit",
4043
"-u",
@@ -43,6 +46,8 @@
4346
"--diff",
4447
"-r",
4548
"ts-node/register",
49+
"-r",
50+
"test/mocha.setup.js",
4651
"test/pure-tests/**/*.ts"
4752
],
4853
"stopOnEntry": false,

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ From inside of VSCode, open the `launch.json` file and in the _Launch Integratio
160160
* **IMPORTANT** Make sure you are on the `main` branch and your local checkout is fully updated when you add the tag.
161161
* If you accidentally add the tag to the wrong ref, you can just force push it to the right one later.
162162
1. Monitor the status of the release build in the `Release` workflow in the Actions tab.
163+
* DO NOT approve the "publish" stages of the workflow yet.
163164
1. Download the VSIX from the draft GitHub release at the top of [the releases page](https://github.com/github/vscode-codeql/releases) that is created when the release build finishes.
164165
1. Unzip the `.vsix` and inspect its `package.json` to make sure the version is what you expect,
165166
or look at the source if there's any doubt the right code is being shipped.

extensions/ql-vscode/CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## [UNRELEASED]
44

5+
## 1.7.0 - 20 September 2022
6+
57
- Remove ability to download databases from LGTM. [#1467](https://github.com/github/vscode-codeql/pull/1467)
6-
- Removed the ability to manually upgrade databases from the context menu on databases. Databases are non-destructively upgraded automatically so
7-
for most users this was not needed. For advanced users this is still available in the Command Palette. [#1501](https://github.com/github/vscode-codeql/pull/1501)
8+
- Removed the ability to manually upgrade databases from the context menu on databases. Databases are non-destructively upgraded automatically so for most users this was not needed. For advanced users this is still available in the Command Palette. [#1501](https://github.com/github/vscode-codeql/pull/1501)
9+
- Always restart the query server after a manual database upgrade. This avoids a bug in the query server where an invalid dbscheme was being retained in memory after an upgrade. [#1519](https://github.com/github/vscode-codeql/pull/1519)
810

911
## 1.6.12 - 1 September 2022
1012

@@ -20,7 +22,7 @@ No user facing changes.
2022

2123
No user facing changes.
2224

23-
## 1.6.9 - 20 July 2022
25+
## 1.6.9 - 20 July 2022
2426

2527
No user facing changes.
2628

extensions/ql-vscode/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "CodeQL for Visual Studio Code",
55
"author": "GitHub",
66
"private": true,
7-
"version": "1.6.13",
7+
"version": "1.7.1",
88
"publisher": "GitHub",
99
"license": "MIT",
1010
"icon": "media/VS-marketplace-CodeQL-icon.png",
@@ -1192,7 +1192,7 @@
11921192
"watch:extension": "tsc --watch",
11931193
"watch:webpack": "gulp watchView",
11941194
"test": "npm-run-all -p test:*",
1195-
"test:unit": "mocha --exit -r ts-node/register test/pure-tests/**/*.ts",
1195+
"test:unit": "mocha --exit -r ts-node/register -r test/mocha.setup.js test/pure-tests/**/*.ts",
11961196
"test:view": "jest",
11971197
"preintegration": "rm -rf ./out/vscode-tests && gulp",
11981198
"integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",

extensions/ql-vscode/src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,8 @@ async function activateWithInstalledDistribution(
915915
}));
916916

917917
ctx.subscriptions.push(
918-
commandRunner('codeQL.exportVariantAnalysisResults', async () => {
919-
await exportRemoteQueryResults(qhm, rqm, ctx);
918+
commandRunner('codeQL.exportVariantAnalysisResults', async (queryId?: string) => {
919+
await exportRemoteQueryResults(qhm, rqm, ctx, queryId);
920920
})
921921
);
922922

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Contains an assortment of helper constants and functions for working with dates.
3+
*/
4+
5+
const dateWithoutYearFormatter = new Intl.DateTimeFormat(undefined, {
6+
month: 'short',
7+
day: 'numeric',
8+
hour: 'numeric',
9+
minute: '2-digit',
10+
});
11+
12+
const dateFormatter = new Intl.DateTimeFormat(undefined, {
13+
year: 'numeric',
14+
month: 'short',
15+
day: 'numeric',
16+
hour: 'numeric',
17+
minute: '2-digit',
18+
});
19+
20+
export function formatDate(value: Date): string {
21+
if (value.getFullYear() === new Date().getFullYear()) {
22+
return dateWithoutYearFormatter.format(value);
23+
}
24+
25+
return dateFormatter.format(value);
26+
}

extensions/ql-vscode/src/pure/interface-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ export interface RemoteQueryDownloadAllAnalysesResultsMessage {
422422

423423
export interface RemoteQueryExportResultsMessage {
424424
t: 'remoteQueryExportResults';
425+
queryId: string;
425426
}
426427

427428
export interface CopyRepoListMessage {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Contains an assortment of helper constants and functions for working with numbers.
3+
*/
4+
5+
const numberFormatter = new Intl.NumberFormat('en-US');
6+
7+
/**
8+
* Formats a number to be human-readable with decimal places and thousands separators.
9+
*
10+
* @param value The number to format.
11+
* @returns The formatted number. For example, "10,000", "1,000,000", or "1,000,000,000".
12+
*/
13+
export function formatDecimal(value: number): string {
14+
return numberFormatter.format(value);
15+
}

extensions/ql-vscode/src/pure/time.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Contains an assortment of helper constants and functions for working with time, dates, and durations.
33
*/
44

5-
export const ONE_MINUTE_IN_MS = 1000 * 60;
5+
export const ONE_SECOND_IN_MS = 1000;
6+
export const ONE_MINUTE_IN_MS = ONE_SECOND_IN_MS * 60;
67
export const ONE_HOUR_IN_MS = ONE_MINUTE_IN_MS * 60;
78
export const TWO_HOURS_IN_MS = ONE_HOUR_IN_MS * 2;
89
export const THREE_HOURS_IN_MS = ONE_HOUR_IN_MS * 3;
@@ -43,20 +44,23 @@ export function humanizeRelativeTime(relativeTimeMillis?: number) {
4344

4445
/**
4546
* Converts a number of milliseconds into a human-readable string with units, indicating an amount of time.
46-
* Negative numbers have no meaning and are considered to be "Less than a minute".
47+
* Negative numbers have no meaning and are considered to be "Less than a second".
4748
*
4849
* @param millis The number of milliseconds to convert.
49-
* @returns A humanized duration. For example, "2 minutes", "2 hours", "2 days", or "2 months".
50+
* @returns A humanized duration. For example, "2 seconds", "2 minutes", "2 hours", "2 days", or "2 months".
5051
*/
5152
export function humanizeUnit(millis?: number): string {
5253
// assume a blank or empty string is a zero
5354
// assume anything less than 0 is a zero
54-
if (!millis || millis < ONE_MINUTE_IN_MS) {
55-
return 'Less than a minute';
55+
if (!millis || millis < ONE_SECOND_IN_MS) {
56+
return 'Less than a second';
5657
}
5758
let unit: string;
5859
let unitDiff: number;
59-
if (millis < ONE_HOUR_IN_MS) {
60+
if (millis < ONE_MINUTE_IN_MS) {
61+
unit = 'second';
62+
unitDiff = Math.floor(millis / ONE_SECOND_IN_MS);
63+
} else if (millis < ONE_HOUR_IN_MS) {
6064
unit = 'minute';
6165
unitDiff = Math.floor(millis / ONE_MINUTE_IN_MS);
6266
} else if (millis < ONE_DAY_IN_MS) {

0 commit comments

Comments
 (0)