From afbc1b40bfa6b3e378e9bc788ba4ed15bf471785 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Mon, 12 May 2025 10:42:40 -0700 Subject: [PATCH 1/2] extensions warning fix by deleting some extensions once --- .../void/browser/extensionTransferService.ts | 51 +++++++++++++++++-- .../void/browser/miscWokrbenchContrib.ts | 24 ++++----- 2 files changed, 58 insertions(+), 17 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/extensionTransferService.ts b/src/vs/workbench/contrib/void/browser/extensionTransferService.ts index 05b7b47a..04ec0ccf 100644 --- a/src/vs/workbench/contrib/void/browser/extensionTransferService.ts +++ b/src/vs/workbench/contrib/void/browser/extensionTransferService.ts @@ -3,6 +3,7 @@ * Licensed under the Apache License, Version 2.0. See LICENSE.txt for more information. *--------------------------------------------------------------------------------------*/ +import { VSBuffer } from '../../../../base/common/buffer.js'; import { Disposable } from '../../../../base/common/lifecycle.js'; import { env } from '../../../../base/common/process.js'; import { URI } from '../../../../base/common/uri.js'; @@ -29,6 +30,7 @@ export const IExtensionTransferService = createDecorator + !extensionBlacklist.find(bItem => entry?.identifier?.id?.includes(bItem)) + ) + const jsonStr = JSON.stringify(j2) + await fileService.writeFile(to, VSBuffer.fromString(jsonStr)) + } + catch { + console.log('Error copying extensions.json, skipping') + } + } + } } - // Ensure the destination directory exists + } else { console.log(`Skipping file that doesn't exist: ${from.toString()}`) } @@ -113,9 +135,10 @@ class ExtensionTransferService extends Disposable implements IExtensionTransferS } async deleteBlacklistExtensions(os: 'mac' | 'windows' | 'linux' | null) { + const fileService = this._fileService const extensionsURI = getExtensionsFolder(os) if (!extensionsURI) return - const eURI = await this._fileService.resolve(extensionsURI) + const eURI = await fileService.resolve(extensionsURI) for (const child of eURI.children ?? []) { // if is not blacklisted, continue @@ -124,8 +147,26 @@ class ExtensionTransferService extends Disposable implements IExtensionTransferS } try { - console.log('Deleting extension', child.resource.fsPath) - await this._fileService.del(child.resource, { recursive: true, useTrash: true }) + if (child.isDirectory) { + console.log('Deleting extension', child.resource.fsPath) + await fileService.del(child.resource, { recursive: true, useTrash: true }) + } + else if (child.isFile) { + if (child.name === 'extensions.json') { + try { + const contentsStr = await fileService.readFile(child.resource) + const json: any = JSON.parse(contentsStr.value.toString()) + const j2 = json.filter((entry: { identifier?: { id?: string } }) => + !extensionBlacklist.find(bItem => entry?.identifier?.id?.includes(bItem)) + ) + const jsonStr = JSON.stringify(j2) + await fileService.writeFile(child.resource, VSBuffer.fromString(jsonStr)) + } + catch { + console.log('Error copying extensions.json, skipping') + } + } + } } catch (e) { console.error('Could not delete extension', child.resource.fsPath, e) diff --git a/src/vs/workbench/contrib/void/browser/miscWokrbenchContrib.ts b/src/vs/workbench/contrib/void/browser/miscWokrbenchContrib.ts index 6852c799..49a0d524 100644 --- a/src/vs/workbench/contrib/void/browser/miscWokrbenchContrib.ts +++ b/src/vs/workbench/contrib/void/browser/miscWokrbenchContrib.ts @@ -5,17 +5,17 @@ import { Disposable } from '../../../../base/common/lifecycle.js'; import { IWorkbenchContribution, registerWorkbenchContribution2, WorkbenchPhase } from '../../../common/contributions.js'; -// import { IExtensionTransferService } from './extensionTransferService.js'; -// import { os } from '../common/helpers/systemInfo.js'; -// import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; +import { IExtensionTransferService } from './extensionTransferService.js'; +import { os } from '../common/helpers/systemInfo.js'; +import { IStorageService, StorageScope, StorageTarget } from '../../../../platform/storage/common/storage.js'; // Onboarding contribution that mounts the component at startup export class MiscWorkbenchContribs extends Disposable implements IWorkbenchContribution { static readonly ID = 'workbench.contrib.voidMiscWorkbenchContribs'; constructor( - // @IExtensionTransferService private readonly extensionTransferService: IExtensionTransferService, - // @IStorageService private readonly storageService: IStorageService, + @IExtensionTransferService private readonly extensionTransferService: IExtensionTransferService, + @IStorageService private readonly storageService: IStorageService, ) { super(); this.initialize(); @@ -23,13 +23,13 @@ export class MiscWorkbenchContribs extends Disposable implements IWorkbenchContr private initialize(): void { - // // delete blacklisted extensions once (this is for people who already installed them) - // const deleteExtensionsStorageId = 'void-deleted-blacklist' - // const alreadyDeleted = this.storageService.get(deleteExtensionsStorageId, StorageScope.APPLICATION) - // if (!alreadyDeleted) { - // this.storageService.store(deleteExtensionsStorageId, 'true', StorageScope.APPLICATION, StorageTarget.MACHINE) - // this.extensionTransferService.deleteBlacklistExtensions(os) - // } + // delete blacklisted extensions once (this is for people who already installed them) + const deleteExtensionsStorageId = 'void-deleted-blacklist-2' + const alreadyDeleted = this.storageService.get(deleteExtensionsStorageId, StorageScope.APPLICATION) + if (!alreadyDeleted) { + this.storageService.store(deleteExtensionsStorageId, 'true', StorageScope.APPLICATION, StorageTarget.MACHINE) + this.extensionTransferService.deleteBlacklistExtensions(os) + } } } From 53c68b1267878e53bd7b178a7310ecfede0074f5 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Mon, 12 May 2025 10:44:43 -0700 Subject: [PATCH 2/2] bump --- product.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product.json b/product.json index 7d89c3de..d4d8b671 100644 --- a/product.json +++ b/product.json @@ -1,8 +1,8 @@ { "nameShort": "Void", "nameLong": "Void", - "voidVersion": "1.3.5", - "voidRelease": "0029", + "voidVersion": "1.3.6", + "voidRelease": "0030", "applicationName": "void", "dataFolderName": ".void-editor", "win32MutexName": "voideditor",