tuned signature;
authorwenzelm
Sat, 11 Mar 2017 12:12:55 +0100
changeset 65180 b5a8f27a4980
parent 65179 883acfccb265
child 65181 b4105202751c
tuned signature;
src/Tools/VSCode/extension/src/decorations.ts
src/Tools/VSCode/extension/src/extension.ts
--- a/src/Tools/VSCode/extension/src/decorations.ts	Fri Mar 10 23:09:53 2017 +0100
+++ b/src/Tools/VSCode/extension/src/decorations.ts	Sat Mar 11 12:12:55 2017 +0100
@@ -3,6 +3,7 @@
 import * as vscode from 'vscode'
 import { Position, Range, MarkedString, DecorationOptions, DecorationRenderOptions,
   TextDocument, TextEditor, TextEditorDecorationType, ExtensionContext, Uri } from 'vscode'
+import { get_color } from './extension'
 
 
 /* known decoration types */
@@ -55,12 +56,6 @@
   "antiquote"
 ]
 
-function get_color(color: string, light: boolean): string
-{
-  const config = color + (light ? "_light" : "_dark") + "_color"
-  return vscode.workspace.getConfiguration("isabelle").get<string>(config)
-}
-
 export function init(context: ExtensionContext)
 {
   function decoration(options: DecorationRenderOptions): TextEditorDecorationType
--- a/src/Tools/VSCode/extension/src/extension.ts	Fri Mar 10 23:09:53 2017 +0100
+++ b/src/Tools/VSCode/extension/src/extension.ts	Sat Mar 11 12:12:55 2017 +0100
@@ -6,17 +6,34 @@
 import * as os from 'os';
 import * as decorations from './decorations';
 import { Decoration } from './decorations'
+import { WorkspaceConfiguration} from 'vscode'
 import { LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, TransportKind, NotificationType }
   from 'vscode-languageclient';
 
 
+/* Isabelle configuration */
+
+export function get_configuration(): WorkspaceConfiguration
+{
+  return vscode.workspace.getConfiguration("isabelle")
+}
+
+export function get_color(color: string, light: boolean): string
+{
+  const config = color + (light ? "_light" : "_dark") + "_color"
+  return get_configuration().get<string>(config)
+}
+
+
+/* activate extension */
+
 export function activate(context: vscode.ExtensionContext)
 {
   const is_windows = os.type().startsWith("Windows")
 
-  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")
+  const isabelle_home = get_configuration().get<string>("home")
+  const isabelle_args = get_configuration().get<Array<string>>("args")
+  const cygwin_root = get_configuration().get<string>("cygwin_root")
 
   if (isabelle_home === "")
     vscode.window.showErrorMessage("Missing user settings: isabelle.home")