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.2 to 2.1.3-next.1

lib/esm/htmlLanguageTypes.d.ts

4

CHANGELOG.md

@@ -0,1 +1,5 @@

2.1.3 / 2018-04-16
==================
* Added API `htmlLanguageService.getFoldingRanges` returning folding ranges for the given document
2.1.0 / 2018-03-08

@@ -2,0 +6,0 @@ ==================

109

lib/esm/htmlLanguageService.d.ts

@@ -1,103 +0,5 @@

import { TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, DocumentHighlight, FormattingOptions, MarkedString, DocumentLink } from 'vscode-languageserver-types';
export { TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, DocumentHighlight, FormattingOptions, MarkedString, DocumentLink };
export interface HTMLFormatConfiguration {
tabSize?: number;
insertSpaces?: boolean;
wrapLineLength?: number;
unformatted?: string;
contentUnformatted?: string;
indentInnerHtml?: boolean;
wrapAttributes?: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
preserveNewLines?: boolean;
maxPreserveNewLines?: number;
indentHandlebars?: boolean;
endWithNewline?: boolean;
extraLiners?: string;
}
export interface CompletionConfiguration {
[provider: string]: boolean | undefined;
hideAutoCompleteProposals?: boolean;
}
export interface Node {
tag: string | undefined;
start: number;
end: number;
endTagStart: number | undefined;
children: Node[];
parent?: Node;
attributes?: {
[name: string]: string | null;
} | undefined;
}
export declare enum TokenType {
StartCommentTag = 0,
Comment = 1,
EndCommentTag = 2,
StartTagOpen = 3,
StartTagClose = 4,
StartTagSelfClose = 5,
StartTag = 6,
EndTagOpen = 7,
EndTagClose = 8,
EndTag = 9,
DelimiterAssign = 10,
AttributeName = 11,
AttributeValue = 12,
StartDoctypeTag = 13,
Doctype = 14,
EndDoctypeTag = 15,
Content = 16,
Whitespace = 17,
Unknown = 18,
Script = 19,
Styles = 20,
EOS = 21,
}
export declare enum ScannerState {
WithinContent = 0,
AfterOpeningStartTag = 1,
AfterOpeningEndTag = 2,
WithinDoctype = 3,
WithinTag = 4,
WithinEndTag = 5,
WithinComment = 6,
WithinScriptContent = 7,
WithinStyleContent = 8,
AfterAttributeName = 9,
BeforeAttributeValue = 10,
}
export interface Scanner {
scan(): TokenType;
getTokenType(): TokenType;
getTokenOffset(): number;
getTokenLength(): number;
getTokenEnd(): number;
getTokenText(): string;
getTokenError(): string | undefined;
getScannerState(): ScannerState;
}
export declare type HTMLDocument = {
roots: Node[];
findNodeBefore(offset: number): Node;
findNodeAt(offset: number): Node;
};
export interface DocumentContext {
resolveReference(ref: string, base?: string): string;
}
export interface HtmlAttributeValueContext {
document: TextDocument;
position: Position;
tag: string;
attribute: string;
value: string;
range: Range;
}
export interface HtmlContentContext {
document: TextDocument;
position: Position;
}
export interface ICompletionParticipant {
onHtmlAttributeValue?: (context: HtmlAttributeValueContext) => void;
onHtmlContent?: (context: HtmlContentContext) => void;
}
import { TextDocument, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink } from 'vscode-languageserver-types';
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, FoldingRangeList } from './htmlLanguageTypes';
export * from './htmlLanguageTypes';
export * from 'vscode-languageserver-types';
export interface LanguageService {

@@ -114,3 +16,6 @@ createScanner(input: string, initialOffset?: number): Scanner;

doTagComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument): string | null;
getFoldingRanges(document: TextDocument, context?: {
maxRanges?: number;
}): FoldingRangeList;
}
export declare function getLanguageService(): LanguageService;

@@ -14,43 +14,5 @@ /*---------------------------------------------------------------------------------------------

import { findDocumentSymbols } from './services/htmlSymbolsProvider';
import { TextDocument, Position, CompletionItem, CompletionList, Range, SymbolInformation, Diagnostic, TextEdit, DocumentHighlight, FormattingOptions, MarkedString, DocumentLink } from 'vscode-languageserver-types';
export { TextDocument, Position, CompletionItem, CompletionList, Range, SymbolInformation, Diagnostic, TextEdit, DocumentHighlight, FormattingOptions, MarkedString, DocumentLink };
export var TokenType;
(function (TokenType) {
TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag";
TokenType[TokenType["Comment"] = 1] = "Comment";
TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag";
TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen";
TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose";
TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose";
TokenType[TokenType["StartTag"] = 6] = "StartTag";
TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen";
TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose";
TokenType[TokenType["EndTag"] = 9] = "EndTag";
TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign";
TokenType[TokenType["AttributeName"] = 11] = "AttributeName";
TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue";
TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag";
TokenType[TokenType["Doctype"] = 14] = "Doctype";
TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag";
TokenType[TokenType["Content"] = 16] = "Content";
TokenType[TokenType["Whitespace"] = 17] = "Whitespace";
TokenType[TokenType["Unknown"] = 18] = "Unknown";
TokenType[TokenType["Script"] = 19] = "Script";
TokenType[TokenType["Styles"] = 20] = "Styles";
TokenType[TokenType["EOS"] = 21] = "EOS";
})(TokenType || (TokenType = {}));
export var ScannerState;
(function (ScannerState) {
ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent";
ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag";
ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag";
ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype";
ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag";
ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag";
ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment";
ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent";
ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent";
ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName";
ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue";
})(ScannerState || (ScannerState = {}));
import { getFoldingRanges } from './services/htmlFolding';
export * from './htmlLanguageTypes';
export * from 'vscode-languageserver-types';
export function getLanguageService() {

@@ -68,2 +30,3 @@ var htmlCompletion = new HTMLCompletion();

findDocumentSymbols: findDocumentSymbols,
getFoldingRanges: getFoldingRanges,
doTagComplete: htmlCompletion.doTagComplete.bind(htmlCompletion),

@@ -70,0 +33,0 @@ };

@@ -6,5 +6,6 @@ /*---------------------------------------------------------------------------------------------

'use strict';
import { TokenType, createScanner } from './htmlScanner';
import { createScanner } from './htmlScanner';
import { findFirst } from '../utils/arrays';
import { isEmptyElement } from './htmlTags';
import { TokenType } from '../htmlLanguageTypes';
var Node = /** @class */ (function () {

@@ -11,0 +12,0 @@ function Node(start, end, children, parent) {

@@ -1,48 +0,2 @@

export declare enum TokenType {
StartCommentTag = 0,
Comment = 1,
EndCommentTag = 2,
StartTagOpen = 3,
StartTagClose = 4,
StartTagSelfClose = 5,
StartTag = 6,
EndTagOpen = 7,
EndTagClose = 8,
EndTag = 9,
DelimiterAssign = 10,
AttributeName = 11,
AttributeValue = 12,
StartDoctypeTag = 13,
Doctype = 14,
EndDoctypeTag = 15,
Content = 16,
Whitespace = 17,
Unknown = 18,
Script = 19,
Styles = 20,
EOS = 21,
}
export declare enum ScannerState {
WithinContent = 0,
AfterOpeningStartTag = 1,
AfterOpeningEndTag = 2,
WithinDoctype = 3,
WithinTag = 4,
WithinEndTag = 5,
WithinComment = 6,
WithinScriptContent = 7,
WithinStyleContent = 8,
AfterAttributeName = 9,
BeforeAttributeValue = 10,
}
export interface Scanner {
scan(): TokenType;
getTokenType(): TokenType;
getTokenOffset(): number;
getTokenLength(): number;
getTokenEnd(): number;
getTokenText(): string;
getTokenError(): string | undefined;
getScannerState(): ScannerState;
}
import { ScannerState, Scanner } from '../htmlLanguageService';
export declare function createScanner(input: string, initialOffset?: number, initialState?: ScannerState): Scanner;

@@ -7,28 +7,4 @@ /*---------------------------------------------------------------------------------------------

import * as nls from 'vscode-nls';
import { TokenType, ScannerState } from '../htmlLanguageService';
var localize = nls.loadMessageBundle();
export var TokenType;
(function (TokenType) {
TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag";
TokenType[TokenType["Comment"] = 1] = "Comment";
TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag";
TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen";
TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose";
TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose";
TokenType[TokenType["StartTag"] = 6] = "StartTag";
TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen";
TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose";
TokenType[TokenType["EndTag"] = 9] = "EndTag";
TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign";
TokenType[TokenType["AttributeName"] = 11] = "AttributeName";
TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue";
TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag";
TokenType[TokenType["Doctype"] = 14] = "Doctype";
TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag";
TokenType[TokenType["Content"] = 16] = "Content";
TokenType[TokenType["Whitespace"] = 17] = "Whitespace";
TokenType[TokenType["Unknown"] = 18] = "Unknown";
TokenType[TokenType["Script"] = 19] = "Script";
TokenType[TokenType["Styles"] = 20] = "Styles";
TokenType[TokenType["EOS"] = 21] = "EOS";
})(TokenType || (TokenType = {}));
var MultiLineStream = /** @class */ (function () {

@@ -159,16 +135,2 @@ function MultiLineStream(source, position) {

var _TAB = '\t'.charCodeAt(0);
export var ScannerState;
(function (ScannerState) {
ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent";
ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag";
ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag";
ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype";
ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag";
ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag";
ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment";
ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent";
ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent";
ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName";
ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue";
})(ScannerState || (ScannerState = {}));
var htmlScriptContents = {

@@ -175,0 +137,0 @@ 'text/x-handlebars-template': true

@@ -7,5 +7,6 @@ /*---------------------------------------------------------------------------------------------

import { Position, CompletionItemKind, Range, TextEdit, InsertTextFormat } from 'vscode-languageserver-types';
import { TokenType, createScanner, ScannerState } from '../parser/htmlScanner';
import { createScanner } from '../parser/htmlScanner';
import { isEmptyElement } from '../parser/htmlTags';
import { allTagProviders } from './tagProviders';
import { ScannerState, TokenType } from '../htmlLanguageTypes';
import { entities } from '../parser/htmlEntities';

@@ -12,0 +13,0 @@ import * as nls from 'vscode-nls';

@@ -6,4 +6,5 @@ /*---------------------------------------------------------------------------------------------

'use strict';
import { TokenType, createScanner } from '../parser/htmlScanner';
import { createScanner } from '../parser/htmlScanner';
import { DocumentHighlightKind } from 'vscode-languageserver-types';
import { TokenType } from '../htmlLanguageTypes';
export function findDocumentHighlights(document, position, htmlDocument) {

@@ -10,0 +11,0 @@ var offset = document.offsetAt(position);

@@ -6,5 +6,6 @@ /*---------------------------------------------------------------------------------------------

'use strict';
import { TokenType, createScanner } from '../parser/htmlScanner';
import { createScanner } from '../parser/htmlScanner';
import { MarkedString } from 'vscode-languageserver-types';
import { allTagProviders } from './tagProviders';
import { TokenType } from '../htmlLanguageTypes';
export function doHover(document, position, htmlDocument) {

@@ -11,0 +12,0 @@ var offset = document.offsetAt(position);

@@ -6,6 +6,7 @@ /*---------------------------------------------------------------------------------------------

'use strict';
import { TokenType, createScanner } from '../parser/htmlScanner';
import { createScanner } from '../parser/htmlScanner';
import { Range } from 'vscode-languageserver-types';
import * as strings from '../utils/strings';
import Uri from 'vscode-uri';
import { TokenType } from '../htmlLanguageTypes';
function normalizeRef(url, languageId) {

@@ -12,0 +13,0 @@ var first = url[0];

@@ -1,103 +0,5 @@

import { TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, DocumentHighlight, FormattingOptions, MarkedString, DocumentLink } from 'vscode-languageserver-types';
export { TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, DocumentHighlight, FormattingOptions, MarkedString, DocumentLink };
export interface HTMLFormatConfiguration {
tabSize?: number;
insertSpaces?: boolean;
wrapLineLength?: number;
unformatted?: string;
contentUnformatted?: string;
indentInnerHtml?: boolean;
wrapAttributes?: 'auto' | 'force' | 'force-aligned' | 'force-expand-multiline';
preserveNewLines?: boolean;
maxPreserveNewLines?: number;
indentHandlebars?: boolean;
endWithNewline?: boolean;
extraLiners?: string;
}
export interface CompletionConfiguration {
[provider: string]: boolean | undefined;
hideAutoCompleteProposals?: boolean;
}
export interface Node {
tag: string | undefined;
start: number;
end: number;
endTagStart: number | undefined;
children: Node[];
parent?: Node;
attributes?: {
[name: string]: string | null;
} | undefined;
}
export declare enum TokenType {
StartCommentTag = 0,
Comment = 1,
EndCommentTag = 2,
StartTagOpen = 3,
StartTagClose = 4,
StartTagSelfClose = 5,
StartTag = 6,
EndTagOpen = 7,
EndTagClose = 8,
EndTag = 9,
DelimiterAssign = 10,
AttributeName = 11,
AttributeValue = 12,
StartDoctypeTag = 13,
Doctype = 14,
EndDoctypeTag = 15,
Content = 16,
Whitespace = 17,
Unknown = 18,
Script = 19,
Styles = 20,
EOS = 21,
}
export declare enum ScannerState {
WithinContent = 0,
AfterOpeningStartTag = 1,
AfterOpeningEndTag = 2,
WithinDoctype = 3,
WithinTag = 4,
WithinEndTag = 5,
WithinComment = 6,
WithinScriptContent = 7,
WithinStyleContent = 8,
AfterAttributeName = 9,
BeforeAttributeValue = 10,
}
export interface Scanner {
scan(): TokenType;
getTokenType(): TokenType;
getTokenOffset(): number;
getTokenLength(): number;
getTokenEnd(): number;
getTokenText(): string;
getTokenError(): string | undefined;
getScannerState(): ScannerState;
}
export declare type HTMLDocument = {
roots: Node[];
findNodeBefore(offset: number): Node;
findNodeAt(offset: number): Node;
};
export interface DocumentContext {
resolveReference(ref: string, base?: string): string;
}
export interface HtmlAttributeValueContext {
document: TextDocument;
position: Position;
tag: string;
attribute: string;
value: string;
range: Range;
}
export interface HtmlContentContext {
document: TextDocument;
position: Position;
}
export interface ICompletionParticipant {
onHtmlAttributeValue?: (context: HtmlAttributeValueContext) => void;
onHtmlContent?: (context: HtmlContentContext) => void;
}
import { TextDocument, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink } from 'vscode-languageserver-types';
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, FoldingRangeList } from './htmlLanguageTypes';
export * from './htmlLanguageTypes';
export * from 'vscode-languageserver-types';
export interface LanguageService {

@@ -114,3 +16,6 @@ createScanner(input: string, initialOffset?: number): Scanner;

doTagComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument): string | null;
getFoldingRanges(document: TextDocument, context?: {
maxRanges?: number;
}): FoldingRangeList;
}
export declare function getLanguageService(): 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", "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", "./htmlLanguageTypes", "vscode-languageserver-types"], factory);
}

@@ -16,2 +16,5 @@ })(function (require, exports) {

'use strict';
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });

@@ -26,54 +29,5 @@ var htmlScanner_1 = require("./parser/htmlScanner");

var htmlSymbolsProvider_1 = require("./services/htmlSymbolsProvider");
var vscode_languageserver_types_1 = require("vscode-languageserver-types");
exports.TextDocument = vscode_languageserver_types_1.TextDocument;
exports.Position = vscode_languageserver_types_1.Position;
exports.CompletionItem = vscode_languageserver_types_1.CompletionItem;
exports.CompletionList = vscode_languageserver_types_1.CompletionList;
exports.Range = vscode_languageserver_types_1.Range;
exports.SymbolInformation = vscode_languageserver_types_1.SymbolInformation;
exports.Diagnostic = vscode_languageserver_types_1.Diagnostic;
exports.TextEdit = vscode_languageserver_types_1.TextEdit;
exports.DocumentHighlight = vscode_languageserver_types_1.DocumentHighlight;
exports.FormattingOptions = vscode_languageserver_types_1.FormattingOptions;
exports.MarkedString = vscode_languageserver_types_1.MarkedString;
exports.DocumentLink = vscode_languageserver_types_1.DocumentLink;
var TokenType;
(function (TokenType) {
TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag";
TokenType[TokenType["Comment"] = 1] = "Comment";
TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag";
TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen";
TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose";
TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose";
TokenType[TokenType["StartTag"] = 6] = "StartTag";
TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen";
TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose";
TokenType[TokenType["EndTag"] = 9] = "EndTag";
TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign";
TokenType[TokenType["AttributeName"] = 11] = "AttributeName";
TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue";
TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag";
TokenType[TokenType["Doctype"] = 14] = "Doctype";
TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag";
TokenType[TokenType["Content"] = 16] = "Content";
TokenType[TokenType["Whitespace"] = 17] = "Whitespace";
TokenType[TokenType["Unknown"] = 18] = "Unknown";
TokenType[TokenType["Script"] = 19] = "Script";
TokenType[TokenType["Styles"] = 20] = "Styles";
TokenType[TokenType["EOS"] = 21] = "EOS";
})(TokenType = exports.TokenType || (exports.TokenType = {}));
var ScannerState;
(function (ScannerState) {
ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent";
ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag";
ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag";
ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype";
ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag";
ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag";
ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment";
ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent";
ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent";
ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName";
ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue";
})(ScannerState = exports.ScannerState || (exports.ScannerState = {}));
var htmlFolding_1 = require("./services/htmlFolding");
__export(require("./htmlLanguageTypes"));
__export(require("vscode-languageserver-types"));
function getLanguageService() {

@@ -91,2 +45,3 @@ var htmlCompletion = new htmlCompletion_1.HTMLCompletion();

findDocumentSymbols: htmlSymbolsProvider_1.findDocumentSymbols,
getFoldingRanges: htmlFolding_1.getFoldingRanges,
doTagComplete: htmlCompletion.doTagComplete.bind(htmlCompletion),

@@ -93,0 +48,0 @@ };

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

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

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

var htmlTags_1 = require("./htmlTags");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");
var Node = /** @class */ (function () {

@@ -84,5 +85,5 @@ function Node(start, end, children, parent) {

var token = scanner.scan();
while (token !== htmlScanner_1.TokenType.EOS) {
while (token !== htmlLanguageTypes_1.TokenType.EOS) {
switch (token) {
case htmlScanner_1.TokenType.StartTagOpen:
case htmlLanguageTypes_1.TokenType.StartTagOpen:
var child = new Node(scanner.getTokenOffset(), text.length, [], curr);

@@ -92,6 +93,6 @@ curr.children.push(child);

break;
case htmlScanner_1.TokenType.StartTag:
case htmlLanguageTypes_1.TokenType.StartTag:
curr.tag = scanner.getTokenText();
break;
case htmlScanner_1.TokenType.StartTagClose:
case htmlLanguageTypes_1.TokenType.StartTagClose:
curr.end = scanner.getTokenEnd(); // might be later set to end tag position

@@ -103,6 +104,6 @@ if (curr.tag && htmlTags_1.isEmptyElement(curr.tag) && curr.parent) {

break;
case htmlScanner_1.TokenType.EndTagOpen:
case htmlLanguageTypes_1.TokenType.EndTagOpen:
endTagStart = scanner.getTokenOffset();
break;
case htmlScanner_1.TokenType.EndTag:
case htmlLanguageTypes_1.TokenType.EndTag:
var closeTag = scanner.getTokenText().toLowerCase();

@@ -119,3 +120,3 @@ while (!curr.isSameTag(closeTag) && curr.parent) {

break;
case htmlScanner_1.TokenType.StartTagSelfClose:
case htmlLanguageTypes_1.TokenType.StartTagSelfClose:
if (curr.parent) {

@@ -127,3 +128,3 @@ curr.closed = true;

break;
case htmlScanner_1.TokenType.EndTagClose:
case htmlLanguageTypes_1.TokenType.EndTagClose:
if (curr.parent) {

@@ -134,3 +135,3 @@ curr.end = scanner.getTokenEnd();

break;
case htmlScanner_1.TokenType.AttributeName: {
case htmlLanguageTypes_1.TokenType.AttributeName: {
var attributeName = pendingAttribute = scanner.getTokenText();

@@ -144,3 +145,3 @@ var attributes = curr.attributes;

}
case htmlScanner_1.TokenType.AttributeValue: {
case htmlLanguageTypes_1.TokenType.AttributeValue: {
var value = scanner.getTokenText();

@@ -147,0 +148,0 @@ var attributes = curr.attributes;

@@ -1,48 +0,2 @@

export declare enum TokenType {
StartCommentTag = 0,
Comment = 1,
EndCommentTag = 2,
StartTagOpen = 3,
StartTagClose = 4,
StartTagSelfClose = 5,
StartTag = 6,
EndTagOpen = 7,
EndTagClose = 8,
EndTag = 9,
DelimiterAssign = 10,
AttributeName = 11,
AttributeValue = 12,
StartDoctypeTag = 13,
Doctype = 14,
EndDoctypeTag = 15,
Content = 16,
Whitespace = 17,
Unknown = 18,
Script = 19,
Styles = 20,
EOS = 21,
}
export declare enum ScannerState {
WithinContent = 0,
AfterOpeningStartTag = 1,
AfterOpeningEndTag = 2,
WithinDoctype = 3,
WithinTag = 4,
WithinEndTag = 5,
WithinComment = 6,
WithinScriptContent = 7,
WithinStyleContent = 8,
AfterAttributeName = 9,
BeforeAttributeValue = 10,
}
export interface Scanner {
scan(): TokenType;
getTokenType(): TokenType;
getTokenOffset(): number;
getTokenLength(): number;
getTokenEnd(): number;
getTokenText(): string;
getTokenError(): string | undefined;
getScannerState(): ScannerState;
}
import { ScannerState, Scanner } from '../htmlLanguageService';
export declare function createScanner(input: string, initialOffset?: number, initialState?: ScannerState): Scanner;

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

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "vscode-nls"], factory);
define(["require", "exports", "vscode-nls", "../htmlLanguageService"], factory);
}

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

var nls = require("vscode-nls");
var htmlLanguageService_1 = require("../htmlLanguageService");
var localize = nls.loadMessageBundle();
var TokenType;
(function (TokenType) {
TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag";
TokenType[TokenType["Comment"] = 1] = "Comment";
TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag";
TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen";
TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose";
TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose";
TokenType[TokenType["StartTag"] = 6] = "StartTag";
TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen";
TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose";
TokenType[TokenType["EndTag"] = 9] = "EndTag";
TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign";
TokenType[TokenType["AttributeName"] = 11] = "AttributeName";
TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue";
TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag";
TokenType[TokenType["Doctype"] = 14] = "Doctype";
TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag";
TokenType[TokenType["Content"] = 16] = "Content";
TokenType[TokenType["Whitespace"] = 17] = "Whitespace";
TokenType[TokenType["Unknown"] = 18] = "Unknown";
TokenType[TokenType["Script"] = 19] = "Script";
TokenType[TokenType["Styles"] = 20] = "Styles";
TokenType[TokenType["EOS"] = 21] = "EOS";
})(TokenType = exports.TokenType || (exports.TokenType = {}));
var MultiLineStream = /** @class */ (function () {

@@ -170,16 +146,2 @@ function MultiLineStream(source, position) {

var _TAB = '\t'.charCodeAt(0);
var ScannerState;
(function (ScannerState) {
ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent";
ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag";
ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag";
ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype";
ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag";
ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag";
ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment";
ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent";
ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent";
ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName";
ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue";
})(ScannerState = exports.ScannerState || (exports.ScannerState = {}));
var htmlScriptContents = {

@@ -190,7 +152,7 @@ 'text/x-handlebars-template': true

if (initialOffset === void 0) { initialOffset = 0; }
if (initialState === void 0) { initialState = ScannerState.WithinContent; }
if (initialState === void 0) { initialState = htmlLanguageService_1.ScannerState.WithinContent; }
var stream = new MultiLineStream(input, initialOffset);
var state = initialState;
var tokenOffset = 0;
var tokenType = TokenType.Unknown;
var tokenType = htmlLanguageService_1.TokenType.Unknown;
var tokenError;

@@ -217,6 +179,6 @@ var hasSpaceAfterTag;

var token = internalScan();
if (token !== TokenType.EOS && offset === stream.pos()) {
if (token !== htmlLanguageService_1.TokenType.EOS && offset === stream.pos()) {
console.log('Scanner.scan has not advanced at offset ' + offset + ', state before: ' + oldState + ' after: ' + state);
stream.advance(1);
return finishToken(offset, TokenType.Unknown);
return finishToken(offset, htmlLanguageService_1.TokenType.Unknown);
}

@@ -228,67 +190,67 @@ return token;

if (stream.eos()) {
return finishToken(offset, TokenType.EOS);
return finishToken(offset, htmlLanguageService_1.TokenType.EOS);
}
var errorMessage;
switch (state) {
case ScannerState.WithinComment:
case htmlLanguageService_1.ScannerState.WithinComment:
if (stream.advanceIfChars([_MIN, _MIN, _RAN])) {
state = ScannerState.WithinContent;
return finishToken(offset, TokenType.EndCommentTag);
state = htmlLanguageService_1.ScannerState.WithinContent;
return finishToken(offset, htmlLanguageService_1.TokenType.EndCommentTag);
}
stream.advanceUntilChars([_MIN, _MIN, _RAN]); // -->
return finishToken(offset, TokenType.Comment);
case ScannerState.WithinDoctype:
return finishToken(offset, htmlLanguageService_1.TokenType.Comment);
case htmlLanguageService_1.ScannerState.WithinDoctype:
if (stream.advanceIfChar(_RAN)) {
state = ScannerState.WithinContent;
return finishToken(offset, TokenType.EndDoctypeTag);
state = htmlLanguageService_1.ScannerState.WithinContent;
return finishToken(offset, htmlLanguageService_1.TokenType.EndDoctypeTag);
}
stream.advanceUntilChar(_RAN); // >
return finishToken(offset, TokenType.Doctype);
case ScannerState.WithinContent:
return finishToken(offset, htmlLanguageService_1.TokenType.Doctype);
case htmlLanguageService_1.ScannerState.WithinContent:
if (stream.advanceIfChar(_LAN)) {
if (!stream.eos() && stream.peekChar() === _BNG) {
if (stream.advanceIfChars([_BNG, _MIN, _MIN])) {
state = ScannerState.WithinComment;
return finishToken(offset, TokenType.StartCommentTag);
state = htmlLanguageService_1.ScannerState.WithinComment;
return finishToken(offset, htmlLanguageService_1.TokenType.StartCommentTag);
}
if (stream.advanceIfRegExp(/^!doctype/i)) {
state = ScannerState.WithinDoctype;
return finishToken(offset, TokenType.StartDoctypeTag);
state = htmlLanguageService_1.ScannerState.WithinDoctype;
return finishToken(offset, htmlLanguageService_1.TokenType.StartDoctypeTag);
}
}
if (stream.advanceIfChar(_FSL)) {
state = ScannerState.AfterOpeningEndTag;
return finishToken(offset, TokenType.EndTagOpen);
state = htmlLanguageService_1.ScannerState.AfterOpeningEndTag;
return finishToken(offset, htmlLanguageService_1.TokenType.EndTagOpen);
}
state = ScannerState.AfterOpeningStartTag;
return finishToken(offset, TokenType.StartTagOpen);
state = htmlLanguageService_1.ScannerState.AfterOpeningStartTag;
return finishToken(offset, htmlLanguageService_1.TokenType.StartTagOpen);
}
stream.advanceUntilChar(_LAN);
return finishToken(offset, TokenType.Content);
case ScannerState.AfterOpeningEndTag:
return finishToken(offset, htmlLanguageService_1.TokenType.Content);
case htmlLanguageService_1.ScannerState.AfterOpeningEndTag:
var tagName = nextElementName();
if (tagName.length > 0) {
state = ScannerState.WithinEndTag;
return finishToken(offset, TokenType.EndTag);
state = htmlLanguageService_1.ScannerState.WithinEndTag;
return finishToken(offset, htmlLanguageService_1.TokenType.EndTag);
}
if (stream.skipWhitespace()) {
return finishToken(offset, TokenType.Whitespace, localize('error.unexpectedWhitespace', 'Tag name must directly follow the open bracket.'));
return finishToken(offset, htmlLanguageService_1.TokenType.Whitespace, localize('error.unexpectedWhitespace', 'Tag name must directly follow the open bracket.'));
}
state = ScannerState.WithinEndTag;
state = htmlLanguageService_1.ScannerState.WithinEndTag;
stream.advanceUntilChar(_RAN);
if (offset < stream.pos()) {
return finishToken(offset, TokenType.Unknown, localize('error.endTagNameExpected', 'End tag name expected.'));
return finishToken(offset, htmlLanguageService_1.TokenType.Unknown, localize('error.endTagNameExpected', 'End tag name expected.'));
}
return internalScan();
case ScannerState.WithinEndTag:
case htmlLanguageService_1.ScannerState.WithinEndTag:
if (stream.skipWhitespace()) {
return finishToken(offset, TokenType.Whitespace);
return finishToken(offset, htmlLanguageService_1.TokenType.Whitespace);
}
if (stream.advanceIfChar(_RAN)) {
state = ScannerState.WithinContent;
return finishToken(offset, TokenType.EndTagClose);
state = htmlLanguageService_1.ScannerState.WithinContent;
return finishToken(offset, htmlLanguageService_1.TokenType.EndTagClose);
}
errorMessage = localize('error.tagNameExpected', 'Closing bracket expected.');
break;
case ScannerState.AfterOpeningStartTag:
case htmlLanguageService_1.ScannerState.AfterOpeningStartTag:
lastTag = nextElementName();

@@ -299,18 +261,18 @@ lastTypeValue = void 0;

hasSpaceAfterTag = false;
state = ScannerState.WithinTag;
return finishToken(offset, TokenType.StartTag);
state = htmlLanguageService_1.ScannerState.WithinTag;
return finishToken(offset, htmlLanguageService_1.TokenType.StartTag);
}
if (stream.skipWhitespace()) {
return finishToken(offset, TokenType.Whitespace, localize('error.unexpectedWhitespace', 'Tag name must directly follow the open bracket.'));
return finishToken(offset, htmlLanguageService_1.TokenType.Whitespace, localize('error.unexpectedWhitespace', 'Tag name must directly follow the open bracket.'));
}
state = ScannerState.WithinTag;
state = htmlLanguageService_1.ScannerState.WithinTag;
stream.advanceUntilChar(_RAN);
if (offset < stream.pos()) {
return finishToken(offset, TokenType.Unknown, localize('error.startTagNameExpected', 'Start tag name expected.'));
return finishToken(offset, htmlLanguageService_1.TokenType.Unknown, localize('error.startTagNameExpected', 'Start tag name expected.'));
}
return internalScan();
case ScannerState.WithinTag:
case htmlLanguageService_1.ScannerState.WithinTag:
if (stream.skipWhitespace()) {
hasSpaceAfterTag = true; // remember that we have seen a whitespace
return finishToken(offset, TokenType.Whitespace);
return finishToken(offset, htmlLanguageService_1.TokenType.Whitespace);
}

@@ -320,10 +282,10 @@ if (hasSpaceAfterTag) {

if (lastAttributeName.length > 0) {
state = ScannerState.AfterAttributeName;
state = htmlLanguageService_1.ScannerState.AfterAttributeName;
hasSpaceAfterTag = false;
return finishToken(offset, TokenType.AttributeName);
return finishToken(offset, htmlLanguageService_1.TokenType.AttributeName);
}
}
if (stream.advanceIfChars([_FSL, _RAN])) {
state = ScannerState.WithinContent;
return finishToken(offset, TokenType.StartTagSelfClose);
state = htmlLanguageService_1.ScannerState.WithinContent;
return finishToken(offset, htmlLanguageService_1.TokenType.StartTagSelfClose);
}

@@ -334,32 +296,32 @@ if (stream.advanceIfChar(_RAN)) {

// stay in html
state = ScannerState.WithinContent;
state = htmlLanguageService_1.ScannerState.WithinContent;
}
else {
state = ScannerState.WithinScriptContent;
state = htmlLanguageService_1.ScannerState.WithinScriptContent;
}
}
else if (lastTag === 'style') {
state = ScannerState.WithinStyleContent;
state = htmlLanguageService_1.ScannerState.WithinStyleContent;
}
else {
state = ScannerState.WithinContent;
state = htmlLanguageService_1.ScannerState.WithinContent;
}
return finishToken(offset, TokenType.StartTagClose);
return finishToken(offset, htmlLanguageService_1.TokenType.StartTagClose);
}
stream.advance(1);
return finishToken(offset, TokenType.Unknown, localize('error.unexpectedCharacterInTag', 'Unexpected character in tag.'));
case ScannerState.AfterAttributeName:
return finishToken(offset, htmlLanguageService_1.TokenType.Unknown, localize('error.unexpectedCharacterInTag', 'Unexpected character in tag.'));
case htmlLanguageService_1.ScannerState.AfterAttributeName:
if (stream.skipWhitespace()) {
hasSpaceAfterTag = true;
return finishToken(offset, TokenType.Whitespace);
return finishToken(offset, htmlLanguageService_1.TokenType.Whitespace);
}
if (stream.advanceIfChar(_EQS)) {
state = ScannerState.BeforeAttributeValue;
return finishToken(offset, TokenType.DelimiterAssign);
state = htmlLanguageService_1.ScannerState.BeforeAttributeValue;
return finishToken(offset, htmlLanguageService_1.TokenType.DelimiterAssign);
}
state = ScannerState.WithinTag;
state = htmlLanguageService_1.ScannerState.WithinTag;
return internalScan(); // no advance yet - jump to WithinTag
case ScannerState.BeforeAttributeValue:
case htmlLanguageService_1.ScannerState.BeforeAttributeValue:
if (stream.skipWhitespace()) {
return finishToken(offset, TokenType.Whitespace);
return finishToken(offset, htmlLanguageService_1.TokenType.Whitespace);
}

@@ -371,5 +333,5 @@ var attributeValue = stream.advanceIfRegExp(/^[^\s"'`=<>\/]+/);

}
state = ScannerState.WithinTag;
state = htmlLanguageService_1.ScannerState.WithinTag;
hasSpaceAfterTag = false;
return finishToken(offset, TokenType.AttributeValue);
return finishToken(offset, htmlLanguageService_1.TokenType.AttributeValue);
}

@@ -385,10 +347,10 @@ var ch = stream.peekChar();

}
state = ScannerState.WithinTag;
state = htmlLanguageService_1.ScannerState.WithinTag;
hasSpaceAfterTag = false;
return finishToken(offset, TokenType.AttributeValue);
return finishToken(offset, htmlLanguageService_1.TokenType.AttributeValue);
}
state = ScannerState.WithinTag;
state = htmlLanguageService_1.ScannerState.WithinTag;
hasSpaceAfterTag = false;
return internalScan(); // no advance yet - jump to WithinTag
case ScannerState.WithinScriptContent:
case htmlLanguageService_1.ScannerState.WithinScriptContent:
// see http://stackoverflow.com/questions/14574471/how-do-browsers-parse-a-script-tag-exactly

@@ -400,3 +362,3 @@ var sciptState = 1;

stream.goToEnd();
return finishToken(offset, TokenType.Script);
return finishToken(offset, htmlLanguageService_1.TokenType.Script);
}

@@ -426,12 +388,12 @@ else if (match === '<!--') {

}
state = ScannerState.WithinContent;
state = htmlLanguageService_1.ScannerState.WithinContent;
if (offset < stream.pos()) {
return finishToken(offset, TokenType.Script);
return finishToken(offset, htmlLanguageService_1.TokenType.Script);
}
return internalScan(); // no advance yet - jump to content
case ScannerState.WithinStyleContent:
case htmlLanguageService_1.ScannerState.WithinStyleContent:
stream.advanceUntilRegExp(/<\/style/i);
state = ScannerState.WithinContent;
state = htmlLanguageService_1.ScannerState.WithinContent;
if (offset < stream.pos()) {
return finishToken(offset, TokenType.Styles);
return finishToken(offset, htmlLanguageService_1.TokenType.Styles);
}

@@ -441,4 +403,4 @@ return internalScan(); // no advance yet - jump to content

stream.advance(1);
state = ScannerState.WithinContent;
return finishToken(offset, TokenType.Unknown, errorMessage);
state = htmlLanguageService_1.ScannerState.WithinContent;
return finishToken(offset, htmlLanguageService_1.TokenType.Unknown, errorMessage);
}

@@ -445,0 +407,0 @@ return {

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

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

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

var tagProviders_1 = require("./tagProviders");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");
var htmlEntities_1 = require("../parser/htmlEntities");

@@ -88,3 +89,3 @@ var nls = require("vscode-nls");

var range = getReplaceRange(afterOpenBracket, tagNameEnd);
var closeTag = isFollowedBy(text, tagNameEnd, htmlScanner_1.ScannerState.WithinEndTag, htmlScanner_1.TokenType.EndTagClose) ? '' : '>';
var closeTag = isFollowedBy(text, tagNameEnd, htmlLanguageTypes_1.ScannerState.WithinEndTag, htmlLanguageTypes_1.TokenType.EndTagClose) ? '' : '>';
var curr = node;

@@ -161,3 +162,3 @@ if (inOpenTag) {

var range = getReplaceRange(nameStart, replaceEnd);
var value = isFollowedBy(text, nameEnd, htmlScanner_1.ScannerState.AfterAttributeName, htmlScanner_1.TokenType.DelimiterAssign) ? '' : '="$1"';
var value = isFollowedBy(text, nameEnd, htmlLanguageTypes_1.ScannerState.AfterAttributeName, htmlLanguageTypes_1.TokenType.DelimiterAssign) ? '' : '="$1"';
var tag = currentTag.toLowerCase();

@@ -311,11 +312,11 @@ var seenAttributes = Object.create(null);

var token = scanner.scan();
while (token !== htmlScanner_1.TokenType.EOS && scanner.getTokenOffset() <= offset) {
while (token !== htmlLanguageTypes_1.TokenType.EOS && scanner.getTokenOffset() <= offset) {
switch (token) {
case htmlScanner_1.TokenType.StartTagOpen:
case htmlLanguageTypes_1.TokenType.StartTagOpen:
if (scanner.getTokenEnd() === offset) {
var endPos = scanNextForEndPos(htmlScanner_1.TokenType.StartTag);
var endPos = scanNextForEndPos(htmlLanguageTypes_1.TokenType.StartTag);
return collectTagSuggestions(offset, endPos);
}
break;
case htmlScanner_1.TokenType.StartTag:
case htmlLanguageTypes_1.TokenType.StartTag:
if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) {

@@ -326,3 +327,3 @@ return collectOpenTagSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd());

break;
case htmlScanner_1.TokenType.AttributeName:
case htmlLanguageTypes_1.TokenType.AttributeName:
if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) {

@@ -333,9 +334,9 @@ return collectAttributeNameSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd());

break;
case htmlScanner_1.TokenType.DelimiterAssign:
case htmlLanguageTypes_1.TokenType.DelimiterAssign:
if (scanner.getTokenEnd() === offset) {
var endPos = scanNextForEndPos(htmlScanner_1.TokenType.AttributeValue);
var endPos = scanNextForEndPos(htmlLanguageTypes_1.TokenType.AttributeValue);
return collectAttributeValueSuggestions(offset, endPos);
}
break;
case htmlScanner_1.TokenType.AttributeValue:
case htmlLanguageTypes_1.TokenType.AttributeValue:
if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) {

@@ -345,17 +346,17 @@ return collectAttributeValueSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd());

break;
case htmlScanner_1.TokenType.Whitespace:
case htmlLanguageTypes_1.TokenType.Whitespace:
if (offset <= scanner.getTokenEnd()) {
switch (scanner.getScannerState()) {
case htmlScanner_1.ScannerState.AfterOpeningStartTag:
case htmlLanguageTypes_1.ScannerState.AfterOpeningStartTag:
var startPos = scanner.getTokenOffset();
var endTagPos = scanNextForEndPos(htmlScanner_1.TokenType.StartTag);
var endTagPos = scanNextForEndPos(htmlLanguageTypes_1.TokenType.StartTag);
return collectTagSuggestions(startPos, endTagPos);
case htmlScanner_1.ScannerState.WithinTag:
case htmlScanner_1.ScannerState.AfterAttributeName:
case htmlLanguageTypes_1.ScannerState.WithinTag:
case htmlLanguageTypes_1.ScannerState.AfterAttributeName:
return collectAttributeNameSuggestions(scanner.getTokenEnd());
case htmlScanner_1.ScannerState.BeforeAttributeValue:
case htmlLanguageTypes_1.ScannerState.BeforeAttributeValue:
return collectAttributeValueSuggestions(scanner.getTokenEnd());
case htmlScanner_1.ScannerState.AfterOpeningEndTag:
case htmlLanguageTypes_1.ScannerState.AfterOpeningEndTag:
return collectCloseTagSuggestions(scanner.getTokenOffset() - 1, false);
case htmlScanner_1.ScannerState.WithinContent:
case htmlLanguageTypes_1.ScannerState.WithinContent:
return collectInsideContent();

@@ -365,10 +366,10 @@ }

break;
case htmlScanner_1.TokenType.EndTagOpen:
case htmlLanguageTypes_1.TokenType.EndTagOpen:
if (offset <= scanner.getTokenEnd()) {
var afterOpenBracket = scanner.getTokenOffset() + 1;
var endOffset = scanNextForEndPos(htmlScanner_1.TokenType.EndTag);
var endOffset = scanNextForEndPos(htmlLanguageTypes_1.TokenType.EndTag);
return collectCloseTagSuggestions(afterOpenBracket, false, endOffset);
}
break;
case htmlScanner_1.TokenType.EndTag:
case htmlLanguageTypes_1.TokenType.EndTag:
if (offset <= scanner.getTokenEnd()) {

@@ -388,3 +389,3 @@ var start = scanner.getTokenOffset() - 1;

break;
case htmlScanner_1.TokenType.StartTagClose:
case htmlLanguageTypes_1.TokenType.StartTagClose:
if (offset <= scanner.getTokenEnd()) {

@@ -396,3 +397,3 @@ if (currentTag) {

break;
case htmlScanner_1.TokenType.Content:
case htmlLanguageTypes_1.TokenType.Content:
if (offset <= scanner.getTokenEnd()) {

@@ -423,4 +424,4 @@ return collectInsideContent();

var token = scanner.scan();
while (token !== htmlScanner_1.TokenType.EOS && scanner.getTokenEnd() <= offset) {
if (token === htmlScanner_1.TokenType.StartTagClose && scanner.getTokenEnd() === offset) {
while (token !== htmlLanguageTypes_1.TokenType.EOS && scanner.getTokenEnd() <= offset) {
if (token === htmlLanguageTypes_1.TokenType.StartTagClose && scanner.getTokenEnd() === offset) {
return "$0</" + node.tag + ">";

@@ -440,4 +441,4 @@ }

var token = scanner.scan();
while (token !== htmlScanner_1.TokenType.EOS && scanner.getTokenEnd() <= offset) {
if (token === htmlScanner_1.TokenType.EndTagOpen && scanner.getTokenEnd() === offset) {
while (token !== htmlLanguageTypes_1.TokenType.EOS && scanner.getTokenEnd() <= offset) {
if (token === htmlLanguageTypes_1.TokenType.EndTagOpen && scanner.getTokenEnd() === offset) {
return node.tag + ">";

@@ -463,3 +464,3 @@ }

var token = scanner.scan();
while (token === htmlScanner_1.TokenType.Whitespace) {
while (token === htmlLanguageTypes_1.TokenType.Whitespace) {
token = scanner.scan();

@@ -466,0 +467,0 @@ }

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

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

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

var vscode_languageserver_types_1 = require("vscode-languageserver-types");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");
function findDocumentHighlights(document, position, htmlDocument) {

@@ -27,4 +28,4 @@ var offset = document.offsetAt(position);

var result = [];
var startTagRange = getTagNameRange(htmlScanner_1.TokenType.StartTag, document, node.start);
var endTagRange = typeof node.endTagStart === 'number' && getTagNameRange(htmlScanner_1.TokenType.EndTag, document, node.endTagStart);
var startTagRange = getTagNameRange(htmlLanguageTypes_1.TokenType.StartTag, document, node.start);
var endTagRange = typeof node.endTagStart === 'number' && getTagNameRange(htmlLanguageTypes_1.TokenType.EndTag, document, node.endTagStart);
if (startTagRange && covers(startTagRange, position) || endTagRange && covers(endTagRange, position)) {

@@ -50,6 +51,6 @@ if (startTagRange) {

var token = scanner.scan();
while (token !== htmlScanner_1.TokenType.EOS && token !== tokenType) {
while (token !== htmlLanguageTypes_1.TokenType.EOS && token !== tokenType) {
token = scanner.scan();
}
if (token !== htmlScanner_1.TokenType.EOS) {
if (token !== htmlLanguageTypes_1.TokenType.EOS) {
return { start: document.positionAt(scanner.getTokenOffset()), end: document.positionAt(scanner.getTokenEnd()) };

@@ -56,0 +57,0 @@ }

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

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

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

var tagProviders_1 = require("./tagProviders");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");
function doHover(document, position, htmlDocument) {

@@ -53,3 +54,3 @@ var offset = document.offsetAt(position);

var token = scanner.scan();
while (token !== htmlScanner_1.TokenType.EOS && (scanner.getTokenEnd() < offset || scanner.getTokenEnd() === offset && token !== tokenType)) {
while (token !== htmlLanguageTypes_1.TokenType.EOS && (scanner.getTokenEnd() < offset || scanner.getTokenEnd() === offset && token !== tokenType)) {
token = scanner.scan();

@@ -63,3 +64,3 @@ }

if (node.endTagStart && offset >= node.endTagStart) {
var tagRange_1 = getTagNameRange(htmlScanner_1.TokenType.EndTag, node.endTagStart);
var tagRange_1 = getTagNameRange(htmlLanguageTypes_1.TokenType.EndTag, node.endTagStart);
if (tagRange_1) {

@@ -70,3 +71,3 @@ return getTagHover(node.tag, tagRange_1, false);

}
var tagRange = getTagNameRange(htmlScanner_1.TokenType.StartTag, node.start);
var tagRange = getTagNameRange(htmlLanguageTypes_1.TokenType.StartTag, node.start);
if (tagRange) {

@@ -73,0 +74,0 @@ return getTagHover(node.tag, tagRange, true);

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

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

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

var vscode_uri_1 = require("vscode-uri");
var htmlLanguageTypes_1 = require("../htmlLanguageTypes");
function normalizeRef(url, languageId) {

@@ -104,5 +105,5 @@ var first = url[0];

var base = void 0;
while (token !== htmlScanner_1.TokenType.EOS) {
while (token !== htmlLanguageTypes_1.TokenType.EOS) {
switch (token) {
case htmlScanner_1.TokenType.StartTag:
case htmlLanguageTypes_1.TokenType.StartTag:
if (!base) {

@@ -113,7 +114,7 @@ var tagName = scanner.getTokenText().toLowerCase();

break;
case htmlScanner_1.TokenType.AttributeName:
case htmlLanguageTypes_1.TokenType.AttributeName:
var attributeName = scanner.getTokenText().toLowerCase();
afterHrefOrSrc = attributeName === 'src' || attributeName === 'href';
break;
case htmlScanner_1.TokenType.AttributeValue:
case htmlLanguageTypes_1.TokenType.AttributeValue:
if (afterHrefOrSrc) {

@@ -120,0 +121,0 @@ var attributeValue = scanner.getTokenText();

{
"name": "vscode-html-languageservice",
"version": "2.1.2",
"version": "2.1.3-next.1",
"description": "Language service for HTML",

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

@@ -21,2 +21,3 @@ # vscode-html-languageservice

- *findDocumentSymbols* finds all the symbols in the document.
- *htmlLanguageService.getFoldingRanges* returning folding ranges for the given document

@@ -23,0 +24,0 @@ Installation

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