Move Extension Context
This commit is contained in:
parent
7a5df9f387
commit
907fa71394
17
src/common/extension-state.ts
Normal file
17
src/common/extension-state.ts
Normal 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;
|
||||
}
|
||||
}
|
@ -1 +1,2 @@
|
||||
export * from "./create-document-selector";
|
||||
export * from "./extension-state";
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user