New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vscode-html-languageservice

Package Overview
Dependencies
Maintainers
7
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-html-languageservice - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

39

lib/esm/parser/htmlParser.js

@@ -23,3 +23,8 @@ /*---------------------------------------------------------------------------------------------

Node.prototype.isSameTag = function (tagInLowerCase) {
return this.tag && tagInLowerCase && this.tag.length === tagInLowerCase.length && this.tag.toLowerCase() === tagInLowerCase;
if (this.tag === undefined) {
return tagInLowerCase === undefined;
}
else {
return tagInLowerCase !== undefined && this.tag.length === tagInLowerCase.length && this.tag.toLowerCase() === tagInLowerCase;
}
};

@@ -71,3 +76,3 @@ Object.defineProperty(Node.prototype, "firstChild", {

var endTagStart = -1;
var endTagName = null;
var endTagName = undefined;
var pendingAttribute = null;

@@ -111,3 +116,3 @@ var token = scanner.scan();

endTagStart = scanner.getTokenOffset();
endTagName = null;
endTagName = undefined;
break;

@@ -118,19 +123,17 @@ case TokenType.EndTag:

case TokenType.EndTagClose:
if (endTagName) {
var node = curr;
// see if we can find a matching tag
while (!node.isSameTag(endTagName) && node.parent) {
node = node.parent;
}
if (node.parent) {
while (curr !== node) {
curr.end = endTagStart;
curr.closed = false;
curr = curr.parent;
}
curr.closed = true;
curr.endTagStart = endTagStart;
curr.end = scanner.getTokenEnd();
var node = curr;
// see if we can find a matching tag
while (!node.isSameTag(endTagName) && node.parent) {
node = node.parent;
}
if (node.parent) {
while (curr !== node) {
curr.end = endTagStart;
curr.closed = false;
curr = curr.parent;
}
curr.closed = true;
curr.endTagStart = endTagStart;
curr.end = scanner.getTokenEnd();
curr = curr.parent;
}

@@ -137,0 +140,0 @@ break;

@@ -9,5 +9,3 @@ /*---------------------------------------------------------------------------------------------

var node = htmlDocument.findNodeAt(offset);
if (!node.tag) {
return null;
}
var tagLength = node.tag ? node.tag.length : 0;
if (!node.endTagStart) {

@@ -18,8 +16,8 @@ return null;

// Within open tag, compute close tag
(node.start + '<'.length <= offset && offset <= node.start + '<'.length + node.tag.length) ||
(node.start + '<'.length <= offset && offset <= node.start + '<'.length + tagLength) ||
// Within closing tag, compute open tag
node.endTagStart + '</'.length <= offset && offset <= node.endTagStart + '</'.length + node.tag.length) {
node.endTagStart + '</'.length <= offset && offset <= node.endTagStart + '</'.length + tagLength) {
return [
Range.create(document.positionAt(node.start + '<'.length), document.positionAt(node.start + '<'.length + node.tag.length)),
Range.create(document.positionAt(node.endTagStart + '</'.length), document.positionAt(node.endTagStart + '</'.length + node.tag.length))
Range.create(document.positionAt(node.start + '<'.length), document.positionAt(node.start + '<'.length + tagLength)),
Range.create(document.positionAt(node.endTagStart + '</'.length), document.positionAt(node.endTagStart + '</'.length + tagLength))
];

@@ -26,0 +24,0 @@ }

@@ -34,3 +34,8 @@ /*---------------------------------------------------------------------------------------------

Node.prototype.isSameTag = function (tagInLowerCase) {
return this.tag && tagInLowerCase && this.tag.length === tagInLowerCase.length && this.tag.toLowerCase() === tagInLowerCase;
if (this.tag === undefined) {
return tagInLowerCase === undefined;
}
else {
return tagInLowerCase !== undefined && this.tag.length === tagInLowerCase.length && this.tag.toLowerCase() === tagInLowerCase;
}
};

@@ -82,3 +87,3 @@ Object.defineProperty(Node.prototype, "firstChild", {

var endTagStart = -1;
var endTagName = null;
var endTagName = undefined;
var pendingAttribute = null;

@@ -122,3 +127,3 @@ var token = scanner.scan();

endTagStart = scanner.getTokenOffset();
endTagName = null;
endTagName = undefined;
break;

@@ -129,19 +134,17 @@ case htmlLanguageTypes_1.TokenType.EndTag:

case htmlLanguageTypes_1.TokenType.EndTagClose:
if (endTagName) {
var node = curr;
// see if we can find a matching tag
while (!node.isSameTag(endTagName) && node.parent) {
node = node.parent;
}
if (node.parent) {
while (curr !== node) {
curr.end = endTagStart;
curr.closed = false;
curr = curr.parent;
}
curr.closed = true;
curr.endTagStart = endTagStart;
curr.end = scanner.getTokenEnd();
var node = curr;
// see if we can find a matching tag
while (!node.isSameTag(endTagName) && node.parent) {
node = node.parent;
}
if (node.parent) {
while (curr !== node) {
curr.end = endTagStart;
curr.closed = false;
curr = curr.parent;
}
curr.closed = true;
curr.endTagStart = endTagStart;
curr.end = scanner.getTokenEnd();
curr = curr.parent;
}

@@ -148,0 +151,0 @@ break;

@@ -20,5 +20,3 @@ /*---------------------------------------------------------------------------------------------

var node = htmlDocument.findNodeAt(offset);
if (!node.tag) {
return null;
}
var tagLength = node.tag ? node.tag.length : 0;
if (!node.endTagStart) {

@@ -29,8 +27,8 @@ return null;

// Within open tag, compute close tag
(node.start + '<'.length <= offset && offset <= node.start + '<'.length + node.tag.length) ||
(node.start + '<'.length <= offset && offset <= node.start + '<'.length + tagLength) ||
// Within closing tag, compute open tag
node.endTagStart + '</'.length <= offset && offset <= node.endTagStart + '</'.length + node.tag.length) {
node.endTagStart + '</'.length <= offset && offset <= node.endTagStart + '</'.length + tagLength) {
return [
vscode_languageserver_types_1.Range.create(document.positionAt(node.start + '<'.length), document.positionAt(node.start + '<'.length + node.tag.length)),
vscode_languageserver_types_1.Range.create(document.positionAt(node.endTagStart + '</'.length), document.positionAt(node.endTagStart + '</'.length + node.tag.length))
vscode_languageserver_types_1.Range.create(document.positionAt(node.start + '<'.length), document.positionAt(node.start + '<'.length + tagLength)),
vscode_languageserver_types_1.Range.create(document.positionAt(node.endTagStart + '</'.length), document.positionAt(node.endTagStart + '</'.length + tagLength))
];

@@ -37,0 +35,0 @@ }

{
"name": "vscode-html-languageservice",
"version": "3.1.1",
"version": "3.1.2",
"description": "Language service for HTML",

@@ -5,0 +5,0 @@ "main": "./lib/umd/htmlLanguageService.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc