Add XPath History Cleanup

This commit is contained in:
Josh Johnson 2016-01-07 11:19:29 -05:00
parent b7e4fc8c15
commit 721f50cc37

View File

@ -8,6 +8,7 @@ export var GlobalState: vsc.Memento;
export var WorkspaceState: vsc.Memento;
const LANG_XML: string = 'xml';
const MEM_QUERY_HISTORY: string = 'xpathQueryHistory';
export function activate(ctx: vsc.ExtensionContext) {
// expose global and workspace state to the entire extension
@ -26,4 +27,12 @@ export function activate(ctx: vsc.ExtensionContext) {
vsc.languages.registerDocumentFormattingEditProvider(LANG_XML, new XmlDocumentFormattingEditProvider()),
vsc.languages.registerDocumentRangeFormattingEditProvider(LANG_XML, new XmlRangeFormattingEditProvider())
);
}
export function deactivate() {
// clean up xpath history
let memento: vsc.Memento = WorkspaceState || GlobalState;
let history = memento.get<any[]>(MEM_QUERY_HISTORY, []);
history.splice(0);
memento.update(MEM_QUERY_HISTORY, history);
}