From cb534b9e82f4a8244b6ee31668419ac9f24a994b Mon Sep 17 00:00:00 2001 From: Owen Farrell Date: Sun, 7 Jan 2018 15:19:05 -0500 Subject: [PATCH] Added showExplorer flag to control registration of tree view data provider --- package.json | 5 +++++ src/Extension.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fbb6e8b..1c27a4e 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,11 @@ "type": "boolean", "default": true, "description": "Ignores default xmlns attribute when evaluating XPath." + }, + "xmlTools.showExplorer": { + "type": "boolean", + "default": true, + "description": "Show the XML Document view in the explorer panel" } } }, diff --git a/src/Extension.ts b/src/Extension.ts index 2e600a9..a4a6243 100644 --- a/src/Extension.ts +++ b/src/Extension.ts @@ -8,6 +8,8 @@ import { XmlTreeViewDataProvider } from "./providers/XmlTreeView"; export var GlobalState: vsc.Memento; export var WorkspaceState: vsc.Memento; +const CFG_SECTION: string = "xmlTools"; +const CFG_SHOW_EXPLORER: string = "showExplorer"; const LANG_XML: string = "xml"; const LANG_XSL: string = "xsl"; const LANG_XQUERY: string = "xquery;" @@ -42,9 +44,12 @@ export function activate(ctx: vsc.ExtensionContext) { ); // add views - ctx.subscriptions.push( - vsc.window.registerTreeDataProvider("xmlTreeView", new XmlTreeViewDataProvider(ctx)) - ); + let showExplorer: boolean = vsc.workspace.getConfiguration(CFG_SECTION).get(CFG_SHOW_EXPLORER, true); + if (showExplorer){ + ctx.subscriptions.push( + vsc.window.registerTreeDataProvider("xmlTreeView", new XmlTreeViewDataProvider(ctx)) + ); + } } export function deactivate() {