From bea88f5fc8dbb25038d1635abb6e6a0f222fd598 Mon Sep 17 00:00:00 2001 From: Lei Chen Date: Wed, 8 Dec 2021 19:03:02 +0800 Subject: [PATCH] fix: prettyHTML format error (#130) * fix: prettyHTML format error * chroe: add missing changelog --- CHANGELOG.md | 5 +++++ package-lock.json | 2 +- package.json | 2 +- res/prettyhtml.js | 16 ++++++++-------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6efd04..2f72bbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2.4.5 / 2021-12-08 +================== + +* Fix [#129](https://github.com/wx-minapp/minapp-vscode/issues/129) + 2.4.4 / 2021-12-04 ================== diff --git a/package-lock.json b/package-lock.json index 4bdfebc..958c07b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "minapp-vscode", - "version": "2.4.4", + "version": "2.4.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6bea243..30fd329 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "minapp-vscode", "displayName": "WXML - Language Service", "description": "wechat miniprogram .wxml file syntax highlight,code autocomplete(support native miniprogram、mpvue and wepy framework,provide code snippets)", - "version": "2.4.4", + "version": "2.4.5", "publisher": "qiu8310", "extensionKind": [ "workspace" diff --git a/res/prettyhtml.js b/res/prettyhtml.js index 969120f..51885c7 100644 --- a/res/prettyhtml.js +++ b/res/prettyhtml.js @@ -4088,14 +4088,14 @@ if (this._getParentElement()) { this._getParentElement().endSourceSpan = endTagToken.sourceSpan; } - // if (this.getTagDefinition(nameInfo.fullName, this.options.ignoreFirstLf, this.options.selfClosingElements) - // .isVoid) { - // this._errors.push(TreeError.create(nameInfo.fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`)); - // } - // else if (!this._popElement(nameInfo.fullName)) { - // const errMsg = `Unexpected closing tag "${nameInfo.fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`; - // this._errors.push(TreeError.create(nameInfo.fullName, endTagToken.sourceSpan, errMsg)); - // } + if (this.getTagDefinition(nameInfo.fullName, this.options.ignoreFirstLf, this.options.selfClosingElements) + .isVoid) { + // this._errors.push(TreeError.create(nameInfo.fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`)); + } + else if (!this._popElement(nameInfo.fullName)) { + // const errMsg = `Unexp ected closing tag "${nameInfo.fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`; + // this._errors.push(TreeError.create(nameInfo.fullName, endTagToken.sourceSpan, errMsg)); + } } _popElement(fullName) { for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {