Added showExplorer flag to control registration of tree view data provider

This commit is contained in:
Owen Farrell 2018-01-07 15:19:05 -05:00
parent c828608867
commit cb534b9e82
2 changed files with 13 additions and 3 deletions

View file

@ -84,6 +84,11 @@
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"description": "Ignores default xmlns attribute when evaluating XPath." "description": "Ignores default xmlns attribute when evaluating XPath."
},
"xmlTools.showExplorer": {
"type": "boolean",
"default": true,
"description": "Show the XML Document view in the explorer panel"
} }
} }
}, },

View file

@ -8,6 +8,8 @@ import { XmlTreeViewDataProvider } from "./providers/XmlTreeView";
export var GlobalState: vsc.Memento; export var GlobalState: vsc.Memento;
export var WorkspaceState: 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_XML: string = "xml";
const LANG_XSL: string = "xsl"; const LANG_XSL: string = "xsl";
const LANG_XQUERY: string = "xquery;" const LANG_XQUERY: string = "xquery;"
@ -42,9 +44,12 @@ export function activate(ctx: vsc.ExtensionContext) {
); );
// add views // add views
ctx.subscriptions.push( let showExplorer: boolean = vsc.workspace.getConfiguration(CFG_SECTION).get<boolean>(CFG_SHOW_EXPLORER, true);
vsc.window.registerTreeDataProvider("xmlTreeView", new XmlTreeViewDataProvider(ctx)) if (showExplorer){
); ctx.subscriptions.push(
vsc.window.registerTreeDataProvider("xmlTreeView", new XmlTreeViewDataProvider(ctx))
);
}
} }
export function deactivate() { export function deactivate() {