default cygwin_root from Isabelle distribution;
authorwenzelm
Fri, 10 Mar 2017 14:16:45 +0100
changeset 65172 365e97f009ed
parent 65171 63655086649f
child 65173 3700be571a01
default cygwin_root from Isabelle distribution;
src/Tools/VSCode/extension/README.md
src/Tools/VSCode/extension/package.json
src/Tools/VSCode/extension/src/extension.ts
--- a/src/Tools/VSCode/extension/README.md	Fri Mar 10 11:03:46 2017 +0100
+++ b/src/Tools/VSCode/extension/README.md	Fri Mar 10 14:16:45 2017 +0100
@@ -16,11 +16,6 @@
   * On Windows: `isabelle.home` as above, but in Windows path notation with
     drive-letter and backslashes.
 
-    Moreover, `isabelle.cygwin_root` needs to point to a suitable Cygwin
-    installation, e.g. `$ISABELLE_HOME\contrib\cygwin` for a regular Isabelle
-    application bundle, or `C:\cygwin` for a stand-alone installation used
-    with Isabelle repository snapshot.
-
 
 ## Isabelle symbols ##
 
--- a/src/Tools/VSCode/extension/package.json	Fri Mar 10 11:03:46 2017 +0100
+++ b/src/Tools/VSCode/extension/package.json	Fri Mar 10 14:16:45 2017 +0100
@@ -52,11 +52,6 @@
         "configuration": {
             "title": "Isabelle",
             "properties": {
-                "isabelle.cygwin_root": {
-                    "type": "string",
-                    "default": "",
-                    "description": "Root of Cygwin installation on Windows (e.g. ISABELLE_HOME/cygwin)."
-                },
                 "isabelle.home": {
                     "type": "string",
                     "default": "",
@@ -68,6 +63,11 @@
                     "default": [],
                     "description": "Command-line arguments for isabelle vscode_server process."
                 },
+                "isabelle.cygwin_root": {
+                    "type": "string",
+                    "default": "",
+                    "description": "Cygwin installation on Windows (only relevant when running directly from the Isabelle repository)."
+                },
                 "isabelle.unprocessed1_light_color": { "type": "string", "default": "rgba(255, 160, 160, 0.20)" },
                 "isabelle.unprocessed1_dark_color": { "type": "string", "default": "rgba(255, 160, 160, 0.20)" },
                 "isabelle.running1_light_color": { "type": "string", "default": "rgba(97, 0, 97, 0.39)" },
--- a/src/Tools/VSCode/extension/src/extension.ts	Fri Mar 10 11:03:46 2017 +0100
+++ b/src/Tools/VSCode/extension/src/extension.ts	Fri Mar 10 14:16:45 2017 +0100
@@ -2,6 +2,7 @@
 
 import * as vscode from 'vscode';
 import * as path from 'path';
+import * as fs from 'fs';
 import * as os from 'os';
 import * as decorations from './decorations';
 import { Decoration } from './decorations'
@@ -13,13 +14,11 @@
 {
   const is_windows = os.type().startsWith("Windows")
 
-  const cygwin_root = vscode.workspace.getConfiguration("isabelle").get<string>("cygwin_root");
-  const isabelle_home = vscode.workspace.getConfiguration("isabelle").get<string>("home");
-  const isabelle_args = vscode.workspace.getConfiguration("isabelle").get<Array<string>>("args");
+  const isabelle_home = vscode.workspace.getConfiguration("isabelle").get<string>("home")
+  const isabelle_args = vscode.workspace.getConfiguration("isabelle").get<Array<string>>("args")
+  const cygwin_root = vscode.workspace.getConfiguration("isabelle").get<string>("cygwin_root")
 
-  if (is_windows && cygwin_root === "")
-    vscode.window.showErrorMessage("Missing user settings: isabelle.cygwin_root")
-  else if (isabelle_home === "")
+  if (isabelle_home === "")
     vscode.window.showErrorMessage("Missing user settings: isabelle.home")
   else {
     const isabelle_tool = isabelle_home + "/bin/isabelle"
@@ -27,7 +26,9 @@
 
     const server_options: ServerOptions =
       is_windows ?
-        { command: cygwin_root + "/bin/bash",
+        { command:
+            (cygwin_root === "" ? path.join(isabelle_home, "contrib", "cygwin") : cygwin_root) +
+            "/bin/bash",
           args: ["-l", isabelle_tool, "vscode_server"].concat(standard_args, isabelle_args) } :
         { command: isabelle_tool,
           args: ["vscode_server"].concat(standard_args, isabelle_args) };