Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-html-languageservice

Package Overview
Dependencies
Maintainers
6
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 2.1.11-next.2 to 2.1.11-next.3

lib/esm/languageFacts/builtinDataProviders.js

6

lib/esm/htmlLanguageService.d.ts
import { TextDocument, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink, FoldingRange } from 'vscode-languageserver-types';
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext } from './htmlLanguageTypes';
import { ITagSet, IAttributeSet } from './parser/htmlTags';
export { HTMLTagSpecification, ITagSet, IAttributeSet } from './parser/htmlTags';
import { HTMLData } from './languageFacts';
export * from './htmlLanguageTypes';

@@ -23,5 +22,4 @@ export * from 'vscode-languageserver-types';

export interface LanguageServiceOptions {
customTags?: ITagSet;
customAttributes?: IAttributeSet;
customDataCollections?: HTMLData[];
}
export declare function getLanguageService(options?: LanguageServiceOptions): LanguageService;

@@ -15,4 +15,3 @@ /*---------------------------------------------------------------------------------------------

import { getFoldingRanges } from './services/htmlFolding';
import { addTags, addAttributes } from './services/tagProviders';
export { HTMLTagSpecification } from './parser/htmlTags';
import { handleCustomData } from './languageFacts';
export * from './htmlLanguageTypes';

@@ -22,9 +21,4 @@ export * from 'vscode-languageserver-types';

var htmlCompletion = new HTMLCompletion();
if (options) {
if (options.customTags) {
addTags(options.customTags);
}
if (options.customAttributes) {
addAttributes(options.customAttributes);
}
if (options && options.customDataCollections) {
handleCustomData(options.customDataCollections);
}

@@ -31,0 +25,0 @@ return {

import { TextDocument, Position, Range } from 'vscode-languageserver-types';
export { IEntryData, ITagEntryData, IAttributeEntryData, HTMLData } from './languageFacts';
export interface HTMLFormatConfiguration {

@@ -3,0 +4,0 @@ tabSize?: number;

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

import { findFirst } from '../utils/arrays';
import { isEmptyElement } from './htmlTags';
import { isEmptyElement } from '../languageFacts';
import { TokenType } from '../htmlLanguageTypes';

@@ -11,0 +11,0 @@ var Node = /** @class */ (function () {

@@ -8,4 +8,4 @@ /*---------------------------------------------------------------------------------------------

import { createScanner } from '../parser/htmlScanner';
import { isEmptyElement } from '../parser/htmlTags';
import { getAllTagProviders } from './tagProviders';
import { isEmptyElement } from '../languageFacts';
import { getAllDataProviders } from '../languageFacts';
import { ScannerState, TokenType } from '../htmlLanguageTypes';

@@ -29,3 +29,3 @@ import { entities } from '../parser/htmlEntities';

var completionParticipants = this.completionParticipants;
var tagProviders = getAllTagProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); });
var tagProviders = getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); });
var text = document.getText();

@@ -50,7 +50,7 @@ var offset = document.offsetAt(position);

tagProviders.forEach(function (provider) {
provider.collectTags(function (tag, label) {
provider.collectTags(function (tag, description) {
result.items.push({
label: tag,
kind: CompletionItemKind.Property,
documentation: label,
documentation: description,
textEdit: TextEdit.replace(range, tag),

@@ -111,7 +111,7 @@ insertTextFormat: InsertTextFormat.PlainText

tagProviders.forEach(function (provider) {
provider.collectTags(function (tag, label) {
provider.collectTags(function (tag, description) {
result.items.push({
label: '/' + tag,
kind: CompletionItemKind.Property,
documentation: label,
documentation: description,
filterText: '/' + tag + closeTag,

@@ -157,3 +157,3 @@ textEdit: TextEdit.replace(range, '/' + tag + closeTag),

tagProviders.forEach(function (provider) {
provider.collectAttributes(tag, function (attribute, type) {
provider.collectAttributes(tag, function (attribute, type, description) {
if (seenAttributes[attribute]) {

@@ -177,2 +177,3 @@ return;

kind: type === 'handler' ? CompletionItemKind.Function : CompletionItemKind.Value,
documentation: description,
textEdit: TextEdit.replace(range, codeSnippet),

@@ -179,0 +180,0 @@ insertTextFormat: InsertTextFormat.Snippet,

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

import { createScanner } from '../parser/htmlScanner';
import { isEmptyElement } from '../parser/htmlTags';
import { isEmptyElement } from '../languageFacts';
function limitRanges(ranges, rangeLimit) {

@@ -12,0 +12,0 @@ ranges = ranges.sort(function (r1, r2) {

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

import { MarkedString } from 'vscode-languageserver-types';
import { getAllTagProviders } from './tagProviders';
import { getAllDataProviders } from '../languageFacts';
import { TokenType } from '../htmlLanguageTypes';

@@ -17,3 +17,3 @@ export function doHover(document, position, htmlDocument) {

}
var tagProviders = getAllTagProviders().filter(function (p) { return p.isApplicable(document.languageId); });
var tagProviders = getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId); });
function getTagHover(tag, range, open) {

@@ -23,6 +23,7 @@ tag = tag.toLowerCase();

var hover = null;
provider.collectTags(function (t, label) {
provider.collectTags(function (t, description) {
if (description === void 0) { description = ''; }
if (t === tag) {
var tagLabel = open ? '<' + tag + '>' : '</' + tag + '>';
hover = { contents: [{ language: 'html', value: tagLabel }, MarkedString.fromPlainText(label)], range: range };
hover = { contents: [{ language: 'html', value: tagLabel }, MarkedString.fromPlainText(description)], range: range };
}

@@ -29,0 +30,0 @@ });

import { TextDocument, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink, FoldingRange } from 'vscode-languageserver-types';
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext } from './htmlLanguageTypes';
import { ITagSet, IAttributeSet } from './parser/htmlTags';
export { HTMLTagSpecification, ITagSet, IAttributeSet } from './parser/htmlTags';
import { HTMLData } from './languageFacts';
export * from './htmlLanguageTypes';

@@ -23,5 +22,4 @@ export * from 'vscode-languageserver-types';

export interface LanguageServiceOptions {
customTags?: ITagSet;
customAttributes?: IAttributeSet;
customDataCollections?: HTMLData[];
}
export declare function getLanguageService(options?: LanguageServiceOptions): LanguageService;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./parser/htmlScanner", "./parser/htmlParser", "./services/htmlCompletion", "./services/htmlHover", "./services/htmlFormatter", "./services/htmlLinks", "./services/htmlHighlighting", "./services/htmlSymbolsProvider", "./services/htmlFolding", "./services/tagProviders", "./parser/htmlTags", "./htmlLanguageTypes", "vscode-languageserver-types"], factory);
define(["require", "exports", "./parser/htmlScanner", "./parser/htmlParser", "./services/htmlCompletion", "./services/htmlHover", "./services/htmlFormatter", "./services/htmlLinks", "./services/htmlHighlighting", "./services/htmlSymbolsProvider", "./services/htmlFolding", "./languageFacts", "./htmlLanguageTypes", "vscode-languageserver-types"], factory);
}

@@ -29,5 +29,3 @@ })(function (require, exports) {

var htmlFolding_1 = require("./services/htmlFolding");
var tagProviders_1 = require("./services/tagProviders");
var htmlTags_1 = require("./parser/htmlTags");
exports.HTMLTagSpecification = htmlTags_1.HTMLTagSpecification;
var languageFacts_1 = require("./languageFacts");
__export(require("./htmlLanguageTypes"));

@@ -37,9 +35,4 @@ __export(require("vscode-languageserver-types"));

var htmlCompletion = new htmlCompletion_1.HTMLCompletion();
if (options) {
if (options.customTags) {
tagProviders_1.addTags(options.customTags);
}
if (options.customAttributes) {
tagProviders_1.addAttributes(options.customAttributes);
}
if (options && options.customDataCollections) {
languageFacts_1.handleCustomData(options.customDataCollections);
}

@@ -46,0 +39,0 @@ return {

import { TextDocument, Position, Range } from 'vscode-languageserver-types';
export { IEntryData, ITagEntryData, IAttributeEntryData, HTMLData } from './languageFacts';
export interface HTMLFormatConfiguration {

@@ -3,0 +4,0 @@ tabSize?: number;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./htmlScanner", "../utils/arrays", "./htmlTags", "../htmlLanguageTypes"], factory);
define(["require", "exports", "./htmlScanner", "../utils/arrays", "../languageFacts", "../htmlLanguageTypes"], factory);
}

@@ -19,3 +19,3 @@ })(function (require, exports) {

var arrays_1 = require("../utils/arrays");
var htmlTags_1 = require("./htmlTags");
var languageFacts_1 = require("../languageFacts");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");

@@ -98,3 +98,3 @@ var Node = /** @class */ (function () {

curr.end = scanner.getTokenEnd(); // might be later set to end tag position
if (curr.tag && htmlTags_1.isEmptyElement(curr.tag) && curr.parent) {
if (curr.tag && languageFacts_1.isEmptyElement(curr.tag) && curr.parent) {
curr.closed = true;

@@ -101,0 +101,0 @@ curr = curr.parent;

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "vscode-languageserver-types", "../parser/htmlScanner", "../parser/htmlTags", "./tagProviders", "../htmlLanguageTypes", "../parser/htmlEntities", "vscode-nls", "../utils/strings"], factory);
define(["require", "exports", "vscode-languageserver-types", "../parser/htmlScanner", "../languageFacts", "../languageFacts", "../htmlLanguageTypes", "../parser/htmlEntities", "vscode-nls", "../utils/strings"], factory);
}

@@ -19,4 +19,4 @@ })(function (require, exports) {

var htmlScanner_1 = require("../parser/htmlScanner");
var htmlTags_1 = require("../parser/htmlTags");
var tagProviders_1 = require("./tagProviders");
var languageFacts_1 = require("../languageFacts");
var languageFacts_2 = require("../languageFacts");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");

@@ -40,3 +40,3 @@ var htmlEntities_1 = require("../parser/htmlEntities");

var completionParticipants = this.completionParticipants;
var tagProviders = tagProviders_1.getAllTagProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); });
var tagProviders = languageFacts_2.getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); });
var text = document.getText();

@@ -61,7 +61,7 @@ var offset = document.offsetAt(position);

tagProviders.forEach(function (provider) {
provider.collectTags(function (tag, label) {
provider.collectTags(function (tag, description) {
result.items.push({
label: tag,
kind: vscode_languageserver_types_1.CompletionItemKind.Property,
documentation: label,
documentation: description,
textEdit: vscode_languageserver_types_1.TextEdit.replace(range, tag),

@@ -122,7 +122,7 @@ insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.PlainText

tagProviders.forEach(function (provider) {
provider.collectTags(function (tag, label) {
provider.collectTags(function (tag, description) {
result.items.push({
label: '/' + tag,
kind: vscode_languageserver_types_1.CompletionItemKind.Property,
documentation: label,
documentation: description,
filterText: '/' + tag + closeTag,

@@ -140,3 +140,3 @@ textEdit: vscode_languageserver_types_1.TextEdit.replace(range, '/' + tag + closeTag),

}
if (!htmlTags_1.isEmptyElement(tag)) {
if (!languageFacts_1.isEmptyElement(tag)) {
var pos = document.positionAt(tagCloseEnd);

@@ -169,3 +169,3 @@ result.items.push({

tagProviders.forEach(function (provider) {
provider.collectAttributes(tag, function (attribute, type) {
provider.collectAttributes(tag, function (attribute, type, description) {
if (seenAttributes[attribute]) {

@@ -189,2 +189,3 @@ return;

kind: type === 'handler' ? vscode_languageserver_types_1.CompletionItemKind.Function : vscode_languageserver_types_1.CompletionItemKind.Value,
documentation: description,
textEdit: vscode_languageserver_types_1.TextEdit.replace(range, codeSnippet),

@@ -431,3 +432,3 @@ insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet,

var node = htmlDocument.findNodeBefore(offset);
if (node && node.tag && !htmlTags_1.isEmptyElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) {
if (node && node.tag && !languageFacts_1.isEmptyElement(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) {
var scanner = htmlScanner_1.createScanner(document.getText(), node.start);

@@ -434,0 +435,0 @@ var token = scanner.scan();

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "vscode-languageserver-types", "../htmlLanguageTypes", "../parser/htmlScanner", "../parser/htmlTags"], factory);
define(["require", "exports", "vscode-languageserver-types", "../htmlLanguageTypes", "../parser/htmlScanner", "../languageFacts"], factory);
}

@@ -20,3 +20,3 @@ })(function (require, exports) {

var htmlScanner_1 = require("../parser/htmlScanner");
var htmlTags_1 = require("../parser/htmlTags");
var languageFacts_1 = require("../languageFacts");
function limitRanges(ranges, rangeLimit) {

@@ -117,3 +117,3 @@ ranges = ranges.sort(function (r1, r2) {

case htmlLanguageTypes_1.TokenType.StartTagClose:
if (!lastTagName || !htmlTags_1.isEmptyElement(lastTagName)) {
if (!lastTagName || !languageFacts_1.isEmptyElement(lastTagName)) {
break;

@@ -120,0 +120,0 @@ }

@@ -7,3 +7,3 @@ (function (factory) {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../parser/htmlScanner", "vscode-languageserver-types", "./tagProviders", "../htmlLanguageTypes"], factory);
define(["require", "exports", "../parser/htmlScanner", "vscode-languageserver-types", "../languageFacts", "../htmlLanguageTypes"], factory);
}

@@ -19,3 +19,3 @@ })(function (require, exports) {

var vscode_languageserver_types_1 = require("vscode-languageserver-types");
var tagProviders_1 = require("./tagProviders");
var languageFacts_1 = require("../languageFacts");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");

@@ -28,3 +28,3 @@ function doHover(document, position, htmlDocument) {

}
var tagProviders = tagProviders_1.getAllTagProviders().filter(function (p) { return p.isApplicable(document.languageId); });
var tagProviders = languageFacts_1.getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId); });
function getTagHover(tag, range, open) {

@@ -34,6 +34,7 @@ tag = tag.toLowerCase();

var hover = null;
provider.collectTags(function (t, label) {
provider.collectTags(function (t, description) {
if (description === void 0) { description = ''; }
if (t === tag) {
var tagLabel = open ? '<' + tag + '>' : '</' + tag + '>';
hover = { contents: [{ language: 'html', value: tagLabel }, vscode_languageserver_types_1.MarkedString.fromPlainText(label)], range: range };
hover = { contents: [{ language: 'html', value: tagLabel }, vscode_languageserver_types_1.MarkedString.fromPlainText(description)], range: range };
}

@@ -45,4 +46,4 @@ });

};
for (var _i = 0, tagProviders_2 = tagProviders; _i < tagProviders_2.length; _i++) {
var provider = tagProviders_2[_i];
for (var _i = 0, tagProviders_1 = tagProviders; _i < tagProviders_1.length; _i++) {
var provider = tagProviders_1[_i];
var state_1 = _loop_1(provider);

@@ -49,0 +50,0 @@ if (typeof state_1 === "object")

{
"name": "vscode-html-languageservice",
"version": "2.1.11-next.2",
"version": "2.1.11-next.3",
"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