Skip to content

Commit a7db702

Browse files
authored
Merge pull request #110 from geriyoco/main
🚀 Release v1.2.1
2 parents 8623c46 + 7dafa01 commit a7db702

File tree

6 files changed

+27
-46
lines changed

6 files changed

+27
-46
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Change Log
22

3+
## [1.2.1] - 2022-09-28
4+
### Fixed
5+
- Supported file extensions are now consistent between [`package.json`](package.json) and [`src/utils.ts`](src/utils.ts).
6+
37
## [1.2.0] - 2022-09-21
48
### Added
5-
- Telemetry for feature insights. We strive to be transparent at what we collect. See [telemetry.json](telemetry.json) for all the events we collect. Following the [Microsoft Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement), we do not collect any Personally Identifiable Information (PII). Check out the open-source repository at [here](https://github.com/geriyoco/vscode-image-gallery) to inspect the code. You can always opt-out of telemetry by setting `geriyocoImageGallery.isTelemetryEnabled` to `false` in your VS Code settings. Visit [here](https://code.visualstudio.com/docs/getstarted/telemetry) to learn more about VS Code telemetry.
9+
- Telemetry for feature insights. We strive to be transparent at what we collect. See [`telemetry.json`](telemetry.json) for all the events we collect. Following the [Microsoft Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement), we do not collect any Personally Identifiable Information (PII). Check out the open-source repository at [here](https://github.com/geriyoco/vscode-image-gallery) to inspect the code. You can always opt-out of telemetry by setting `geriyocoImageGallery.isTelemetryEnabled` to `false` in your VS Code settings. Visit [here](https://code.visualstudio.com/docs/getstarted/telemetry) to learn more about VS Code telemetry.
610

711
### Fixed
812
- Image sort preference was not respected when file watcher is involved, e.g. after an image is added, deleted, or modified.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-image-gallery",
33
"displayName": "Image Gallery",
44
"description": "Improve image browsing experience, especially for remote development.",
5-
"version": "1.2.0",
5+
"version": "1.2.1",
66
"publisher": "GeriYoco",
77
"repository": {
88
"type": "git",

src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import * as vscode from 'vscode';
2+
import * as utils from './utils';
23
import * as gallery from './gallery/gallery';
34
import * as viewer from './viewer/viewer';
45
import * as telemetry from './telemetry';
56

67
export function activate(context: vscode.ExtensionContext) {
8+
utils.readPackageJSON(context);
9+
710
telemetry.activate(context);
811
gallery.activate(context);
912
viewer.activate(context);

src/img_extensions.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/telemetry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from 'vscode';
22
import TelemetryReporter, {
33
TelemetryEventMeasurements, TelemetryEventProperties
44
} from '@vscode/extension-telemetry';
5+
import * as utils from './utils';
56

67
export let reporter: ExtensionReporter;
78

@@ -22,9 +23,8 @@ export class ExtensionReporter extends TelemetryReporter {
2223
public readonly enableTelemetry: boolean = getUserTelemetrySetting(),
2324
private readonly instrumentationKey = "a5e759de-afbd-4f36-a9c9-2fc95385683b",
2425
) {
25-
const packageJson = context.extension.packageJSON;
26-
const extId = packageJson.publisher + '.' + packageJson.name;
27-
const extVersion = packageJson.version;
26+
const extId = utils.packageJSON.publisher + '.' + utils.packageJSON.name;
27+
const extVersion = utils.packageJSON.version;
2828
super(extId, extVersion, instrumentationKey);
2929
}
3030

src/utils.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import * as vscode from 'vscode';
33
import { TFolder } from 'custom_typings';
44
import crypto from 'crypto';
55
import fileSystem from 'fs';
6-
import { imgExtensions } from './img_extensions';
6+
7+
export let packageJSON: any; // global variable
8+
export function readPackageJSON(context: vscode.ExtensionContext) {
9+
packageJSON = context.extension.packageJSON;
10+
}
711

812
export function getCwd() {
913
if (!vscode.workspace.workspaceFolders) {
@@ -25,8 +29,17 @@ function getNonce() {
2529
}
2630
export const nonce = getNonce();
2731

32+
function getImageExtensions() {
33+
const pattern = packageJSON.contributes.customEditors[0].selector[0].filenamePattern;
34+
const regex = /(?<=\{)(.*?)(?=\})/g;
35+
const match = pattern.match(regex)[0];
36+
const imageExtensions: string[] = match.split(',');
37+
return imageExtensions;
38+
}
39+
2840
export function getGlob() {
29-
let upperCaseImg = imgExtensions.map(ext => ext.toUpperCase());
41+
const imgExtensions = getImageExtensions();
42+
const upperCaseImg = imgExtensions.map(ext => ext.toUpperCase());
3043
const globPattern = `**/*.{${[...imgExtensions, ...upperCaseImg].join(',')}}`;
3144
return globPattern;
3245
}

0 commit comments

Comments
 (0)