Support for multi root
This commit is contained in:
		
							parent
							
								
									c828608867
								
							
						
					
					
						commit
						1c0807c5cf
					
				
					 5 changed files with 23 additions and 15 deletions
				
			
		
							
								
								
									
										20
									
								
								package.json
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
										
									
									
									
								
							|  | @ -22,7 +22,7 @@ | ||||||
| 		"url": "https://github.com/DotJoshJohnson/vscode-xml/issues" | 		"url": "https://github.com/DotJoshJohnson/vscode-xml/issues" | ||||||
| 	}, | 	}, | ||||||
| 	"engines": { | 	"engines": { | ||||||
| 		"vscode": "^1.13.0", | 		"vscode": "^1.17.0", | ||||||
| 		"node": "^0.12.0" | 		"node": "^0.12.0" | ||||||
| 	}, | 	}, | ||||||
| 	"categories": [ | 	"categories": [ | ||||||
|  | @ -58,32 +58,38 @@ | ||||||
|                 "xmlTools.persistXPathQuery": { |                 "xmlTools.persistXPathQuery": { | ||||||
|                     "type": "boolean", |                     "type": "boolean", | ||||||
|                     "default": true, |                     "default": true, | ||||||
|                     "description": "Remember the last XPath query used." |                     "description": "Remember the last XPath query used.", | ||||||
|  |                     "scope": "resource" | ||||||
|                 }, |                 }, | ||||||
|                 "xmlTools.removeCommentsOnMinify": { |                 "xmlTools.removeCommentsOnMinify": { | ||||||
|                     "type": "boolean", |                     "type": "boolean", | ||||||
|                     "default": false, |                     "default": false, | ||||||
|                     "description": "Remove XML comments when XML is minified." |                     "description": "Remove XML comments when XML is minified.", | ||||||
|  |                     "scope": "resource" | ||||||
|                 }, |                 }, | ||||||
|                 "xmlTools.splitXmlnsOnFormat": { |                 "xmlTools.splitXmlnsOnFormat": { | ||||||
|                     "type": "boolean", |                     "type": "boolean", | ||||||
|                     "default": true, |                     "default": true, | ||||||
|                     "description": "Put each xmlns attribute on a new line when fromatting XML." |                     "description": "Put each xmlns attribute on a new line when fromatting XML.", | ||||||
|  |                     "scope": "resource" | ||||||
|                 }, |                 }, | ||||||
|                 "xmlTools.xqueryExecutionEngine": { |                 "xmlTools.xqueryExecutionEngine": { | ||||||
|                     "type": "string", |                     "type": "string", | ||||||
|                     "default": "", |                     "default": "", | ||||||
|                     "description": "The full path to the execution engine executable." |                     "description": "The full path to the execution engine executable.", | ||||||
|  |                     "scope": "resource" | ||||||
|                 }, |                 }, | ||||||
|                 "xmlTools.xqueryExecutionArguments": { |                 "xmlTools.xqueryExecutionArguments": { | ||||||
|                     "type": "array", |                     "type": "array", | ||||||
|                     "default": ["-xquery", "$(script)", "-in", "$(input)", "-out", "$(input).output.xml"], |                     "default": ["-xquery", "$(script)", "-in", "$(input)", "-out", "$(input).output.xml"], | ||||||
|                     "description": "Arguments to be passed to the execution engine. '$(script)' and '$(input)' refer to the XQuery script and input XML file, respectively." |                     "description": "Arguments to be passed to the execution engine. '$(script)' and '$(input)' refer to the XQuery script and input XML file, respectively.", | ||||||
|  |                     "scope": "resource" | ||||||
|                 }, |                 }, | ||||||
|                 "xmlTools.ignoreDefaultNamespace": { |                 "xmlTools.ignoreDefaultNamespace": { | ||||||
|                     "type": "boolean", |                     "type": "boolean", | ||||||
|                     "default": true, |                     "default": true, | ||||||
|                     "description": "Ignores default xmlns attribute when evaluating XPath." |                     "description": "Ignores default xmlns attribute when evaluating XPath.", | ||||||
|  |                     "scope": "resource" | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ const CFG_REMOVE_COMMENTS: string = "removeCommentsOnMinify"; | ||||||
| 
 | 
 | ||||||
| export class TextEditorCommands { | export class TextEditorCommands { | ||||||
|     static minifyXml(editor: vsc.TextEditor, edit: vsc.TextEditorEdit): void { |     static minifyXml(editor: vsc.TextEditor, edit: vsc.TextEditorEdit): void { | ||||||
|         let removeComments: boolean = vsc.workspace.getConfiguration(CFG_SECTION).get<boolean>(CFG_REMOVE_COMMENTS, false); |         let removeComments: boolean = vsc.workspace.getConfiguration(CFG_SECTION, editor.document.uri).get<boolean>(CFG_REMOVE_COMMENTS, false); | ||||||
|          |          | ||||||
|         let range: vsc.Range = RangeUtil.getRangeForDocument(editor.document); |         let range: vsc.Range = RangeUtil.getRangeForDocument(editor.document); | ||||||
|          |          | ||||||
|  |  | ||||||
|  | @ -15,8 +15,8 @@ export class XQueryExecutionProvider { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         let executable = vsc.workspace.getConfiguration(CFG_SECTION).get<string>(CFG_XQEXEC, null); |         let executable = vsc.workspace.getConfiguration(CFG_SECTION, editor.document.uri).get<string>(CFG_XQEXEC, null); | ||||||
|         let args = vsc.workspace.getConfiguration(CFG_SECTION).get<string[]>(CFG_XQARGS, []); |         let args = vsc.workspace.getConfiguration(CFG_SECTION, editor.document.uri).get<string[]>(CFG_XQARGS, []); | ||||||
|          |          | ||||||
|         if (!executable || executable == "") { |         if (!executable || executable == "") { | ||||||
|             let action = await vsc.window.showWarningMessage("An XQuery execution engine has not been defined.", "Define Now"); |             let action = await vsc.window.showWarningMessage("An XQuery execution engine has not been defined.", "Define Now"); | ||||||
|  | @ -89,14 +89,16 @@ export class XQueryExecutionProvider { | ||||||
|              |              | ||||||
|             args[outputPathPos] = outputPath; |             args[outputPathPos] = outputPath; | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|  |         const project = vsc.workspace.getWorkspaceFolder(editor.document.uri) ? vsc.workspace.getWorkspaceFolder(editor.document.uri).uri.fsPath : ''; | ||||||
|  | 
 | ||||||
|         // call out to the execution engine
 |         // call out to the execution engine
 | ||||||
|         disposable = vsc.window.setStatusBarMessage("Executing XQuery Script..."); |         disposable = vsc.window.setStatusBarMessage("Executing XQuery Script..."); | ||||||
|         args = args.map<string>((value: string) => { |         args = args.map<string>((value: string) => { | ||||||
|             return value |             return value | ||||||
|                 .replace("$(script)", editor.document.uri.fsPath) |                 .replace("$(script)", editor.document.uri.fsPath) | ||||||
|                 .replace("$(input)", inputFile.fsPath) |                 .replace("$(input)", inputFile.fsPath) | ||||||
|                 .replace("$(project)", vsc.workspace.rootPath); |                 .replace("$(project)", project); | ||||||
|         }); |         }); | ||||||
|          |          | ||||||
|         try { |         try { | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ export class XmlFormattingEditProvider implements vsc.DocumentFormattingEditProv | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     private _provideFormattingEdits(document: vsc.TextDocument, range: vsc.Range, options: vsc.FormattingOptions): vsc.TextEdit[] { |     private _provideFormattingEdits(document: vsc.TextDocument, range: vsc.Range, options: vsc.FormattingOptions): vsc.TextEdit[] { | ||||||
|         let splitNamespaces: boolean = vsc.workspace.getConfiguration(CFG_SECTION).get<boolean>(CFG_SPLIT_NAMESPACES, true); |         let splitNamespaces: boolean = vsc.workspace.getConfiguration(CFG_SECTION, document.uri).get<boolean>(CFG_SPLIT_NAMESPACES, true); | ||||||
|          |          | ||||||
|         let formatterOptions: IXmlFormatterOptions = { |         let formatterOptions: IXmlFormatterOptions = { | ||||||
|             preferSpaces: options.insertSpaces, |             preferSpaces: options.insertSpaces, | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ export class XPathFeatureProvider { | ||||||
|         let memento: vsc.Memento = ext.WorkspaceState || ext.GlobalState; |         let memento: vsc.Memento = ext.WorkspaceState || ext.GlobalState; | ||||||
|          |          | ||||||
|         // get the xpath persistence setting
 |         // get the xpath persistence setting
 | ||||||
|         let persistQueries: boolean = vsc.workspace.getConfiguration(CFG_SECTION).get<boolean>(CFG_PERSIST_QUERY, true); |         let persistQueries: boolean = vsc.workspace.getConfiguration(CFG_SECTION, editor.document.uri).get<boolean>(CFG_PERSIST_QUERY, true); | ||||||
|          |          | ||||||
|         // get the last query if there is one for this document
 |         // get the last query if there is one for this document
 | ||||||
|         // if not, try pulling the last query ran, regardless of document
 |         // if not, try pulling the last query ran, regardless of document
 | ||||||
|  | @ -53,7 +53,7 @@ export class XPathFeatureProvider { | ||||||
|         // showInputBox() will return undefined if the user dimissed the prompt
 |         // showInputBox() will return undefined if the user dimissed the prompt
 | ||||||
|         if (query) { |         if (query) { | ||||||
|              |              | ||||||
|             let ignoreDefaultNamespace: boolean = vsc.workspace.getConfiguration(CFG_SECTION).get<boolean>(CFG_IGNORE_DEFAULT_XMLNS, true); |             let ignoreDefaultNamespace: boolean = vsc.workspace.getConfiguration(CFG_SECTION, editor.document.uri).get<boolean>(CFG_IGNORE_DEFAULT_XMLNS, true); | ||||||
|              |              | ||||||
|             // run the query
 |             // run the query
 | ||||||
|             let xml: string = editor.document.getText(); |             let xml: string = editor.document.getText(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue