commit
62234629e2
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
src/**/*.js
|
src/**/*.js
|
||||||
|
**/*.vsix
|
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -3,6 +3,7 @@
|
|||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"**/.git": true,
|
"**/.git": true,
|
||||||
"**/.DS_Store": true,
|
"**/.DS_Store": true,
|
||||||
|
"**/*/vsix": true,
|
||||||
"**/*.js": {"when": "$(basename).ts"}
|
"**/*.js": {"when": "$(basename).ts"}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,4 +4,5 @@ CONTRIBUTING.md
|
|||||||
.vscode
|
.vscode
|
||||||
resources/wiki-images
|
resources/wiki-images
|
||||||
typings
|
typings
|
||||||
**/*.ts
|
**/*.ts
|
||||||
|
**/*.vsix
|
@ -2,7 +2,7 @@
|
|||||||
"name": "xml",
|
"name": "xml",
|
||||||
"displayName": "XML Tools",
|
"displayName": "XML Tools",
|
||||||
"description": "XML Formatting, XQuery, and XPath Tools for Visual Studio Code",
|
"description": "XML Formatting, XQuery, and XPath Tools for Visual Studio Code",
|
||||||
"version": "1.5.2",
|
"version": "1.6.0",
|
||||||
"publisher": "DotJoshJohnson",
|
"publisher": "DotJoshJohnson",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "TrueCommerce",
|
"name": "TrueCommerce",
|
||||||
@ -114,6 +114,7 @@
|
|||||||
},
|
},
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"onLanguage:xml",
|
"onLanguage:xml",
|
||||||
|
"onLanguage:xsl",
|
||||||
"onLanguage:xquery",
|
"onLanguage:xquery",
|
||||||
"onCommand:xmlTools.minifyXml",
|
"onCommand:xmlTools.minifyXml",
|
||||||
"onCommand:xmlTools.evaluateXPath",
|
"onCommand:xmlTools.evaluateXPath",
|
||||||
|
@ -11,6 +11,7 @@ export var GlobalState: vsc.Memento;
|
|||||||
export var WorkspaceState: vsc.Memento;
|
export var WorkspaceState: vsc.Memento;
|
||||||
|
|
||||||
const LANG_XML: string = 'xml';
|
const LANG_XML: string = 'xml';
|
||||||
|
const LANG_XSL: string = 'xsl';
|
||||||
const LANG_XQUERY: string = 'xquery;'
|
const LANG_XQUERY: string = 'xquery;'
|
||||||
const MEM_QUERY_HISTORY: string = 'xpathQueryHistory';
|
const MEM_QUERY_HISTORY: string = 'xpathQueryHistory';
|
||||||
|
|
||||||
@ -30,8 +31,8 @@ export function activate(ctx: vsc.ExtensionContext) {
|
|||||||
|
|
||||||
// register language feature providers
|
// register language feature providers
|
||||||
ctx.subscriptions.push(
|
ctx.subscriptions.push(
|
||||||
vsc.languages.registerDocumentFormattingEditProvider(LANG_XML, new XmlFormattingEditProvider()),
|
vsc.languages.registerDocumentFormattingEditProvider([LANG_XML, LANG_XSL], new XmlFormattingEditProvider()),
|
||||||
vsc.languages.registerDocumentRangeFormattingEditProvider(LANG_XML, new XmlFormattingEditProvider()),
|
vsc.languages.registerDocumentRangeFormattingEditProvider([LANG_XML, LANG_XSL], new XmlFormattingEditProvider()),
|
||||||
|
|
||||||
vsc.languages.registerCompletionItemProvider(LANG_XQUERY, new XQueryCompletionItemProvider(), ':', '$')
|
vsc.languages.registerCompletionItemProvider(LANG_XQUERY, new XQueryCompletionItemProvider(), ':', '$')
|
||||||
);
|
);
|
||||||
|
@ -62,7 +62,7 @@ export class XmlFormatter {
|
|||||||
// <elm></elm>
|
// <elm></elm>
|
||||||
else if (/^<\w/.test(parts[i - 1]) && /^<\/\w/.test(parts[i])
|
else if (/^<\w/.test(parts[i - 1]) && /^<\/\w/.test(parts[i])
|
||||||
&& /^<[\w:\-\.\,]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\,]+/.exec(parts[i])[0].replace('/', '')) {
|
&& /^<[\w:\-\.\,]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\,]+/.exec(parts[i])[0].replace('/', '')) {
|
||||||
|
|
||||||
output += parts[i];
|
output += parts[i];
|
||||||
if (!inComment) level--;
|
if (!inComment) level--;
|
||||||
}
|
}
|
||||||
@ -157,7 +157,11 @@ export class XmlFormatter {
|
|||||||
inCdata = true;
|
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;
|
inCdata = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user