Merge pull request #56 from TrueCommerce/2016/May

v1.6.0
This commit is contained in:
Josh Johnson 2016-06-07 17:16:39 -04:00
commit 62234629e2
6 changed files with 16 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules
src/**/*.js
src/**/*.js
**/*.vsix

View File

@ -3,6 +3,7 @@
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/*/vsix": true,
"**/*.js": {"when": "$(basename).ts"}
}
}

View File

@ -4,4 +4,5 @@ CONTRIBUTING.md
.vscode
resources/wiki-images
typings
**/*.ts
**/*.ts
**/*.vsix

View File

@ -2,7 +2,7 @@
"name": "xml",
"displayName": "XML Tools",
"description": "XML Formatting, XQuery, and XPath Tools for Visual Studio Code",
"version": "1.5.2",
"version": "1.6.0",
"publisher": "DotJoshJohnson",
"author": {
"name": "TrueCommerce",
@ -114,6 +114,7 @@
},
"activationEvents": [
"onLanguage:xml",
"onLanguage:xsl",
"onLanguage:xquery",
"onCommand:xmlTools.minifyXml",
"onCommand:xmlTools.evaluateXPath",

View File

@ -11,6 +11,7 @@ export var GlobalState: vsc.Memento;
export var WorkspaceState: vsc.Memento;
const LANG_XML: string = 'xml';
const LANG_XSL: string = 'xsl';
const LANG_XQUERY: string = 'xquery;'
const MEM_QUERY_HISTORY: string = 'xpathQueryHistory';
@ -30,8 +31,8 @@ export function activate(ctx: vsc.ExtensionContext) {
// register language feature providers
ctx.subscriptions.push(
vsc.languages.registerDocumentFormattingEditProvider(LANG_XML, new XmlFormattingEditProvider()),
vsc.languages.registerDocumentRangeFormattingEditProvider(LANG_XML, new XmlFormattingEditProvider()),
vsc.languages.registerDocumentFormattingEditProvider([LANG_XML, LANG_XSL], new XmlFormattingEditProvider()),
vsc.languages.registerDocumentRangeFormattingEditProvider([LANG_XML, LANG_XSL], new XmlFormattingEditProvider()),
vsc.languages.registerCompletionItemProvider(LANG_XQUERY, new XQueryCompletionItemProvider(), ':', '$')
);

View File

@ -62,7 +62,7 @@ export class XmlFormatter {
// <elm></elm>
else if (/^<\w/.test(parts[i - 1]) && /^<\/\w/.test(parts[i])
&& /^<[\w:\-\.\,]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\,]+/.exec(parts[i])[0].replace('/', '')) {
output += parts[i];
if (!inComment) level--;
}
@ -157,7 +157,11 @@ export class XmlFormatter {
inCdata = true;
}
else if (char == ']' && (xml.substr(i, 3) == ']]>' || xml.substr(i, 3) == '-->')) {
else if (char == ']' && (xml.substr(i, 3) == ']]>')) {
inCdata = false;
}
else if (char == '-' && (xml.substr(i, 3) == '-->')) {
inCdata = false;
}