Skip to content

Commit

Permalink
fix: issue with invisible quickPick icon
Browse files Browse the repository at this point in the history
  • Loading branch information
kbysiec committed Sep 7, 2022
1 parent b0405bf commit 35c8fee
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 64 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to the "vscode-search-everywhere" extension will be documented in this file.

## [2.0.2] - 2022-09-07
- Fix issue with invisible quick pick icons

## [2.0.0] - 2022-09-07
- Fully rewritten from class based to function based approach
- Test improvements
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-search-everywhere",
"displayName": "Search everywhere",
"description": "Fast and customizable files, symbols search engine. An alternative for 'Go to symbol in workspace' built-in feature.",
"version": "2.0.1",
"version": "2.0.2",
"preview": false,
"publisher": "kbysiec",
"author": {
Expand Down
12 changes: 6 additions & 6 deletions src/dataConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ function createQuickPickItem(
label,
detail: utils.normalizeUriPath(uri.path),
description,
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
} as QuickPickItem;
}

Expand Down
13 changes: 13 additions & 0 deletions src/quickPick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,22 @@ function getItems() {
}

function setItems(newItems: QuickPickItem[]): void {
reinitQpItemsButton(newItems);
items = newItems;
}

function reinitQpItemsButton(data: QuickPickItem[]) {
data.forEach(
(item) =>
(item.buttons = [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
])
);
}

function getShouldUseItemsFilterPhrases() {
return shouldUseItemsFilterPhrases;
}
Expand Down
84 changes: 42 additions & 42 deletions src/test/mock/dataConverter.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ export const mocks = {
start: new vscode.Position(0, 0),
end: new vscode.Position(0, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
{
label: "test name",
Expand All @@ -107,12 +107,12 @@ export const mocks = {
start: new vscode.Position(0, 0),
end: new vscode.Position(3, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
{
label: "test name 2",
Expand All @@ -124,12 +124,12 @@ export const mocks = {
start: new vscode.Position(4, 0),
end: new vscode.Position(5, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
{
label: "test name 3",
Expand All @@ -141,12 +141,12 @@ export const mocks = {
start: new vscode.Position(9, 0),
end: new vscode.Position(9, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
];

Expand Down Expand Up @@ -207,12 +207,12 @@ export const mocks = {
start: new vscode.Position(0, 0),
end: new vscode.Position(0, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
{
label: "$(another-fake-icon) test name",
Expand All @@ -224,12 +224,12 @@ export const mocks = {
start: new vscode.Position(0, 0),
end: new vscode.Position(3, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
{
label: "$(another-fake-icon) test name 2",
Expand All @@ -241,12 +241,12 @@ export const mocks = {
start: new vscode.Position(4, 0),
end: new vscode.Position(5, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
// buttons: [
// {
// iconPath: new vscode.ThemeIcon("open-preview"),
// tooltip: "Open to the side",
// },
// ],
},
];

Expand Down
12 changes: 12 additions & 0 deletions src/test/test/quickPick.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert } from "chai";
import * as vscode from "vscode";
import { quickPick } from "../../quickPick";
import { getTestSetups } from "../testSetup/quickPick.testSetup";
import {
Expand Down Expand Up @@ -135,6 +136,17 @@ describe("QuickPick", () => {

assert.equal(quickPick.getItems().length, 2);
});

it("2: should items have assigned buttons property", () => {
quickPick.setItems(getQpItems());

assert.deepEqual(quickPick.getItems()[0].buttons, [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
]);
});
});

describe("showLoading", () => {
Expand Down
6 changes: 6 additions & 0 deletions src/test/util/qpItemMockFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export const getQpItem = (
? new vscode.Position(0, 5)
: new vscode.Position(0, 0),
},
buttons: [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
],
};
const qpItemAny = qpItem as any;
qpItemAny.uri._fsPath = qpItemAny.uri.path;
Expand Down
16 changes: 1 addition & 15 deletions src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,7 @@ function registerEventListeners(): void {
}

function getData(): QuickPickItem[] {
const data = common.getData();
reinitQpItemsButton(data);
return data;
}

function reinitQpItemsButton(data: QuickPickItem[]) {
data.forEach(
(item) =>
(item.buttons = [
{
iconPath: new vscode.ThemeIcon("open-preview"),
tooltip: "Open to the side",
},
])
);
return common.getData();
}

function addNotSavedUri(uri: vscode.Uri) {
Expand Down

0 comments on commit 35c8fee

Please sign in to comment.