4 import * as path from 'path'; |
4 import * as path from 'path'; |
5 import * as fs from 'fs'; |
5 import * as fs from 'fs'; |
6 import * as os from 'os'; |
6 import * as os from 'os'; |
7 import * as decorations from './decorations'; |
7 import * as decorations from './decorations'; |
8 import { Decoration } from './decorations' |
8 import { Decoration } from './decorations' |
|
9 import { WorkspaceConfiguration} from 'vscode' |
9 import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind, NotificationType } |
10 import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind, NotificationType } |
10 from 'vscode-languageclient'; |
11 from 'vscode-languageclient'; |
11 |
12 |
|
13 |
|
14 /* Isabelle configuration */ |
|
15 |
|
16 export function get_configuration(): WorkspaceConfiguration |
|
17 { |
|
18 return vscode.workspace.getConfiguration("isabelle") |
|
19 } |
|
20 |
|
21 export function get_color(color: string, light: boolean): string |
|
22 { |
|
23 const config = color + (light ? "_light" : "_dark") + "_color" |
|
24 return get_configuration().get<string>(config) |
|
25 } |
|
26 |
|
27 |
|
28 /* activate extension */ |
12 |
29 |
13 export function activate(context: vscode.ExtensionContext) |
30 export function activate(context: vscode.ExtensionContext) |
14 { |
31 { |
15 const is_windows = os.type().startsWith("Windows") |
32 const is_windows = os.type().startsWith("Windows") |
16 |
33 |
17 const isabelle_home = vscode.workspace.getConfiguration("isabelle").get<string>("home") |
34 const isabelle_home = get_configuration().get<string>("home") |
18 const isabelle_args = vscode.workspace.getConfiguration("isabelle").get<Array<string>>("args") |
35 const isabelle_args = get_configuration().get<Array<string>>("args") |
19 const cygwin_root = vscode.workspace.getConfiguration("isabelle").get<string>("cygwin_root") |
36 const cygwin_root = get_configuration().get<string>("cygwin_root") |
20 |
37 |
21 if (isabelle_home === "") |
38 if (isabelle_home === "") |
22 vscode.window.showErrorMessage("Missing user settings: isabelle.home") |
39 vscode.window.showErrorMessage("Missing user settings: isabelle.home") |
23 else { |
40 else { |
24 const isabelle_tool = isabelle_home + "/bin/isabelle" |
41 const isabelle_tool = isabelle_home + "/bin/isabelle" |