vscode-html-languageservice
Advanced tools
Comparing version 2.1.11-next.10 to 2.1.11-next.11
// copied from js-beautify/js/lib/beautify-css.js | ||
// version: 1.9.0-beta4 | ||
// version: 1.9.0-beta5 | ||
/* AUTO-GENERATED. DO NOT MODIFY. */ | ||
@@ -4,0 +4,0 @@ /* |
@@ -7,6 +7,7 @@ /*--------------------------------------------------------------------------------------------- | ||
import * as arrays from '../utils/arrays'; | ||
export var EMPTY_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; | ||
export function isEmptyElement(e) { | ||
return !!e && arrays.binarySearch(EMPTY_ELEMENTS, e.toLowerCase(), function (s1, s2) { return s1.localeCompare(s2); }) >= 0; | ||
// As defined in https://www.w3.org/TR/html5/syntax.html#void-elements | ||
export var VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; | ||
export function isVoidElement(e) { | ||
return !!e && arrays.binarySearch(VOID_ELEMENTS, e.toLowerCase(), function (s1, s2) { return s1.localeCompare(s2); }) >= 0; | ||
} | ||
//# sourceMappingURL=fact.js.map |
@@ -8,3 +8,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import { findFirst } from '../utils/arrays'; | ||
import { isEmptyElement } from '../languageFacts'; | ||
import { isVoidElement } from '../languageFacts'; | ||
import { TokenType } from '../htmlLanguageTypes'; | ||
@@ -88,3 +88,3 @@ var Node = /** @class */ (function () { | ||
curr.startTagEnd = scanner.getTokenEnd(); | ||
if (curr.tag && isEmptyElement(curr.tag) && curr.parent) { | ||
if (curr.tag && isVoidElement(curr.tag) && curr.parent) { | ||
curr.closed = true; | ||
@@ -91,0 +91,0 @@ curr = curr.parent; |
@@ -8,3 +8,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import { createScanner } from '../parser/htmlScanner'; | ||
import { isEmptyElement } from '../languageFacts'; | ||
import { isVoidElement } from '../languageFacts'; | ||
import { getAllDataProviders } from '../languageFacts'; | ||
@@ -126,3 +126,3 @@ import { ScannerState, TokenType } from '../htmlLanguageTypes'; | ||
} | ||
if (!isEmptyElement(tag)) { | ||
if (!isVoidElement(tag)) { | ||
var pos = document.positionAt(tagCloseEnd); | ||
@@ -415,3 +415,3 @@ result.items.push({ | ||
var node = htmlDocument.findNodeBefore(offset); | ||
if (node && node.tag && !isEmptyElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) { | ||
if (node && node.tag && !isVoidElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) { | ||
var scanner = createScanner(document.getText(), node.start); | ||
@@ -418,0 +418,0 @@ var token = scanner.scan(); |
@@ -9,3 +9,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import { createScanner } from '../parser/htmlScanner'; | ||
import { isEmptyElement } from '../languageFacts'; | ||
import { isVoidElement } from '../languageFacts'; | ||
function limitRanges(ranges, rangeLimit) { | ||
@@ -106,3 +106,3 @@ ranges = ranges.sort(function (r1, r2) { | ||
case TokenType.StartTagClose: | ||
if (!lastTagName || !isEmptyElement(lastTagName)) { | ||
if (!lastTagName || !isVoidElement(lastTagName)) { | ||
break; | ||
@@ -109,0 +109,0 @@ } |
@@ -35,5 +35,14 @@ /** | ||
var result = getAllParentTagRanges(currNode); | ||
// Self-closing tags | ||
// Self-closing or void elements | ||
if (currNode.startTagEnd && !currNode.endTagStart) { | ||
result.unshift([currNode.start + 1, currNode.startTagEnd - 2]); | ||
var closeRange = Range.create(document.positionAt(currNode.startTagEnd - 2), document.positionAt(currNode.startTagEnd)); | ||
var closeText = document.getText(closeRange); | ||
// Self-closing element | ||
if (closeText === '/>') { | ||
result.unshift([currNode.start + 1, currNode.startTagEnd - 2]); | ||
} | ||
// Void element | ||
else { | ||
result.unshift([currNode.start + 1, currNode.startTagEnd - 1]); | ||
} | ||
var attributeLevelRanges = getAttributeLevelRanges(document, currNode, currOffset); | ||
@@ -40,0 +49,0 @@ result = attributeLevelRanges.concat(result); |
// copied from js-beautify/js/lib/beautify-css.js | ||
// version: 1.9.0-beta4 | ||
// version: 1.9.0-beta5 | ||
/* AUTO-GENERATED. DO NOT MODIFY. */ | ||
@@ -4,0 +4,0 @@ /* |
@@ -17,8 +17,9 @@ (function (factory) { | ||
var arrays = require("../utils/arrays"); | ||
exports.EMPTY_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; | ||
function isEmptyElement(e) { | ||
return !!e && arrays.binarySearch(exports.EMPTY_ELEMENTS, e.toLowerCase(), function (s1, s2) { return s1.localeCompare(s2); }) >= 0; | ||
// As defined in https://www.w3.org/TR/html5/syntax.html#void-elements | ||
exports.VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']; | ||
function isVoidElement(e) { | ||
return !!e && arrays.binarySearch(exports.VOID_ELEMENTS, e.toLowerCase(), function (s1, s2) { return s1.localeCompare(s2); }) >= 0; | ||
} | ||
exports.isEmptyElement = isEmptyElement; | ||
exports.isVoidElement = isVoidElement; | ||
}); | ||
//# sourceMappingURL=fact.js.map |
@@ -97,3 +97,3 @@ (function (factory) { | ||
curr.startTagEnd = scanner.getTokenEnd(); | ||
if (curr.tag && languageFacts_1.isEmptyElement(curr.tag) && curr.parent) { | ||
if (curr.tag && languageFacts_1.isVoidElement(curr.tag) && curr.parent) { | ||
curr.closed = true; | ||
@@ -100,0 +100,0 @@ curr = curr.parent; |
@@ -135,3 +135,3 @@ (function (factory) { | ||
} | ||
if (!languageFacts_1.isEmptyElement(tag)) { | ||
if (!languageFacts_1.isVoidElement(tag)) { | ||
var pos = document.positionAt(tagCloseEnd); | ||
@@ -424,3 +424,3 @@ result.items.push({ | ||
var node = htmlDocument.findNodeBefore(offset); | ||
if (node && node.tag && !languageFacts_1.isEmptyElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) { | ||
if (node && node.tag && !languageFacts_1.isVoidElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) { | ||
var scanner = htmlScanner_1.createScanner(document.getText(), node.start); | ||
@@ -427,0 +427,0 @@ var token = scanner.scan(); |
@@ -115,3 +115,3 @@ (function (factory) { | ||
case htmlLanguageTypes_1.TokenType.StartTagClose: | ||
if (!lastTagName || !languageFacts_1.isEmptyElement(lastTagName)) { | ||
if (!lastTagName || !languageFacts_1.isVoidElement(lastTagName)) { | ||
break; | ||
@@ -118,0 +118,0 @@ } |
@@ -47,5 +47,14 @@ (function (factory) { | ||
var result = getAllParentTagRanges(currNode); | ||
// Self-closing tags | ||
// Self-closing or void elements | ||
if (currNode.startTagEnd && !currNode.endTagStart) { | ||
result.unshift([currNode.start + 1, currNode.startTagEnd - 2]); | ||
var closeRange = vscode_languageserver_types_1.Range.create(document.positionAt(currNode.startTagEnd - 2), document.positionAt(currNode.startTagEnd)); | ||
var closeText = document.getText(closeRange); | ||
// Self-closing element | ||
if (closeText === '/>') { | ||
result.unshift([currNode.start + 1, currNode.startTagEnd - 2]); | ||
} | ||
// Void element | ||
else { | ||
result.unshift([currNode.start + 1, currNode.startTagEnd - 1]); | ||
} | ||
var attributeLevelRanges = getAttributeLevelRanges(document, currNode, currOffset); | ||
@@ -52,0 +61,0 @@ result = attributeLevelRanges.concat(result); |
{ | ||
"name": "vscode-html-languageservice", | ||
"version": "2.1.11-next.10", | ||
"version": "2.1.11-next.11", | ||
"description": "Language service for HTML", | ||
@@ -21,3 +21,3 @@ "main": "./lib/umd/htmlLanguageService.js", | ||
"cpy-cli": "^2.0.0", | ||
"js-beautify": "^1.9.0-beta4", | ||
"js-beautify": "^1.9.0-beta5", | ||
"mocha": "^5.2.0", | ||
@@ -24,0 +24,0 @@ "rimraf": "^2.6.2", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
845804
22974