# HG changeset patch # User wenzelm # Date 1483374951 -3600 # Node ID ceb81f4928eafeac4e694603b03a7d8722e02883 # Parent 74d8793fecebcbad049d265019315ccb0472a738 support for Windows; diff -r 74d8793feceb -r ceb81f4928ea src/Tools/VSCode/extension/package.json --- a/src/Tools/VSCode/extension/package.json Mon Jan 02 15:53:41 2017 +0100 +++ b/src/Tools/VSCode/extension/package.json Mon Jan 02 17:35:51 2017 +0100 @@ -52,16 +52,21 @@ "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": "", - "description": "ISABELLE_HOME directory" + "description": "Main Isabelle directory (ISABELLE_HOME)." }, "isabelle.args": { "type": "array", "items": { "type": "string" }, "default": [], - "description": "command-line arguments for isabelle vscode_server" + "description": "Command-line arguments for isabelle vscode_server process." } } } diff -r 74d8793feceb -r ceb81f4928ea src/Tools/VSCode/extension/src/extension.ts --- a/src/Tools/VSCode/extension/src/extension.ts Mon Jan 02 15:53:41 2017 +0100 +++ b/src/Tools/VSCode/extension/src/extension.ts Mon Jan 02 17:35:51 2017 +0100 @@ -2,6 +2,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; +import * as os from 'os'; import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind } from 'vscode-languageclient'; @@ -9,15 +10,25 @@ export function activate(context: vscode.ExtensionContext) { + let is_windows = os.type().startsWith("Windows") + + let cygwin_root = vscode.workspace.getConfiguration("isabelle").get("cygwin_root"); let isabelle_home = vscode.workspace.getConfiguration("isabelle").get("home"); let isabelle_args = vscode.workspace.getConfiguration("isabelle").get>("args"); - if (isabelle_home == "") vscode.window.showErrorMessage("Missing isabelle.home settings") + if (is_windows && cygwin_root == "") + vscode.window.showErrorMessage("Missing user settings: isabelle.cygwin_root") + else if (isabelle_home == "") + vscode.window.showErrorMessage("Missing user settings: isabelle.home") else { - let run = { - command: path.join(isabelle_home, "bin", "isabelle"), - args: ["vscode_server"].concat(isabelle_args) - }; + let isabelle_tool = isabelle_home.concat("/bin/isabelle") + let run = + is_windows ? + { command: cygwin_root.concat("/bin/bash"), + args: ["-l", isabelle_tool, "vscode_server"].concat(isabelle_args) } : + { command: isabelle_tool, + args: ["vscode_server"].concat(isabelle_args) }; + let server_options: ServerOptions = { run: run, diff -r 74d8793feceb -r ceb81f4928ea src/Tools/VSCode/src/server.scala --- a/src/Tools/VSCode/src/server.scala Mon Jan 02 15:53:41 2017 +0100 +++ b/src/Tools/VSCode/src/server.scala Mon Jan 02 17:35:51 2017 +0100 @@ -52,9 +52,9 @@ Run the VSCode Language Server protocol (JSON RPC) over stdin/stdout. """, - "L:" -> (arg => log_file = Some(Path.explode(arg))), + "L:" -> (arg => log_file = Some(Path.explode(File.standard_path(arg)))), "T:" -> (arg => Text.Length.encoding(arg)), - "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))), + "d:" -> (arg => dirs = dirs ::: List(Path.explode(File.standard_path(arg)))), "l:" -> (arg => logic = arg), "m:" -> (arg => modes = arg :: modes), "o:" -> (arg => options = options + arg),