Skip to content

Commit ddfcafd

Browse files
committed
refactor: Rename configuration options
BREAKING CHANGE: memo.imagePreviewMaxHeight -> memo.imagePreviewMaxHeight memo.collapseBacklinksPanelItems -> memo.backlinksPanel.collapseParentItems
1 parent ed21834 commit ddfcafd

5 files changed

+13
-10
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@
6565
"type": "object",
6666
"title": "Memo",
6767
"properties": {
68-
"memo.imagePreviewMaxHeight": {
68+
"memo.linksOnHoverPreview.imageMaxHeight": {
6969
"default": "200",
7070
"scope": "resource",
71-
"description": "The maximum height of the image preview",
71+
"description": "The maximum height of the image.",
7272
"type": "number"
7373
},
74-
"memo.collapseBacklinksPanelItems": {
74+
"memo.backlinksPanel.collapseParentItems": {
7575
"default": false,
7676
"scope": "resource",
77-
"description": "Collapse backlinks panel items by default.",
77+
"description": "Collapse parent items by default.",
7878
"type": "boolean"
7979
}
8080
}

src/features/BacklinksTreeDataProvider.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ describe('BacklinksTreeDataProvider', () => {
369369

370370
await window.showTextDocument(doc);
371371

372-
await updateMemoConfigProperty('collapseBacklinksPanelItems', true);
372+
await updateMemoConfigProperty('backlinksPanel.collapseParentItems', true);
373373

374374
expect((await getChildren()).every((child) => child.collapsibleState === 1)).toBe(true);
375375
});
@@ -387,7 +387,7 @@ describe('BacklinksTreeDataProvider', () => {
387387

388388
await window.showTextDocument(doc);
389389

390-
expect(getConfigProperty('collapseBacklinksPanelItems', null)).toBe(false);
390+
expect(getConfigProperty('backlinksPanel.collapseParentItems', null)).toBe(false);
391391

392392
expect((await getChildren()).every((child) => child.collapsibleState === 2)).toBe(true);
393393
});

src/features/BacklinksTreeDataProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default class BacklinksTreeDataProvider implements vscode.TreeDataProvide
5858
return [];
5959
}
6060

61-
const collapsibleState = getConfigProperty('collapseBacklinksPanelItems', false)
61+
const collapsibleState = getConfigProperty('backlinksPanel.collapseParentItems', false)
6262
? vscode.TreeItemCollapsibleState.Collapsed
6363
: vscode.TreeItemCollapsibleState.Expanded;
6464

src/features/ReferenceHoverProvider.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@ export default class ReferenceHoverProvider implements vscode.HoverProvider {
3838
}
3939

4040
if (foundUri && fs.existsSync(foundUri.fsPath)) {
41-
const imagePreviewMaxHeight = Math.max(getConfigProperty('imagePreviewMaxHeight', 200), 10);
41+
const imageMaxHeight = Math.max(
42+
getConfigProperty('linksOnHoverPreview.imageMaxHeight', 200),
43+
10,
44+
);
4245
const getContent = () => {
4346
if (containsImageExt(foundUri.fsPath)) {
4447
return `![${
4548
isUncPath(foundUri.fsPath)
4649
? 'UNC paths are not supported for images preview due to VSCode Content Security Policy. Use markdown preview or open image via cmd (ctrl) + click instead.'
4750
: ''
48-
}](${vscode.Uri.file(foundUri.fsPath).toString()}|height=${imagePreviewMaxHeight})`;
51+
}](${vscode.Uri.file(foundUri.fsPath).toString()}|height=${imageMaxHeight})`;
4952
} else if (containsOtherKnownExts(foundUri.fsPath)) {
5053
const ext = path.parse(foundUri.fsPath).ext;
5154
return `Preview is not supported for "${ext}" file type. Click to open in the default app.`;

src/utils/utils.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ describe('getWorkspaceFolder()', () => {
821821

822822
describe('getConfigProperty()', () => {
823823
it('should return config property', () => {
824-
expect(getConfigProperty('imagePreviewMaxHeight', null)).toBe('200');
824+
expect(getConfigProperty('linksOnHoverPreview.imageMaxHeight', null)).toBe('200');
825825
});
826826

827827
it('should return default property on getting unknown config property', () => {

0 commit comments

Comments
 (0)