Skip to content

Commit e7fe0ed

Browse files
committed
Remove any unexpected properties when persisting pinned item
1 parent 4617bc7 commit e7fe0ed

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/vs/platform/quickinput/browser/quickPickPin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,19 @@ function updatePinnedItems(storageKey: string, changedItem: IQuickPickItem, stor
107107
} else {
108108
items.push(changedItem);
109109
}
110-
storageService.store(storageKey, JSON.stringify(items), StorageScope.WORKSPACE, StorageTarget.MACHINE);
110+
storageService.store(storageKey, JSON.stringify(items.map(formatPinnedItemForStorage)), StorageScope.WORKSPACE, StorageTarget.MACHINE);
111111
return items;
112112
}
113113

114114
function getPinnedItems(storageKey: string, storageService: IStorageService): IQuickPickItem[] {
115115
const items = storageService.get(storageKey, StorageScope.WORKSPACE);
116116
return items ? JSON.parse(items) : [];
117117
}
118+
119+
function formatPinnedItemForStorage(item: IQuickPickItem): IQuickPickItem {
120+
return {
121+
label: item.label,
122+
description: item.description,
123+
detail: item.detail,
124+
};
125+
}

0 commit comments

Comments
 (0)