def extension_dir: Path = Path.explode("$ISABELLE_VSCODE_HOME/extension") val extension_name: String = "isabelle.isabelle"
val MANIFEST: Path = Path.explode("MANIFEST")
privatedef shasum_vsix(vsix_path: Path): SHA1.Shasum = { val name = "extension/MANIFEST.shasum" def err(): Nothing = error("Cannot retrieve " + quote(name) + " from " + vsix_path) if (vsix_path.is_file) {
using(new ZipFile(vsix_path.file))(zip_file =>
zip_file.getEntry(name) match { casenull => err() case entry =>
zip_file.getInputStream(entry) match { casenull => err() case stream => SHA1.fake_shasum(File.read_stream(stream))
}
})
} else err()
}
privatedef shasum_dir(dir: Path): Option[SHA1.Shasum] = { val path = dir + MANIFEST.shasum if (path.is_file) Some(SHA1.fake_shasum(File.read(path))) else None
}
def locate_extension(): Option[Path] = { val out = run_vscodium(List("--locate-extension", extension_name)).check.out if (out.nonEmpty) Some(Path.explode(File.standard_path(out))) else None
}
def uninstall_extension(progress: Progress = new Progress): Unit =
locate_extension() match { case None => progress.echo_warning("No Isabelle/VSCode extension to uninstall") case Some(dir) =>
run_vscodium(List("--uninstall-extension", extension_name)).check
progress.echo("Uninstalled Isabelle/VSCode extension from directory:\n" + dir)
}
def install_extension(
vsix_path: Path = default_vsix_path,
progress: Progress = new Progress
): Unit = { val new_shasum = shasum_vsix(vsix_path) val old_shasum = locate_extension().flatMap(shasum_dir) val current = old_shasum.isDefined && old_shasum.get == new_shasum
if (!current) {
run_vscodium(List("--install-extension", File.bash_platform_path(vsix_path))).check
locate_extension() match { case None => error("Missing Isabelle/VSCode extension after installation") case Some(dir) =>
progress.echo("Installed Isabelle/VSCode extension " + vsix_path.expand + "\ninto directory: " + dir)
}
}
}
def init_settings(): Unit = { if (!settings_path.is_file) {
Isabelle_System.make_directory(settings_path.dir)
File.write(settings_path, default_settings)
}
}
/* Isabelle tool wrappers */
val isabelle_tool1 =
Isabelle_Tool("vscode", "Isabelle/VSCode interface wrapper", Scala_Project.here,
{ args => var logic_ancestor = "" var console = false val java_options = new StringBuilder(default_java_options) var edit_extension = false var server_log = false var logic_requirements = false var uninstall = false var vsix_path = default_vsix_path val session_dirs = new mutable.ListBuffer[Path] val include_sessions = new mutable.ListBuffer[String] var logic = Isabelle_System.default_logic() val modes = new mutable.ListBuffer[String] var no_build = false val options = new mutable.ListBuffer[String] var verbose = false
-A NAME ancestor session for option -R (default: parent)
-C run as foreground process, with console output
-D NAME=X set JVM system property for"isabelle vscode_server"
-J OPTION add JVM runtime option for"isabelle vscode_server"
(default: $VSCODE_JAVA_OPTIONS=""" + quote(default_java_options) + """)
-E edit Isabelle/VSCode extension project sources
-L enable language server log to file: """ + server_log_path.implode + """
-R NAME build image with requirements from other sessions
-U uninstall Isabelle/VSCode extension
-V FILE specify VSIX file for Isabelle/VSCode extension
(default: """ + default_vsix_path + """)
-d DIR include session directory
-i NAME include session in name-space of theories
-l NAME logic session name
-m MODE add print mode for output
-n no build of session image on startup
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-p CMD command prefix for ML process (e.g. NUMA policy)
-s system build mode for session image (system_heaps=true)
-u user build mode for session image (system_heaps=false)
-v verbose logging of language server
Start Isabelle/VSCode application, with automatic configuration of
user settings.
val isabelle_tool2 =
Isabelle_Tool("vscode_server", "VSCode Language Server for PIDE", Scala_Project.here,
{ args => try { var logic_ancestor: Option[String] = None var log_file: Option[Path] = None var logic_requirements = false val dirs = new mutable.ListBuffer[Path] val include_sessions = new mutable.ListBuffer[String] var logic = Isabelle_System.default_logic() var modes: List[String] = Nil var no_build = false var options = Options.init() var verbose = false
val getopts = Getopts("""
Usage: isabelle vscode_server [OPTIONS]
Options are:
-A NAME ancestor session for option -R (default: parent)
-L FILE logging on FILE
-R NAME build image with requirements from other sessions
-d DIR include session directory
-i NAME include session in name-space of theories
-l NAME logic session name (default ISABELLE_LOGIC=""" +
quote(Isabelle_System.default_logic()) + """)
-m MODE add print mode for output
-n no build of session image on startup
-o OPTION override Isabelle system OPTION (via NAME=VAL or NAME)
-v verbose logging
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.