Move Extension Context

This commit is contained in:
Josh Johnson 2018-05-03 22:08:12 -04:00
parent 7a5df9f387
commit 907fa71394
4 changed files with 21 additions and 6 deletions

View File

@ -0,0 +1,17 @@
import { ExtensionContext, Memento } from "vscode";
export class ExtensionState {
private static _context: ExtensionContext;
static get global(): Memento {
return this._context.globalState;
}
static get workspace(): Memento {
return this._context.workspaceState;
}
static configure(context: ExtensionContext): void {
this._context = context;
}
}

View File

@ -1 +1,2 @@
export * from "./create-document-selector";
export * from "./extension-state";

View File

@ -3,7 +3,7 @@ import {
TextEditor, TextEditorSelectionChangeEvent, TextEditorSelectionChangeKind
} from "vscode";
import { createDocumentSelector } from "./common";
import { createDocumentSelector, ExtensionState } from "./common";
import { XQueryCompletionItemProvider } from "./completion";
import { XmlFormatterFactory, XmlFormattingEditProvider } from "./formatting";
import { formatAsXml, minifyXml } from "./formatting/commands";
@ -14,11 +14,8 @@ import { executeXQuery } from "./xquery-execution/commands";
import * as constants from "./constants";
export const ExtensionState: { global?: Memento, workspace?: Memento } = { };
export function activate(context: ExtensionContext) {
ExtensionState.global = context.globalState;
ExtensionState.workspace = context.workspaceState;
ExtensionState.configure(context);
const config = workspace.getConfiguration(constants.extensionPrefix);

View File

@ -1,8 +1,8 @@
import { window, workspace } from "vscode";
import { TextEditor, TextEditorEdit, ViewColumn } from "vscode";
import { ExtensionState } from "../../common";
import * as constants from "../../constants";
import { ExtensionState } from "../../extension";
import { EvaluatorResult, EvaluatorResultType, XPathEvaluator } from "../xpath-evaluator";