src/Tools/VSCode/extension/src/extension.ts
author wenzelm
Wed, 21 Nov 2018 15:19:11 +0100
changeset 69322 ce6d43af5bcb
parent 66395 14146fb264d8
child 71475 7a867a38712a
permissions -rw-r--r--
more robust (see https://code.visualstudio.com/docs/extensionAPI/document-selectors);
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 path from 'path';
65172
365e97f009ed default cygwin_root from Isabelle distribution;
wenzelm
parents: 65171
diff changeset
     4
import * as fs from 'fs';
65968
44e703278dfd clarified modules;
wenzelm
parents: 65958
diff changeset
     5
import * as library from './library'
65094
386d9d487f62 support for decorations;
wenzelm
parents: 64874
diff changeset
     6
import * as decorations from './decorations';
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
     7
import * as preview_panel from './preview_panel';
65201
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
     8
import * as protocol from './protocol';
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
     9
import * as state_panel from './state_panel';
66052
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
    10
import * as symbol from './symbol';
66060
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
    11
import * as completion from './completion';
66216
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    12
import { Uri, TextEditor, ViewColumn, Selection, Position, ExtensionContext, workspace, window,
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    13
  commands, languages } from 'vscode';
66215
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    14
import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind,
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    15
  NotificationType } from 'vscode-languageclient';
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    16
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    17
65201
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    18
let last_caret_update: protocol.Caret_Update = {}
65180
b5a8f27a4980 tuned signature;
wenzelm
parents: 65172
diff changeset
    19
65969
1f93eb5c3d77 tuned imports;
wenzelm
parents: 65968
diff changeset
    20
export function activate(context: ExtensionContext)
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    21
{
65968
44e703278dfd clarified modules;
wenzelm
parents: 65958
diff changeset
    22
  const isabelle_home = library.get_configuration<string>("home")
44e703278dfd clarified modules;
wenzelm
parents: 65958
diff changeset
    23
  const isabelle_args = library.get_configuration<Array<string>>("args")
44e703278dfd clarified modules;
wenzelm
parents: 65958
diff changeset
    24
  const cygwin_root = library.get_configuration<string>("cygwin_root")
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    25
65182
973b7669e7d9 proper Map operations;
wenzelm
parents: 65180
diff changeset
    26
973b7669e7d9 proper Map operations;
wenzelm
parents: 65180
diff changeset
    27
  /* server */
973b7669e7d9 proper Map operations;
wenzelm
parents: 65180
diff changeset
    28
65172
365e97f009ed default cygwin_root from Isabelle distribution;
wenzelm
parents: 65171
diff changeset
    29
  if (isabelle_home === "")
65969
1f93eb5c3d77 tuned imports;
wenzelm
parents: 65968
diff changeset
    30
    window.showErrorMessage("Missing user settings: isabelle.home")
64753
79ed396709e4 more robust startup;
wenzelm
parents: 64750
diff changeset
    31
  else {
65168
9eabc312a2a2 prefer immutable bindings;
wenzelm
parents: 65167
diff changeset
    32
    const isabelle_tool = isabelle_home + "/bin/isabelle"
9eabc312a2a2 prefer immutable bindings;
wenzelm
parents: 65167
diff changeset
    33
    const standard_args = ["-o", "vscode_unicode_symbols", "-o", "vscode_pide_extensions"]
65167
wenzelm
parents: 65165
diff changeset
    34
65168
9eabc312a2a2 prefer immutable bindings;
wenzelm
parents: 65167
diff changeset
    35
    const server_options: ServerOptions =
65970
05e317e291a8 clarified modules;
wenzelm
parents: 65969
diff changeset
    36
      library.platform_is_windows() ?
65172
365e97f009ed default cygwin_root from Isabelle distribution;
wenzelm
parents: 65171
diff changeset
    37
        { command:
365e97f009ed default cygwin_root from Isabelle distribution;
wenzelm
parents: 65171
diff changeset
    38
            (cygwin_root === "" ? path.join(isabelle_home, "contrib", "cygwin") : cygwin_root) +
365e97f009ed default cygwin_root from Isabelle distribution;
wenzelm
parents: 65171
diff changeset
    39
            "/bin/bash",
64874
e13ff666af96 enable vscode_unicode_symbols by default, despite asymmetry of input and output;
wenzelm
parents: 64833
diff changeset
    40
          args: ["-l", isabelle_tool, "vscode_server"].concat(standard_args, isabelle_args) } :
64755
ceb81f4928ea support for Windows;
wenzelm
parents: 64753
diff changeset
    41
        { command: isabelle_tool,
64874
e13ff666af96 enable vscode_unicode_symbols by default, despite asymmetry of input and output;
wenzelm
parents: 64833
diff changeset
    42
          args: ["vscode_server"].concat(standard_args, isabelle_args) };
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
    43
    const language_client_options: LanguageClientOptions = {
69322
ce6d43af5bcb more robust (see https://code.visualstudio.com/docs/extensionAPI/document-selectors);
wenzelm
parents: 66395
diff changeset
    44
      documentSelector: [
ce6d43af5bcb more robust (see https://code.visualstudio.com/docs/extensionAPI/document-selectors);
wenzelm
parents: 66395
diff changeset
    45
        { language: "isabelle", scheme: "file" },
ce6d43af5bcb more robust (see https://code.visualstudio.com/docs/extensionAPI/document-selectors);
wenzelm
parents: 66395
diff changeset
    46
        { language: "isabelle-ml", scheme: "file" },
ce6d43af5bcb more robust (see https://code.visualstudio.com/docs/extensionAPI/document-selectors);
wenzelm
parents: 66395
diff changeset
    47
        { language: "bibtex", scheme: "file" }
ce6d43af5bcb more robust (see https://code.visualstudio.com/docs/extensionAPI/document-selectors);
wenzelm
parents: 66395
diff changeset
    48
      ]
64753
79ed396709e4 more robust startup;
wenzelm
parents: 64750
diff changeset
    49
    };
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
    50
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
    51
    const language_client =
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
    52
      new LanguageClient("Isabelle", server_options, language_client_options, false)
65094
386d9d487f62 support for decorations;
wenzelm
parents: 64874
diff changeset
    53
65182
973b7669e7d9 proper Map operations;
wenzelm
parents: 65180
diff changeset
    54
65201
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    55
    /* decorations */
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    56
66097
ee4c2d5b650e tuned signature;
wenzelm
parents: 66096
diff changeset
    57
    decorations.setup(context)
65975
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
    58
    context.subscriptions.push(
66097
ee4c2d5b650e tuned signature;
wenzelm
parents: 66096
diff changeset
    59
      workspace.onDidChangeConfiguration(() => decorations.setup(context)),
65975
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
    60
      workspace.onDidChangeTextDocument(event => decorations.touch_document(event.document)),
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
    61
      window.onDidChangeActiveTextEditor(decorations.update_editor),
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
    62
      workspace.onDidCloseTextDocument(decorations.close_document))
65201
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    63
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
    64
    language_client.onReady().then(() =>
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
    65
      language_client.onNotification(protocol.decoration_type, decorations.apply_decoration))
65201
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    66
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    67
65978
wenzelm
parents: 65977
diff changeset
    68
    /* caret handling */
65191
4c9c83311cad dynamic output, depending on caret focus (see also Tools/jEdit/src/output_dockable.scala);
wenzelm
parents: 65189
diff changeset
    69
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    70
    function update_caret()
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    71
    {
65969
1f93eb5c3d77 tuned imports;
wenzelm
parents: 65968
diff changeset
    72
      const editor = window.activeTextEditor
65201
2d01b30e6ac6 clarified modules;
wenzelm
parents: 65200
diff changeset
    73
      let caret_update: protocol.Caret_Update = {}
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    74
      if (editor) {
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    75
        const uri = editor.document.uri
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    76
        const cursor = editor.selection.active
65972
9f6a154c6ca0 clarified modules;
wenzelm
parents: 65970
diff changeset
    77
        if (library.is_file(uri) && cursor)
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    78
          caret_update = { uri: uri.toString(), line: cursor.line, character: cursor.character }
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    79
      }
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    80
      if (last_caret_update !== caret_update) {
65202
187277b77d50 suppress vacuous messages;
wenzelm
parents: 65201
diff changeset
    81
        if (caret_update.uri)
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
    82
          language_client.sendNotification(protocol.caret_update_type, caret_update)
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    83
        last_caret_update = caret_update
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    84
      }
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    85
    }
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
    86
66215
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    87
    function goto_file(caret_update: protocol.Caret_Update)
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    88
    {
66216
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    89
      function move_cursor(editor: TextEditor)
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    90
      {
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    91
        const pos = new Position(caret_update.line || 0, caret_update.character || 0)
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    92
        editor.selections = [new Selection(pos, pos)]
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    93
      }
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    94
66215
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    95
      if (caret_update.uri) {
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    96
        workspace.openTextDocument(Uri.parse(caret_update.uri)).then(document =>
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    97
        {
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
    98
          const editor = library.find_file_editor(document.uri)
66216
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
    99
          const column = editor ? editor.viewColumn : ViewColumn.One
d4949bae0bad clarified editor focus;
wenzelm
parents: 66215
diff changeset
   100
          window.showTextDocument(document, column, !caret_update.focus).then(move_cursor)
66215
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
   101
        })
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
   102
      }
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
   103
    }
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
   104
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
   105
    language_client.onReady().then(() =>
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
   106
    {
65975
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
   107
      context.subscriptions.push(
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
   108
        window.onDidChangeActiveTextEditor(_ => update_caret()),
f20739a63a44 more careful treatment of context.subscriptions;
wenzelm
parents: 65974
diff changeset
   109
        window.onDidChangeTextEditorSelection(_ => update_caret()))
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
   110
      update_caret()
66215
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
   111
9a8b6b86350c proper hyperlink_command, notably for locate_query;
wenzelm
parents: 66211
diff changeset
   112
      language_client.onNotification(protocol.caret_update_type, goto_file)
65189
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
   113
    })
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
   114
41d2452845fc support for caret handling and dynamic output;
wenzelm
parents: 65186
diff changeset
   115
65978
wenzelm
parents: 65977
diff changeset
   116
    /* dynamic output */
wenzelm
parents: 65977
diff changeset
   117
wenzelm
parents: 65977
diff changeset
   118
    const dynamic_output = window.createOutputChannel("Isabelle Output")
wenzelm
parents: 65977
diff changeset
   119
    context.subscriptions.push(dynamic_output)
wenzelm
parents: 65977
diff changeset
   120
    dynamic_output.show(true)
wenzelm
parents: 65977
diff changeset
   121
    dynamic_output.hide()
wenzelm
parents: 65977
diff changeset
   122
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
   123
    language_client.onReady().then(() =>
65978
wenzelm
parents: 65977
diff changeset
   124
    {
65983
d8c5603c1732 explicit preview request/response;
wenzelm
parents: 65979
diff changeset
   125
      language_client.onNotification(protocol.dynamic_output_type,
65979
c208fcf369b7 tuned -- like Dynamic_Preview;
wenzelm
parents: 65978
diff changeset
   126
        params => { dynamic_output.clear(); dynamic_output.appendLine(params.content) })
65978
wenzelm
parents: 65977
diff changeset
   127
    })
wenzelm
parents: 65977
diff changeset
   128
wenzelm
parents: 65977
diff changeset
   129
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   130
    /* state panel */
66096
6187612e83c1 support for separate proof state output;
wenzelm
parents: 66072
diff changeset
   131
6187612e83c1 support for separate proof state output;
wenzelm
parents: 66072
diff changeset
   132
    context.subscriptions.push(
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   133
      commands.registerCommand("isabelle.state", uri => state_panel.init(uri)),
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   134
      commands.registerCommand("_isabelle.state-locate", state_panel.locate),
66211
100c9c997e2b HTML GUI actions via JavaScript;
wenzelm
parents: 66138
diff changeset
   135
      commands.registerCommand("_isabelle.state-update", state_panel.update),
66395
14146fb264d8 proper state_panel exit;
wenzelm
parents: 66216
diff changeset
   136
      commands.registerCommand("_isabelle.state-auto-update", state_panel.auto_update),
14146fb264d8 proper state_panel exit;
wenzelm
parents: 66216
diff changeset
   137
      workspace.onDidCloseTextDocument(document => state_panel.exit_uri(document.uri)))
66096
6187612e83c1 support for separate proof state output;
wenzelm
parents: 66072
diff changeset
   138
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   139
    language_client.onReady().then(() => state_panel.setup(context, language_client))
66096
6187612e83c1 support for separate proof state output;
wenzelm
parents: 66072
diff changeset
   140
6187612e83c1 support for separate proof state output;
wenzelm
parents: 66072
diff changeset
   141
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   142
    /* preview panel */
65958
6338355b2a88 basic setup for document preview;
wenzelm
parents: 65233
diff changeset
   143
65984
8e6a833da7db register commands earlier, before prover startup;
wenzelm
parents: 65983
diff changeset
   144
    context.subscriptions.push(
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   145
      commands.registerCommand("isabelle.preview", uri => preview_panel.request(uri, false)),
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   146
      commands.registerCommand("isabelle.preview-split", uri => preview_panel.request(uri, true)),
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   147
      commands.registerCommand("isabelle.preview-source", preview_panel.source),
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   148
      commands.registerCommand("isabelle.preview-update", preview_panel.update))
65984
8e6a833da7db register commands earlier, before prover startup;
wenzelm
parents: 65983
diff changeset
   149
66098
5aa9cb83e70e clarified modules;
wenzelm
parents: 66097
diff changeset
   150
    language_client.onReady().then(() => preview_panel.setup(context, language_client))
65958
6338355b2a88 basic setup for document preview;
wenzelm
parents: 65233
diff changeset
   151
6338355b2a88 basic setup for document preview;
wenzelm
parents: 65233
diff changeset
   152
66052
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   153
    /* Isabelle symbols */
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   154
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   155
    language_client.onReady().then(() =>
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   156
    {
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   157
      language_client.onNotification(protocol.symbols_type,
66097
ee4c2d5b650e tuned signature;
wenzelm
parents: 66096
diff changeset
   158
        params => symbol.setup(context, params.entries))
66052
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   159
      language_client.sendNotification(protocol.symbols_request_type)
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   160
    })
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   161
39eb61b1fa51 provide information about Isabelle symbols within VSCode;
wenzelm
parents: 65987
diff changeset
   162
66060
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   163
    /* completion */
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   164
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   165
    const completion_provider = new completion.Completion_Provider
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   166
    for (const mode of ["isabelle", "isabelle-ml"]) {
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   167
      context.subscriptions.push(
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   168
        languages.registerCompletionItemProvider(mode, completion_provider))
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   169
    }
b2bfbefd354f symbol completion that bypasses the LS protocol, and thus observes the range properly;
wenzelm
parents: 66052
diff changeset
   170
66138
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   171
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   172
    /* spell checker */
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   173
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   174
    language_client.onReady().then(() =>
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   175
    {
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   176
      context.subscriptions.push(
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   177
        commands.registerCommand("isabelle.include-word", uri =>
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   178
          language_client.sendNotification(protocol.include_word_type)),
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   179
        commands.registerCommand("isabelle.include-word-permanently", uri =>
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   180
          language_client.sendNotification(protocol.include_word_permanently_type)),
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   181
        commands.registerCommand("isabelle.exclude-word", uri =>
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   182
          language_client.sendNotification(protocol.exclude_word_type)),
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   183
        commands.registerCommand("isabelle.exclude-word-permanently", uri =>
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   184
          language_client.sendNotification(protocol.exclude_word_permanently_type)),
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   185
        commands.registerCommand("isabelle.reset-words", uri =>
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   186
          language_client.sendNotification(protocol.reset_words_type)))
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   187
    })
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   188
f7ef4c50b747 added commands for spell-checker dictionary;
wenzelm
parents: 66098
diff changeset
   189
65182
973b7669e7d9 proper Map operations;
wenzelm
parents: 65180
diff changeset
   190
    /* start server */
973b7669e7d9 proper Map operations;
wenzelm
parents: 65180
diff changeset
   191
65986
d2b2f08533c5 added update operation;
wenzelm
parents: 65985
diff changeset
   192
    context.subscriptions.push(language_client.start())
65094
386d9d487f62 support for decorations;
wenzelm
parents: 64874
diff changeset
   193
  }
64605
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
   194
}
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
   195
9c1173a7e4cb basic support for VSCode Language Server protocol;
wenzelm
parents:
diff changeset
   196
export function deactivate() { }