forked from external/vscode-xml
		
	Add XPath History Cleanup
This commit is contained in:
		
							parent
							
								
									b7e4fc8c15
								
							
						
					
					
						commit
						721f50cc37
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue