tuned;
authorwenzelm
Mon, 28 Feb 2022 13:02:40 +0100
changeset 75166 1f6da5d18340
parent 75165 19454aac373c
child 75167 0a300751fdf5
tuned;
src/Tools/VSCode/src/vscode_setup.scala
--- a/src/Tools/VSCode/src/vscode_setup.scala	Mon Feb 28 12:56:13 2022 +0100
+++ b/src/Tools/VSCode/src/vscode_setup.scala	Mon Feb 28 13:02:40 2022 +0100
@@ -36,18 +36,6 @@
     (install_ok, install_dir)
   }
 
-  val init_settings = """  {
-    "editor.fontFamily": "'Isabelle DejaVu Sans Mono'",
-    "editor.fontSize": 18,
-    "editor.lineNumbers": "off",
-    "editor.renderIndentGuides": false,
-    "editor.rulers": [80, 100],
-    "update.mode": "none",
-    "extensions.autoCheckUpdates": false,
-    "extensions.autoUpdate": false
-  }
-"""
-
 
   /* patch resources */
 
@@ -87,6 +75,18 @@
   val default_download_url: String = "https://github.com/VSCodium/vscodium/releases/download"
   def default_platform: Platform.Family.Value = Platform.family
 
+  private val init_settings = """  {
+    "editor.fontFamily": "'Isabelle DejaVu Sans Mono'",
+    "editor.fontSize": 18,
+    "editor.lineNumbers": "off",
+    "editor.renderIndentGuides": false,
+    "editor.rulers": [80, 100],
+    "update.mode": "none",
+    "extensions.autoCheckUpdates": false,
+    "extensions.autoUpdate": false
+  }
+"""
+
   private def macos_exe: String =
 """#!/usr/bin/env bash
 
@@ -99,19 +99,6 @@
 exit $?
 """
 
-  def download_name(version: String, platform: Platform.Family.Value): String =
-  {
-    val a = "VSCodium"
-    val (b, c) =
-      platform match {
-        case Platform.Family.linux_arm => ("linux-arm64", "tar.gz")
-        case Platform.Family.linux => ("linux-x64", "tar.gz")
-        case Platform.Family.macos => ("darwin-x64", "zip")
-        case Platform.Family.windows => ("win32-x64", "zip")
-      }
-    a + "-" + b + "-" + version + "." + c
-  }
-
   def vscode_setup(
     check: Boolean = false,
     download_url: String = default_download_url,
@@ -140,8 +127,19 @@
         progress.echo_warning("Isabelle/VSCode installation already present: " + install_dir.expand)
       }
       if (!install_ok || fresh) {
-        val name = download_name(version, platform)
-        val is_zip = name.endsWith(".zip")
+        val download_name =
+        {
+          val a = "VSCodium"
+          val (b, c) =
+            platform match {
+              case Platform.Family.linux_arm => ("linux-arm64", "tar.gz")
+              case Platform.Family.linux => ("linux-x64", "tar.gz")
+              case Platform.Family.macos => ("darwin-x64", "zip")
+              case Platform.Family.windows => ("win32-x64", "zip")
+            }
+          a + "-" + b + "-" + version + "." + c
+        }
+        val is_zip = download_name.endsWith(".zip")
         if (is_zip) Isabelle_System.require_command("unzip", test = "-h")
 
         Isabelle_System.make_directory(install_dir)
@@ -149,8 +147,8 @@
 
         Isabelle_System.with_tmp_file("download")(download =>
         {
-          Isabelle_System.download_file(download_url + "/" + version + "/" + name, download,
-            progress = if (quiet) new Progress else progress)
+          Isabelle_System.download_file(download_url + "/" + version + "/" + download_name,
+            download, progress = if (quiet) new Progress else progress)
           if (!quiet) progress.echo("Installing " + install_dir.expand)
           if (is_zip) {
             Isabelle_System.bash("unzip -x " + File.bash_path(download),