src/Tools/VSCode/extension/src/extension.ts
author wenzelm
Sun, 01 Jan 2017 13:38:20 +0100
changeset 64734 12558536d977
parent 64605 9c1173a7e4cb
child 64735 4ad6d21545bd
permissions -rw-r--r--
more configuration;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     1
'use strict';
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     2
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     3
import * as vscode from 'vscode';
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     4
import * as path from 'path';
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     5
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     6
import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind }
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     7
  from 'vscode-languageclient';
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     8
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
     9
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    10
export function activate(context: vscode.ExtensionContext)
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    11
{
64734
12558536d977 more configuration;
wenzelm
parents: 64605
diff changeset
    12
  let isabelle_home = vscode.workspace.getConfiguration("isabelle").get<string>("home");
12558536d977 more configuration;
wenzelm
parents: 64605
diff changeset
    13
  let isabelle_arguments =
12558536d977 more configuration;
wenzelm
parents: 64605
diff changeset
    14
    vscode.workspace.getConfiguration("isabelle").get<Array<string>>("arguments");
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    15
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    16
  let run = {
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    17
    command: path.join(isabelle_home, "bin", "isabelle"),
64734
12558536d977 more configuration;
wenzelm
parents: 64605
diff changeset
    18
    args: ["vscode_server"].concat(isabelle_arguments)
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    19
  };
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    20
  let server_options: ServerOptions =
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    21
  {
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    22
    run: run,
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    23
    debug: {
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    24
      command: run.command,
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    25
      args: run.args.concat(["-L", path.join(context.extensionPath, "protocol.log")]) }
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    26
  };
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    27
  let client_options: LanguageClientOptions = { documentSelector: "isabelle" };
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    28
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    29
  let disposable =
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    30
    new LanguageClient("Isabelle Language Service", server_options, client_options, false).start();
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    31
  context.subscriptions.push(disposable);
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    32
}
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    33
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    34
export function deactivate() { }