From dad2a98413a6f1a47e569a8b138f57f454852bca Mon Sep 17 00:00:00 2001 From: articlecat <38485721+articlecat@users.noreply.github.com> Date: Mon, 19 Oct 2020 05:59:14 -0700 Subject: [PATCH 1/5] Add patch for custom extensions gallery Extend product.ts to accept environment variables for custom extensions gallery URLs --- patches/custom-extensions-gallery.patch | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 patches/custom-extensions-gallery.patch diff --git a/patches/custom-extensions-gallery.patch b/patches/custom-extensions-gallery.patch new file mode 100644 index 0000000..2d4f4ec --- /dev/null +++ b/patches/custom-extensions-gallery.patch @@ -0,0 +1,28 @@ +diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts +index 2bea85740c..d0e9da036c 100644 +--- a/src/vs/platform/product/common/product.ts ++++ b/src/vs/platform/product/common/product.ts +@@ -57,6 +57,23 @@ else { + }); + } + ++ // Set user-defined extension gallery ++ if ( ++ env['VSCODIUM_EXTENSIONS_GALLERY_SERVICE_URL'] ++ || env['VSCODIUM_EXTENSIONS_GALLERY_ITEM_URL'] ++ || env['VSCODIUM_EXTENSIONS_GALLERY_CONTROL_URL'] ++ || env['VSCODIUM_EXTENSIONS_GALLERY_RECOMMENDATIONS_URL'] ++ ) { ++ Object.assign(product, { ++ extensionsGallery: { ++ serviceUrl: env['VSCODIUM_EXTENSIONS_GALLERY_SERVICE_URL'], ++ itemUrl: env['VSCODIUM_EXTENSIONS_GALLERY_ITEM_URL'], ++ controlUrl: env['VSCODIUM_EXTENSIONS_GALLERY_CONTROL_URL'], ++ recommendationsUrl: env['VSCODIUM_EXTENSIONS_GALLERY_RECOMMENDATIONS_URL'] ++ } ++ }) ++ } ++ + Object.assign(product, { + version: pkg.version + }); From 23bd025392290ea100ca57da645f9a9a7b4d1bf6 Mon Sep 17 00:00:00 2001 From: articlecat <38485721+articlecat@users.noreply.github.com> Date: Mon, 19 Oct 2020 06:01:04 -0700 Subject: [PATCH 2/5] Apply custom-extensions-gallery.patch in prepare_vscode.sh --- prepare_vscode.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/prepare_vscode.sh b/prepare_vscode.sh index ae93af4..4a9a82a 100755 --- a/prepare_vscode.sh +++ b/prepare_vscode.sh @@ -13,6 +13,7 @@ cd vscode || exit ../update_settings.sh # apply patches +patch -u src/vs/platform/product/common/product.ts -i ../patches/custom-extensions-gallery.patch patch -u src/vs/platform/update/electron-main/updateService.win32.ts -i ../patches/update-cache-path.patch if [[ "$OS_NAME" == "osx" ]]; then From ccd219e96e14a2184568bf1a0881d60ec83930e7 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Fri, 19 Mar 2021 13:27:33 +0100 Subject: [PATCH 3/5] - add cacheUrl - locate & load user-customized product.json --- patches/custom-extensions-gallery.patch | 28 ---------- patches/custom-gallery.patch | 74 +++++++++++++++++++++++++ prepare_vscode.sh | 2 +- 3 files changed, 75 insertions(+), 29 deletions(-) delete mode 100644 patches/custom-extensions-gallery.patch create mode 100644 patches/custom-gallery.patch diff --git a/patches/custom-extensions-gallery.patch b/patches/custom-extensions-gallery.patch deleted file mode 100644 index 2d4f4ec..0000000 --- a/patches/custom-extensions-gallery.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts -index 2bea85740c..d0e9da036c 100644 ---- a/src/vs/platform/product/common/product.ts -+++ b/src/vs/platform/product/common/product.ts -@@ -57,6 +57,23 @@ else { - }); - } - -+ // Set user-defined extension gallery -+ if ( -+ env['VSCODIUM_EXTENSIONS_GALLERY_SERVICE_URL'] -+ || env['VSCODIUM_EXTENSIONS_GALLERY_ITEM_URL'] -+ || env['VSCODIUM_EXTENSIONS_GALLERY_CONTROL_URL'] -+ || env['VSCODIUM_EXTENSIONS_GALLERY_RECOMMENDATIONS_URL'] -+ ) { -+ Object.assign(product, { -+ extensionsGallery: { -+ serviceUrl: env['VSCODIUM_EXTENSIONS_GALLERY_SERVICE_URL'], -+ itemUrl: env['VSCODIUM_EXTENSIONS_GALLERY_ITEM_URL'], -+ controlUrl: env['VSCODIUM_EXTENSIONS_GALLERY_CONTROL_URL'], -+ recommendationsUrl: env['VSCODIUM_EXTENSIONS_GALLERY_RECOMMENDATIONS_URL'] -+ } -+ }) -+ } -+ - Object.assign(product, { - version: pkg.version - }); diff --git a/patches/custom-gallery.patch b/patches/custom-gallery.patch new file mode 100644 index 0000000..d6ca1df --- /dev/null +++ b/patches/custom-gallery.patch @@ -0,0 +1,74 @@ +diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts +index 2730ee7..4d46c23 100644 +--- a/src/vs/platform/product/common/product.ts ++++ b/src/vs/platform/product/common/product.ts +@@ -8,6 +8,7 @@ import { isWeb } from 'vs/base/common/platform'; + import { env } from 'vs/base/common/process'; + import { FileAccess } from 'vs/base/common/network'; + import { dirname, joinPath } from 'vs/base/common/resources'; ++import { getDefaultUserDataPath } from 'vs/base/node/userDataPath'; + + let product: IProductConfiguration; + +@@ -47,6 +48,29 @@ else { + product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath); + const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; }; + ++ // Merge user-customized product.json ++ try { ++ const merge = (...objects: any[]) => ++ objects.reduce((result, current) => { ++ Object.keys(current).forEach((key) => { ++ if (Array.isArray(result[key]) && Array.isArray(current[key])) { ++ result[key] = current[key]; ++ } else if (typeof result[key] === 'object' && typeof current[key] === 'object') { ++ result[key] = merge(result[key], current[key]); ++ } else { ++ result[key] = current[key]; ++ } ++ }); ++ ++ return result; ++ }, {}) as any; ++ ++ const userProduct = require.__$__nodeRequire(joinPath(FileAccess.asFileUri(getDefaultUserDataPath(), require), 'product.json').fsPath); ++ ++ product = merge(product, userProduct) ++ } catch (ex) { ++ } ++ + // Running out of sources + if (env['VSCODE_DEV']) { + Object.assign(product, { +@@ -56,6 +80,19 @@ else { + }); + } + ++ // Set user-defined extension gallery ++ const { serviceUrl, cacheUrl, itemUrl, controlUrl, recommendationsUrl } = product.extensionsGallery || {} ++ ++ Object.assign(product, { ++ extensionsGallery: { ++ serviceUrl: env['VSCODIUM_GALLERY_SERVICE_URL'] || serviceUrl, ++ cacheUrl: env['VSCODIUM_GALLERY_CACHE_URL'] || cacheUrl, ++ itemUrl: env['VSCODIUM_GALLERY_ITEM_URL'] || itemUrl, ++ controlUrl: env['VSCODIUM_GALLERY_CONTROL_URL'] || controlUrl, ++ recommendationsUrl: env['VSCODIUM_GALLERY_RECOMMENDATIONS_URL'] || recommendationsUrl ++ } ++ }) ++ + Object.assign(product, { + version: pkg.version + }); +diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts +index 07263ca..0328f58 100644 +--- a/src/vs/platform/product/common/productService.ts ++++ b/src/vs/platform/product/common/productService.ts +@@ -67,6 +67,7 @@ export interface IProductConfiguration { + + readonly extensionsGallery?: { + readonly serviceUrl: string; ++ readonly cacheUrl?: string; + readonly itemUrl: string; + readonly controlUrl: string; + readonly recommendationsUrl: string; diff --git a/prepare_vscode.sh b/prepare_vscode.sh index 7995670..c6c7d6b 100755 --- a/prepare_vscode.sh +++ b/prepare_vscode.sh @@ -8,9 +8,9 @@ cd vscode || exit ../update_settings.sh # apply patches -patch -u src/vs/platform/product/common/product.ts -i ../patches/custom-extensions-gallery.patch patch -u src/vs/platform/update/electron-main/updateService.win32.ts -i ../patches/update-cache-path.patch patch -u resources/linux/rpm/code.spec.template -i ../patches/fix-rpm-spec.patch +git apply --ignore-whitespace ../patches/custom-gallery.patch if [[ "$OS_NAME" == "osx" ]]; then CHILD_CONCURRENCY=1 yarn --frozen-lockfile --ignore-optional From 0ead786b6c1608c414a383e1850484e8f38c1872 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Fri, 19 Mar 2021 17:02:21 +0100 Subject: [PATCH 4/5] - rename env variables - update doc --- DOCS.md | 37 +++++++++++++++++++++++++++++------- patches/custom-gallery.patch | 10 +++++----- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/DOCS.md b/DOCS.md index 4986740..1a3905c 100644 --- a/DOCS.md +++ b/DOCS.md @@ -41,16 +41,39 @@ The `product.json` file is set up to use [open-vsx.org](https://open-vsx.org/) a * Ask the extension maintainers to publish to [open-vsx.org](https://open-vsx.org/) in addition to the VS Code Marketplace. The publishing process is documented in the [Open VSX Wiki](https://github.com/eclipse/openvsx/wiki/Publishing-Extensions). * Create a pull request to [this repository](https://github.com/open-vsx/publish-extensions) to have the [@open-vsx](https://github.com/open-vsx) service account publish the extensions for you. * Download and [install the vsix files](https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix). -* Modify the `extensionsGallery` section of the `product.json` file in your VSCodium installation to use the VS Code Marketplace as shown below. However, note that [it is not clear whether this is legal](https://github.com/microsoft/vscode/issues/31168). - ```json - "extensionsGallery": { - "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", - "itemUrl": "https://marketplace.visualstudio.com/items" - } - ``` See [this article](https://www.gitpod.io/blog/open-vsx/) for more information on the motivation behind Open VSX. +### How to use the VS Code Marketplace + +You can switch and use the VS Code marketplace by using the following solutions. However, note that [it is not clear whether this is legal](https://github.com/microsoft/vscode/issues/31168). + +With the following environment variables: +- `VSCODE_GALLERY_SERVICE_URL='https://marketplace.visualstudio.com/_apis/public/gallery'` +- `VSCODE_GALLERY_CACHE_URL='https://vscode.blob.core.windows.net/gallery/index'` +- `VSCODE_GALLERY_ITEM_URL='https://marketplace.visualstudio.com/items'` +- `VSCODE_GALLERY_CONTROL_URL=''` +- `VSCODE_GALLERY_RECOMMENDATIONS_URL=''` + +Or by creating a custom `product.json` at the following location: +- Windows: `%USER%\AppData\Roaming\VSCodium` +- macOS: `~/Library/Application Support/VSCodium` +- Linux: `~/.config/VSCodium` + +with the content: + +```json +{ + "extensionsGallery": { + "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", + "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index", + "itemUrl": "https://marketplace.visualstudio.com/items", + "controlUrl": "", + "recommendationsUrl": "" + } +} +``` + ### Proprietary Debugging Tools The debugger provided with Microsoft's [C# extension](https://github.com/OmniSharp/omnisharp-vscode) as well as the (Windows) debugger provided with their [C++ extension](https://github.com/Microsoft/vscode-cpptools) are very restrictively licensed to only work with the offical Visual Studio Code build. See [this comment in the C# extension repo](https://github.com/OmniSharp/omnisharp-vscode/issues/2491#issuecomment-418811364) and [this comment in the C++ extension repo](https://github.com/Microsoft/vscode-cpptools/issues/21#issuecomment-248349017). diff --git a/patches/custom-gallery.patch b/patches/custom-gallery.patch index d6ca1df..f4c1200 100644 --- a/patches/custom-gallery.patch +++ b/patches/custom-gallery.patch @@ -49,11 +49,11 @@ index 2730ee7..4d46c23 100644 + + Object.assign(product, { + extensionsGallery: { -+ serviceUrl: env['VSCODIUM_GALLERY_SERVICE_URL'] || serviceUrl, -+ cacheUrl: env['VSCODIUM_GALLERY_CACHE_URL'] || cacheUrl, -+ itemUrl: env['VSCODIUM_GALLERY_ITEM_URL'] || itemUrl, -+ controlUrl: env['VSCODIUM_GALLERY_CONTROL_URL'] || controlUrl, -+ recommendationsUrl: env['VSCODIUM_GALLERY_RECOMMENDATIONS_URL'] || recommendationsUrl ++ serviceUrl: env['VSCODE_GALLERY_SERVICE_URL'] || serviceUrl, ++ cacheUrl: env['VSCODE_GALLERY_CACHE_URL'] || cacheUrl, ++ itemUrl: env['VSCODE_GALLERY_ITEM_URL'] || itemUrl, ++ controlUrl: env['VSCODE_GALLERY_CONTROL_URL'] || controlUrl, ++ recommendationsUrl: env['VSCODE_GALLERY_RECOMMENDATIONS_URL'] || recommendationsUrl + } + }) + From 96312bd7f467f7cdb18ac3c4390cd7e6ee8536ad Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Wed, 24 Mar 2021 02:15:35 +0100 Subject: [PATCH 5/5] add subheadings to table of contents --- DOCS.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DOCS.md b/DOCS.md index 1a3905c..50c35e8 100644 --- a/DOCS.md +++ b/DOCS.md @@ -3,7 +3,11 @@ ## Table of Contents - [Getting all the Telemetry Out](#disable-telemetry) + - [Replacements to Microsoft Online Services](#replacement-online-services) - [Extensions + Marketplace](#extensions-marketplace) + - [How to use the VS Code Marketplace](#howto-vscode-marketplace) + - [Proprietary Debugging Tools](#proprietary-debugging-tools) + - [Proprietary Extensions](#proprietary-extensions) - [Migrating from Visual Studio Code to VSCodium](#migrating) - [How do I run VSCodium in portable mode?](#portable) - [How do I press and hold a key and have it repeat in VSCodium?](#press-and-hold) @@ -28,7 +32,7 @@ These can all be disabled. __Please note that some extensions send telemetry data to Microsoft as well. We have no control over this and can only recommend removing the extension.__ _(For example, the C# extension `ms-vscode.csharp` sends tracking data to Microsoft.)_ -### Replacements to Microsoft Online Services +### Replacements to Microsoft Online Services When searching the `@tag:usesOnlineServices` filter, note that while the "Update: Mode" setting description still says "The updates are fetched from a Microsoft online service", VSCodium's build script [sets the `updateUrl` field](https://github.com/VSCodium/vscodium/blob/master/prepare_vscode.sh#L36) in `product.json` to that of VSCodium's own small [update server](https://github.com/VSCodium/update-api), so enabling that setting won't actually result in any calls to Microsoft servers. @@ -44,7 +48,7 @@ The `product.json` file is set up to use [open-vsx.org](https://open-vsx.org/) a See [this article](https://www.gitpod.io/blog/open-vsx/) for more information on the motivation behind Open VSX. -### How to use the VS Code Marketplace +### How to use the VS Code Marketplace You can switch and use the VS Code marketplace by using the following solutions. However, note that [it is not clear whether this is legal](https://github.com/microsoft/vscode/issues/31168). @@ -74,13 +78,13 @@ with the content: } ``` -### Proprietary Debugging Tools +### Proprietary Debugging Tools The debugger provided with Microsoft's [C# extension](https://github.com/OmniSharp/omnisharp-vscode) as well as the (Windows) debugger provided with their [C++ extension](https://github.com/Microsoft/vscode-cpptools) are very restrictively licensed to only work with the offical Visual Studio Code build. See [this comment in the C# extension repo](https://github.com/OmniSharp/omnisharp-vscode/issues/2491#issuecomment-418811364) and [this comment in the C++ extension repo](https://github.com/Microsoft/vscode-cpptools/issues/21#issuecomment-248349017). A workaround exists to get debugging working in C# projects, by using Samsung's opensource [netcoredbg](https://github.com/Samsung/netcoredbg) package. See [this comment](https://github.com/VSCodium/vscodium/issues/82#issue-409806641) for instructions on how to set that up. -### Proprietary Extensions +### Proprietary Extensions Like the debuggers mentioned above, some extensions you may find in the marketplace (like the [Remote Development Extensions](https://code.visualstudio.com/docs/remote/remote-overview)) only function with the offical Visual Studio Code build. You can work around this by adding the extension's internal ID (found on the extension's page) to the `extensionAllowedProposedApi` property of the product.json in your VSCodium installation. For example: