partial update for vscodium-1.103.25610: only for linux;
authorwenzelm
Sat, 30 Aug 2025 13:45:06 +0200
changeset 83082 3b89614a6189
parent 83081 eb0ea0ba8894
child 83083 5e8fd30caf43
partial update for vscodium-1.103.25610: only for linux;
src/Tools/VSCode/etc/settings
src/Tools/VSCode/extension/package.json
src/Tools/VSCode/patches/cli.patch
src/Tools/VSCode/patches/isabelle_encoding.patch
src/Tools/VSCode/patches/no_ocaml_icons.patch
src/Tools/VSCode/patches/vscodium.patch
src/Tools/VSCode/src/component_vscodium.scala
--- a/src/Tools/VSCode/etc/settings	Sat Aug 30 13:10:55 2025 +0200
+++ b/src/Tools/VSCode/etc/settings	Sat Aug 30 13:45:06 2025 +0200
@@ -1,5 +1,4 @@
 # -*- shell-script -*- :mode=shellscript:
 
-ISABELLE_VSCODE_VERSION="1.70.1"
 ISABELLE_VSCODE_HOME="$ISABELLE_HOME/src/Tools/VSCode"
 ISABELLE_VSCODE_SETTINGS="$ISABELLE_HOME_USER/vscode"
--- a/src/Tools/VSCode/extension/package.json	Sat Aug 30 13:10:55 2025 +0200
+++ b/src/Tools/VSCode/extension/package.json	Sat Aug 30 13:45:06 2025 +0200
@@ -17,7 +17,7 @@
         "url": "https://isabelle-dev.sketis.net"
     },
     "engines": {
-        "vscode": "1.70.1"
+        "vscode": "^1.103.0"
     },
     "categories": [
         "Programming Languages"
@@ -314,7 +314,7 @@
     "devDependencies": {
         "@types/mocha": "^9.1.0",
         "@types/node": "^17.0.19",
-        "@types/vscode": "^1.65.0",
+        "@types/vscode": "^1.103.0",
         "mocha": "^9.2.1",
         "typescript": "^4.5.5"
     },
--- a/src/Tools/VSCode/patches/cli.patch	Sat Aug 30 13:10:55 2025 +0200
+++ b/src/Tools/VSCode/patches/cli.patch	Sat Aug 30 13:45:06 2025 +0200
@@ -1,20 +1,25 @@
 diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
+index b31099e..fe27645 100644
 --- a/src/vs/code/node/cli.ts
 +++ b/src/vs/code/node/cli.ts
-@@ -363,9 +363,11 @@ export async function main(argv: string[]): Promise<any> {
+@@ -482,13 +482,15 @@ export async function main(argv: string[]): Promise<any> {
  		}
  
  		let child: ChildProcess;
 +		const app_arg = '--app=' + process.env['ISABELLE_VSCODIUM_APP'];
 +		const electron_args = [app_arg].concat(argv.slice(2));
  		if (!isMacOSBigSurOrNewer) {
+ 			if (!args.verbose && args.status) {
+ 				options['stdio'] = ['ignore', 'pipe', 'ignore']; // restore ability to see output when --status is used
+ 			}
+ 
  			// We spawn process.execPath directly
 -			child = spawn(process.execPath, argv.slice(2), options);
 +			child = spawn(process.execPath, electron_args, options);
  		} else {
  			// On Big Sur, we spawn using the open command to obtain behavior
  			// similar to if the app was launched from the dock
-@@ -425,7 +427,7 @@ export async function main(argv: string[]): Promise<any> {
+@@ -548,7 +550,7 @@ export async function main(argv: string[]): Promise<any> {
  				}
  			}
  
--- a/src/Tools/VSCode/patches/isabelle_encoding.patch	Sat Aug 30 13:10:55 2025 +0200
+++ b/src/Tools/VSCode/patches/isabelle_encoding.patch	Sat Aug 30 13:45:06 2025 +0200
@@ -1,15 +1,16 @@
 diff --git a/src/vs/workbench/services/textfile/common/encoding.ts b/src/vs/workbench/services/textfile/common/encoding.ts
+index 4fee9c5..97cbff7 100644
 --- a/src/vs/workbench/services/textfile/common/encoding.ts
 +++ b/src/vs/workbench/services/textfile/common/encoding.ts
-@@ -6,6 +6,7 @@
- import { Readable, ReadableStream, newWriteableStream, listenStream } from 'vs/base/common/stream';
- import { VSBuffer, VSBufferReadable, VSBufferReadableStream } from 'vs/base/common/buffer';
- import { IDisposable } from 'vs/base/common/lifecycle';
-+import * as isabelle_encoding from './isabelle_encoding';
+@@ -8,6 +8,7 @@ import { VSBuffer, VSBufferReadable, VSBufferReadableStream } from '../../../../
+ import { importAMDNodeModule } from '../../../../amdX.js';
+ import { CancellationTokenSource } from '../../../../base/common/cancellation.js';
+ import { coalesce } from '../../../../base/common/arrays.js';
++import * as isabelle_encoding from './isabelle_encoding.js';
  
  export const UTF8 = 'utf8';
  export const UTF8_with_bom = 'utf8bom';
-@@ -78,7 +79,9 @@ class DecoderStream implements IDecoderStream {
+@@ -81,7 +82,9 @@ class DecoderStream implements IDecoderStream {
  	 */
  	static async create(encoding: string): Promise<DecoderStream> {
  		let decoder: IDecoderStream | undefined = undefined;
@@ -17,13 +18,13 @@
 +		if (encoding === isabelle_encoding.ENCODING) {
 +			decoder = isabelle_encoding.getDecoder();
 +		} else if (encoding !== UTF8) {
- 			const iconv = await import('@vscode/iconv-lite-umd');
+ 			const iconv = await importAMDNodeModule<typeof import('@vscode/iconv-lite-umd')>('@vscode/iconv-lite-umd', 'lib/iconv-lite-umd.js');
  			decoder = iconv.getDecoder(toNodeEncoding(encoding));
  		} else {
-@@ -212,7 +215,9 @@ export function toDecodeStream(source: VSBufferReadableStream, options: IDecodeS
+@@ -216,7 +219,9 @@ export function toDecodeStream(source: VSBufferReadableStream, options: IDecodeS
  
  export async function toEncodeReadable(readable: Readable<string>, encoding: string, options?: { addBOM?: boolean }): Promise<VSBufferReadable> {
- 	const iconv = await import('@vscode/iconv-lite-umd');
+ 	const iconv = await importAMDNodeModule<typeof import('@vscode/iconv-lite-umd')>('@vscode/iconv-lite-umd', 'lib/iconv-lite-umd.js');
 -	const encoder = iconv.getEncoder(toNodeEncoding(encoding), options);
 +	const encoder =
 +		encoding === isabelle_encoding.ENCODING ?
@@ -31,19 +32,19 @@
  
  	let bytesWritten = false;
  	let done = false;
-@@ -262,7 +267,7 @@ export async function toEncodeReadable(readable: Readable<string>, encoding: str
+@@ -266,7 +271,7 @@ export async function toEncodeReadable(readable: Readable<string>, encoding: str
  export async function encodingExists(encoding: string): Promise<boolean> {
- 	const iconv = await import('@vscode/iconv-lite-umd');
+ 	const iconv = await importAMDNodeModule<typeof import('@vscode/iconv-lite-umd')>('@vscode/iconv-lite-umd', 'lib/iconv-lite-umd.js');
  
 -	return iconv.encodingExists(toNodeEncoding(encoding));
 +	return encoding === isabelle_encoding.ENCODING || iconv.encodingExists(toNodeEncoding(encoding));
  }
  
  export function toNodeEncoding(enc: string | null): string {
-@@ -479,6 +484,11 @@ export function detectEncodingFromBuffer({ buffer, bytesRead }: IReadResult, aut
- }
+@@ -510,6 +515,11 @@ export function detectEncodingFromBuffer({ buffer, bytesRead }: IReadResult, aut
+ type EncodingsMap = { [encoding: string]: { labelLong: string; labelShort: string; order: number; encodeOnly?: boolean; alias?: string; guessableName?: string } };
  
- export const SUPPORTED_ENCODINGS: { [encoding: string]: { labelLong: string; labelShort: string; order: number; encodeOnly?: boolean; alias?: string } } = {
+ export const SUPPORTED_ENCODINGS: EncodingsMap = {
 +	utf8isabelle: {
 +		labelLong: isabelle_encoding.LABEL,
 +		labelShort: isabelle_encoding.LABEL,
--- a/src/Tools/VSCode/patches/no_ocaml_icons.patch	Sat Aug 30 13:10:55 2025 +0200
+++ b/src/Tools/VSCode/patches/no_ocaml_icons.patch	Sat Aug 30 13:45:06 2025 +0200
@@ -1,4 +1,5 @@
 diff --git a/extensions/theme-seti/build/update-icon-theme.js b/extensions/theme-seti/build/update-icon-theme.js
+index 366e7f3..0305e0f 100644
 --- a/extensions/theme-seti/build/update-icon-theme.js
 +++ b/extensions/theme-seti/build/update-icon-theme.js
 @@ -29,7 +29,6 @@ const nonBuiltInLanguages = { // { fileNames, extensions  }
@@ -9,60 +10,3 @@
  	"puppet": { extensions: ['puppet'] },
  	"r": { extensions: ['r', 'rhistory', 'rprofile', 'rt'] },
  	"rescript": { extensions: ['res', 'resi'] },
-diff --git a/extensions/theme-seti/icons/vs-seti-icon-theme.json b/extensions/theme-seti/icons/vs-seti-icon-theme.json
-index 72f3c989c2a..0f6a7dbf879 100644
---- a/extensions/theme-seti/icons/vs-seti-icon-theme.json
-+++ b/extensions/theme-seti/icons/vs-seti-icon-theme.json
-@@ -1006,14 +1006,6 @@
- 			"fontCharacter": "\\E069",
- 			"fontColor": "#8dc149"
- 		},
--		"_ocaml_light": {
--			"fontCharacter": "\\E06A",
--			"fontColor": "#cc6d2e"
--		},
--		"_ocaml": {
--			"fontCharacter": "\\E06A",
--			"fontColor": "#e37933"
--		},
- 		"_odata_light": {
- 			"fontCharacter": "\\E06B",
- 			"fontColor": "#cc6d2e"
-@@ -1645,10 +1637,6 @@
- 		"npm-debug.log": "_npm",
- 		"npmignore": "_npm_1",
- 		"npmrc": "_npm_1",
--		"ml": "_ocaml",
--		"mli": "_ocaml",
--		"cmx": "_ocaml",
--		"cmxa": "_ocaml",
- 		"odata": "_odata",
- 		"php.inc": "_php",
- 		"pipeline": "_pipeline",
-@@ -1908,7 +1896,6 @@
- 		"kotlin": "_kotlin",
- 		"mustache": "_mustache",
- 		"nunjucks": "_nunjucks",
--		"ocaml": "_ocaml",
- 		"rescript": "_rescript",
- 		"sass": "_sass",
- 		"stylus": "_stylus",
-@@ -2027,10 +2014,6 @@
- 			"npm-debug.log": "_npm_light",
- 			"npmignore": "_npm_1_light",
- 			"npmrc": "_npm_1_light",
--			"ml": "_ocaml_light",
--			"mli": "_ocaml_light",
--			"cmx": "_ocaml_light",
--			"cmxa": "_ocaml_light",
- 			"odata": "_odata_light",
- 			"php.inc": "_php_light",
- 			"pipeline": "_pipeline_light",
-@@ -2224,7 +2207,6 @@
- 			"kotlin": "_kotlin_light",
- 			"mustache": "_mustache_light",
- 			"nunjucks": "_nunjucks_light",
--			"ocaml": "_ocaml_light",
- 			"rescript": "_rescript_light",
- 			"sass": "_sass_light",
- 			"stylus": "_stylus_light",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/VSCode/patches/vscodium.patch	Sat Aug 30 13:45:06 2025 +0200
@@ -0,0 +1,21 @@
+diff --git a/prepare_vscode.sh b/prepare_vscode.sh
+index 1182d2e..da44137 100755
+--- a/prepare_vscode.sh
++++ b/prepare_vscode.sh
+@@ -57,7 +57,6 @@ done
+ 
+ set -x
+ 
+-export ELECTRON_SKIP_BINARY_DOWNLOAD=1
+ export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
+ 
+ if [[ "${OS_NAME}" == "linux" ]]; then
+@@ -206,7 +205,7 @@ cat product.json
+ # package.json
+ cp package.json{,.bak}
+ 
+-setpath "package" "version" "${RELEASE_VERSION%-insider}"
++setpath "package" "version" "$MS_TAG"
+ 
+ replace 's|Microsoft Corporation|VSCodium|' package.json
+ 
--- a/src/Tools/VSCode/src/component_vscodium.scala	Sat Aug 30 13:10:55 2025 +0200
+++ b/src/Tools/VSCode/src/component_vscodium.scala	Sat Aug 30 13:45:06 2025 +0200
@@ -17,12 +17,38 @@
 object Component_VSCodium {
   /* global parameters */
 
-  lazy val version: String = Isabelle_System.getenv_strict("ISABELLE_VSCODE_VERSION")
+  val vscodium_version: String = "1.103.25610"
   val vscodium_repository = "https://github.com/VSCodium/vscodium.git"
   val vscodium_download = "https://github.com/VSCodium/vscodium/releases/download"
 
   private val resources = Path.explode("resources")
 
+  private def read_patch(name: String): String =
+    File.read(Path.explode("$ISABELLE_VSCODE_HOME/patches") + Path.basic(name).patch)
+
+
+  /* build environment */
+
+  val build_env: List[String] =
+    List(
+      "VSCODE_QUALITY=stable",
+      "VSCODE_LATEST=no",
+      "CI_BUILD=no",
+      "SKIP_ASSETS=yes",
+      "SHOULD_BUILD=yes",
+      "SHOULD_BUILD_REH=no",
+      "SHOULD_BUILD_REH_WEB=no")
+
+  def build_upstream_env(dir: Path): List[String] = {
+    val str = File.read(dir + Path.explode("upstream/stable.json"))
+    val json = JSON.parse(str)
+    (for {
+      tag <- JSON.string(json, "tag")
+      commit <- JSON.string(json, "commit")
+    } yield List("MS_TAG=" + tag, "MS_COMMIT=" + commit))
+      .getOrElse(error("Malformed upstream information:\n" + str))
+  }
+
 
   /* Isabelle symbols (static subset only) */
 
@@ -66,12 +92,12 @@
   ) {
     def primary: Boolean = platform == Platform.Family.linux
 
-    def download_name: String = "VSCodium-" + download_template.replace("{VERSION}", version)
+    def download_name: String = "VSCodium-" + download_template.replace("{VERSION}", vscodium_version)
     def download_ext: String = if (download_template.endsWith(".zip")) "zip" else "tar.gz"
 
     def download(dir: Path, progress: Progress = new Progress): Unit = {
       Isabelle_System.with_tmp_file("download", ext = download_ext) { download_file =>
-        Isabelle_System.download_file(vscodium_download + "/" + version + "/" + download_name,
+        Isabelle_System.download_file(vscodium_download + "/" + vscodium_version + "/" + download_name,
           download_file, progress = progress)
 
         progress.echo("Extract ...")
@@ -81,10 +107,10 @@
 
     def get_vscodium_repository(build_dir: Path, progress: Progress = new Progress): Unit = {
       progress.echo("Getting VSCodium repository ...")
-      Isabelle_System.git_clone(vscodium_repository, build_dir, checkout = version)
+      Isabelle_System.git_clone(vscodium_repository, build_dir, checkout = vscodium_version)
 
       progress.echo("Getting VSCode repository ...")
-      Isabelle_System.bash(environment + "\n" + "./get_repo.sh", cwd = build_dir).check
+      Isabelle_System.bash(environment(build_dir) + "\n" + "./get_repo.sh", cwd = build_dir).check
     }
 
     def platform_dir(dir: Path): Path = {
@@ -96,8 +122,8 @@
 
     def build_dir(dir: Path): Path = dir + Path.explode(build_name)
 
-    def environment: String =
-      (("MS_TAG=" + Bash.string(version)) :: "SHOULD_BUILD=yes" :: "VSCODE_ARCH=x64" :: env)
+    def environment(dir: Path): String =
+      (build_env ::: build_upstream_env(dir) ::: env)
         .map(s => "export " + s + "\n").mkString
 
     def patch_sources(base_dir: Path, progress: Progress = new Progress): String = {
@@ -121,12 +147,8 @@
         }
 
         // explicit patches
-        {
-          val patches_dir = Path.explode("$ISABELLE_VSCODE_HOME/patches")
-          for (name <- Seq("cli", "isabelle_encoding", "no_ocaml_icons")) {
-            val patch = File.read(patches_dir + Path.explode(name).patch)
-            Isabelle_System.apply_patch(dir, patch, progress = progress)
-          }
+        for (name <- Seq("cli", "isabelle_encoding", "no_ocaml_icons")) {
+          Isabelle_System.apply_patch(dir, read_patch(name), progress = progress)
         }
 
         Isabelle_System.make_patch(base_dir, dir.base.orig, dir.base)
@@ -182,7 +204,7 @@
         download(download_dir, progress = progress)
         val dir1 = init_resources(download_dir)
         val dir2 = init_resources(target_dir)
-        for (name <- Seq("app/node_modules.asar", "app/node_modules.asar.unpacked")) {
+        for (name <- Seq("app/node_modules", "app/node_modules.asar")) {
           val path = Path.explode(name)
           Isabelle_System.rm_tree(dir2 + path)
           Isabelle_System.copy_dir(dir1 + path, dir2 + path)
@@ -223,7 +245,7 @@
   // see https://github.com/microsoft/vscode/blob/main/build/gulpfile.vscode.js
   // function computeChecksum(filename)
   private def file_checksum(path: Path): String = {
-    val digest = MessageDigest.getInstance("MD5")
+    val digest = MessageDigest.getInstance("SHA-256")
     digest.update(Bytes.read(path).make_array)
     Bytes(Base64.getEncoder.encode(digest.digest()))
       .text.replaceAll("=", "")
@@ -232,18 +254,19 @@
   private val platform_infos: Map[Platform.Family, Platform_Info] =
     Iterator(
       Platform_Info(Platform.Family.linux, "linux-x64-{VERSION}.tar.gz", "VSCode-linux-x64",
-        List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True")),
+        List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True", "VSCODE_ARCH=x64")),
       Platform_Info(Platform.Family.linux_arm, "linux-arm64-{VERSION}.tar.gz", "VSCode-linux-arm64",
         List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True", "VSCODE_ARCH=arm64")),
       Platform_Info(Platform.Family.macos, "darwin-x64-{VERSION}.zip", "VSCode-darwin-x64",
-        List("OS_NAME=osx")),
+        List("OS_NAME=osx", "VSCODE_ARCH=x64")),
       Platform_Info(Platform.Family.windows, "win32-x64-{VERSION}.zip", "VSCode-win32-x64",
         List("OS_NAME=windows",
           "SHOULD_BUILD_ZIP=no",
           "SHOULD_BUILD_EXE_SYS=no",
           "SHOULD_BUILD_EXE_USR=no",
           "SHOULD_BUILD_MSI=no",
-          "SHOULD_BUILD_MSI_NOUP=no")))
+          "SHOULD_BUILD_MSI_NOUP=no",
+          "VSCODE_ARCH=x64")))
       .map(info => info.platform -> info).toMap
 
   def the_platform_info(platform: Platform.Family): Platform_Info =
@@ -262,6 +285,7 @@
     Isabelle_System.require_command("node")
     Isabelle_System.require_command("yarn")
     Isabelle_System.require_command("jq")
+    Isabelle_System.require_command("rustup")
 
     if (platforms.contains(Platform.Family.windows)) {
       Isabelle_System.require_command("wine")
@@ -283,7 +307,7 @@
         progress.bash(
           Library.make_lines(
             "set -e",
-            platform_info.environment,
+            platform_info.environment(build_dir),
             "./prepare_vscode.sh",
             // enforce binary diff of code.xpm
             "cp vscode/resources/linux/code.png vscode/resources/linux/rpm/code.xpm"
@@ -309,7 +333,7 @@
 
     /* component */
 
-    val component_name = "vscodium-" + version
+    val component_name = "vscodium-" + vscodium_version
     val component_dir =
       Components.Directory(target_dir + Path.explode(component_name)).create(progress = progress)
 
@@ -335,12 +359,15 @@
         progress.echo("\n* Building " + platform + ":")
 
         platform_info.get_vscodium_repository(build_dir, progress = progress)
+        Isabelle_System.apply_patch(build_dir, read_patch("vscodium"), progress = progress)
 
         val sources_patch = platform_info.patch_sources(build_dir, progress = progress)
         if (platform_info.primary) write_patch("02-isabelle_sources", sources_patch)
 
         progress.echo("Build ...")
-        progress.bash(platform_info.environment + "\n" + "./build.sh",
+        val environment = platform_info.environment(build_dir)
+        progress.echo(environment, verbose = true)
+        progress.bash(environment + "\n" + "./build.sh",
           cwd = build_dir, echo = progress.verbose).check
 
         if (platform_info.primary) {
@@ -387,7 +414,7 @@
     /* README */
 
     File.write(component_dir.README,
-      "This is VSCodium " + version + " from " + vscodium_repository +
+      "This is VSCodium " + vscodium_version + " from " + vscodium_repository +
 """
 
 It has been built from sources using "isabelle component_vscodium". This applies