From b668ab49c3daa3ccbcab1124bffa449091343bc6 Mon Sep 17 00:00:00 2001 From: Rajko Winkler Date: Mon, 21 Dec 2015 14:40:43 +0100 Subject: [PATCH] Adding to #6 - user setting to persist the last query --- src/features/xmlXPathEngine.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/features/xmlXPathEngine.ts b/src/features/xmlXPathEngine.ts index edaea0a..16282e9 100644 --- a/src/features/xmlXPathEngine.ts +++ b/src/features/xmlXPathEngine.ts @@ -1,16 +1,18 @@ 'use strict'; -import { window, TextEditor, TextEditorEdit, OutputChannel, ViewColumn } from 'vscode'; +import { window, TextEditor, TextEditorEdit, OutputChannel, ViewColumn, workspace } from 'vscode'; let xpath = require('xpath'); let dom = require('xmldom').DOMParser; let resultChannel: OutputChannel = null; export function evaluateXPath(editor: TextEditor, edit: TextEditorEdit): void { - window.showInputBox({ + let isPersistant = workspace.getConfiguration().has('xmlTools.PersistXPathQuery') && workspace.getConfiguration('xmlTools').get('PersistXPathQuery') === true + + window.showInputBox({ placeHolder: 'XPath Query', prompt: 'Please enter an XPath query to evaluate.', - value: Singleton.getXPathValue() + value: isPersistant ? Singleton.getXPathValue() : '' }).then((query) => { if (query === undefined) return; @@ -36,9 +38,7 @@ export function evaluateXPath(editor: TextEditor, edit: TextEditorEdit): void { if (resultChannel === null) resultChannel = window.createOutputChannel('XPath Evaluation Results'); resultChannel.clear(); - - resultChannel.appendLine('Last query: ' + query + '\n'); - + nodes.forEach((node) => { resultChannel.appendLine(`${node.localName}: ${node.firstChild.data}`); });