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

vscode-html-languageservice

Package Overview
Dependencies
Maintainers
7
Versions
140
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 5.0.7 to 5.1.0

4

CHANGELOG.md
5.1.0 / 2022-09-11
================
* Added `LanguageService.findDocumentSymbols2`. Returns the symbols found in a document as `DocumentSymbol[]`.
5.0.0 / 2022-05-18

@@ -3,0 +7,0 @@ ================

3

lib/esm/htmlLanguageService.d.ts

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

import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, IHTMLDataProvider, HTMLDataV1, LanguageServiceOptions, TextDocument, SelectionRange, WorkspaceEdit, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink, FoldingRange, HoverSettings } from './htmlLanguageTypes';
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, DocumentSymbol, IHTMLDataProvider, HTMLDataV1, LanguageServiceOptions, TextDocument, SelectionRange, WorkspaceEdit, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink, FoldingRange, HoverSettings } from './htmlLanguageTypes';
export * from './htmlLanguageTypes';

@@ -15,2 +15,3 @@ export interface LanguageService {

findDocumentSymbols(document: TextDocument, htmlDocument: HTMLDocument): SymbolInformation[];
findDocumentSymbols2(document: TextDocument, htmlDocument: HTMLDocument): DocumentSymbol[];
doQuoteComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument, options?: CompletionConfiguration): string | null;

@@ -17,0 +18,0 @@ doTagComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument): string | null;

@@ -12,3 +12,3 @@ /*---------------------------------------------------------------------------------------------

import { findDocumentHighlights } from './services/htmlHighlighting';
import { findDocumentSymbols } from './services/htmlSymbolsProvider';
import { findDocumentSymbols, findDocumentSymbols2 } from './services/htmlSymbolsProvider';
import { doRename } from './services/htmlRename';

@@ -44,2 +44,3 @@ import { findMatchingTagPosition } from './services/htmlMatchingTagPosition';

findDocumentSymbols,
findDocumentSymbols2,
getFoldingRanges: htmlFolding.getFoldingRanges.bind(htmlFolding),

@@ -46,0 +47,0 @@ getSelectionRanges: htmlSelectionRange.getSelectionRanges.bind(htmlSelectionRange),

@@ -1,4 +0,4 @@

import { Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, DocumentSymbol, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
export { TextDocument, Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation };
export { TextDocument, Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, DocumentSymbol, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation };
export interface HTMLFormatConfiguration {

@@ -5,0 +5,0 @@ tabSize?: number;

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

*--------------------------------------------------------------------------------------------*/
import { Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, DocumentSymbol, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
export { TextDocument, Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation };
export { TextDocument, Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, DocumentSymbol, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation };
export var TokenType;

@@ -10,0 +10,0 @@ (function (TokenType) {

@@ -5,22 +5,36 @@ /*---------------------------------------------------------------------------------------------

*--------------------------------------------------------------------------------------------*/
import { Location, Range, SymbolKind } from '../htmlLanguageTypes';
import { DocumentSymbol, Range, SymbolInformation, SymbolKind } from '../htmlLanguageTypes';
export function findDocumentSymbols(document, htmlDocument) {
const symbols = [];
const symbols2 = findDocumentSymbols2(document, htmlDocument);
for (const symbol of symbols2) {
walk(symbol, undefined);
}
return symbols;
function walk(node, parent) {
const symbol = SymbolInformation.create(node.name, node.kind, node.range, document.uri, parent?.name);
symbol.containerName ?? (symbol.containerName = '');
symbols.push(symbol);
if (node.children) {
for (const child of node.children) {
walk(child, node);
}
}
}
}
export function findDocumentSymbols2(document, htmlDocument) {
const symbols = [];
htmlDocument.roots.forEach(node => {
provideFileSymbolsInternal(document, node, '', symbols);
provideFileSymbolsInternal(document, node, symbols);
});
return symbols;
}
function provideFileSymbolsInternal(document, node, container, symbols) {
function provideFileSymbolsInternal(document, node, symbols) {
const name = nodeToName(node);
const location = Location.create(document.uri, Range.create(document.positionAt(node.start), document.positionAt(node.end)));
const symbol = {
name: name,
location: location,
containerName: container,
kind: SymbolKind.Field
};
const range = Range.create(document.positionAt(node.start), document.positionAt(node.end));
const symbol = DocumentSymbol.create(name, undefined, SymbolKind.Field, range, range);
symbols.push(symbol);
node.children.forEach(child => {
provideFileSymbolsInternal(document, child, name, symbols);
symbol.children ?? (symbol.children = []);
provideFileSymbolsInternal(document, child, symbol.children);
});

@@ -27,0 +41,0 @@ }

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

import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, IHTMLDataProvider, HTMLDataV1, LanguageServiceOptions, TextDocument, SelectionRange, WorkspaceEdit, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink, FoldingRange, HoverSettings } from './htmlLanguageTypes';
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, DocumentSymbol, IHTMLDataProvider, HTMLDataV1, LanguageServiceOptions, TextDocument, SelectionRange, WorkspaceEdit, Position, CompletionList, Hover, Range, SymbolInformation, TextEdit, DocumentHighlight, DocumentLink, FoldingRange, HoverSettings } from './htmlLanguageTypes';
export * from './htmlLanguageTypes';

@@ -15,2 +15,3 @@ export interface LanguageService {

findDocumentSymbols(document: TextDocument, htmlDocument: HTMLDocument): SymbolInformation[];
findDocumentSymbols2(document: TextDocument, htmlDocument: HTMLDocument): DocumentSymbol[];
doQuoteComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument, options?: CompletionConfiguration): string | null;

@@ -17,0 +18,0 @@ doTagComplete(document: TextDocument, position: Position, htmlDocument: HTMLDocument): string | null;

@@ -69,2 +69,3 @@ /*---------------------------------------------------------------------------------------------

findDocumentSymbols: htmlSymbolsProvider_1.findDocumentSymbols,
findDocumentSymbols2: htmlSymbolsProvider_1.findDocumentSymbols2,
getFoldingRanges: htmlFolding.getFoldingRanges.bind(htmlFolding),

@@ -71,0 +72,0 @@ getSelectionRanges: htmlSelectionRange.getSelectionRanges.bind(htmlSelectionRange),

@@ -1,4 +0,4 @@

import { Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, DocumentSymbol, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
export { TextDocument, Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation };
export { TextDocument, Position, Range, Location, MarkupContent, MarkupKind, MarkedString, DocumentUri, SelectionRange, WorkspaceEdit, CompletionList, CompletionItemKind, CompletionItem, CompletionItemTag, InsertTextMode, Command, SymbolInformation, DocumentSymbol, SymbolKind, Hover, TextEdit, InsertReplaceEdit, InsertTextFormat, DocumentHighlight, DocumentHighlightKind, DocumentLink, FoldingRange, FoldingRangeKind, SignatureHelp, Definition, Diagnostic, FormattingOptions, Color, ColorInformation, ColorPresentation };
export interface HTMLFormatConfiguration {

@@ -5,0 +5,0 @@ tabSize?: number;

@@ -16,3 +16,3 @@ /*---------------------------------------------------------------------------------------------

Object.defineProperty(exports, "__esModule", { value: true });
exports.FileType = exports.ClientCapabilities = exports.ScannerState = exports.TokenType = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.FormattingOptions = exports.Diagnostic = exports.FoldingRangeKind = exports.FoldingRange = exports.DocumentLink = exports.DocumentHighlightKind = exports.DocumentHighlight = exports.InsertTextFormat = exports.InsertReplaceEdit = exports.TextEdit = exports.Hover = exports.SymbolKind = exports.SymbolInformation = exports.Command = exports.InsertTextMode = exports.CompletionItemTag = exports.CompletionItem = exports.CompletionItemKind = exports.CompletionList = exports.WorkspaceEdit = exports.SelectionRange = exports.DocumentUri = exports.MarkedString = exports.MarkupKind = exports.MarkupContent = exports.Location = exports.Range = exports.Position = exports.TextDocument = void 0;
exports.FileType = exports.ClientCapabilities = exports.ScannerState = exports.TokenType = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.FormattingOptions = exports.Diagnostic = exports.FoldingRangeKind = exports.FoldingRange = exports.DocumentLink = exports.DocumentHighlightKind = exports.DocumentHighlight = exports.InsertTextFormat = exports.InsertReplaceEdit = exports.TextEdit = exports.Hover = exports.SymbolKind = exports.DocumentSymbol = exports.SymbolInformation = exports.Command = exports.InsertTextMode = exports.CompletionItemTag = exports.CompletionItem = exports.CompletionItemKind = exports.CompletionList = exports.WorkspaceEdit = exports.SelectionRange = exports.DocumentUri = exports.MarkedString = exports.MarkupKind = exports.MarkupContent = exports.Location = exports.Range = exports.Position = exports.TextDocument = void 0;
const vscode_languageserver_types_1 = require("vscode-languageserver-types");

@@ -35,2 +35,3 @@ Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return vscode_languageserver_types_1.Position; } });

Object.defineProperty(exports, "SymbolInformation", { enumerable: true, get: function () { return vscode_languageserver_types_1.SymbolInformation; } });
Object.defineProperty(exports, "DocumentSymbol", { enumerable: true, get: function () { return vscode_languageserver_types_1.DocumentSymbol; } });
Object.defineProperty(exports, "SymbolKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.SymbolKind; } });

@@ -37,0 +38,0 @@ Object.defineProperty(exports, "Hover", { enumerable: true, get: function () { return vscode_languageserver_types_1.Hover; } });

@@ -16,24 +16,39 @@ /*---------------------------------------------------------------------------------------------

Object.defineProperty(exports, "__esModule", { value: true });
exports.findDocumentSymbols = void 0;
exports.findDocumentSymbols2 = exports.findDocumentSymbols = void 0;
const htmlLanguageTypes_1 = require("../htmlLanguageTypes");
function findDocumentSymbols(document, htmlDocument) {
const symbols = [];
const symbols2 = findDocumentSymbols2(document, htmlDocument);
for (const symbol of symbols2) {
walk(symbol, undefined);
}
return symbols;
function walk(node, parent) {
const symbol = htmlLanguageTypes_1.SymbolInformation.create(node.name, node.kind, node.range, document.uri, parent?.name);
symbol.containerName ?? (symbol.containerName = '');
symbols.push(symbol);
if (node.children) {
for (const child of node.children) {
walk(child, node);
}
}
}
}
exports.findDocumentSymbols = findDocumentSymbols;
function findDocumentSymbols2(document, htmlDocument) {
const symbols = [];
htmlDocument.roots.forEach(node => {
provideFileSymbolsInternal(document, node, '', symbols);
provideFileSymbolsInternal(document, node, symbols);
});
return symbols;
}
exports.findDocumentSymbols = findDocumentSymbols;
function provideFileSymbolsInternal(document, node, container, symbols) {
exports.findDocumentSymbols2 = findDocumentSymbols2;
function provideFileSymbolsInternal(document, node, symbols) {
const name = nodeToName(node);
const location = htmlLanguageTypes_1.Location.create(document.uri, htmlLanguageTypes_1.Range.create(document.positionAt(node.start), document.positionAt(node.end)));
const symbol = {
name: name,
location: location,
containerName: container,
kind: htmlLanguageTypes_1.SymbolKind.Field
};
const range = htmlLanguageTypes_1.Range.create(document.positionAt(node.start), document.positionAt(node.end));
const symbol = htmlLanguageTypes_1.DocumentSymbol.create(name, undefined, htmlLanguageTypes_1.SymbolKind.Field, range, range);
symbols.push(symbol);
node.children.forEach(child => {
provideFileSymbolsInternal(document, child, name, symbols);
symbol.children ?? (symbol.children = []);
provideFileSymbolsInternal(document, child, symbol.children);
});

@@ -40,0 +55,0 @@ }

{
"name": "vscode-html-languageservice",
"version": "5.0.7",
"version": "5.1.0",
"description": "Language service for HTML",

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

"@types/node": "16.x",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"@vscode/web-custom-data": "^0.4.7",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"@vscode/web-custom-data": "^0.4.8",
"eslint": "^8.48.0",

@@ -25,0 +25,0 @@ "js-beautify": "^1.14.9",

@@ -66,5 +66,5 @@ # vscode-html-languageservice

Copyright 2016-2020, Microsoft
Copyright 2016-2023, Microsoft
`src/languageFacts/data/webCustomData.ts` is built upon content from [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web)
and distributed under CC BY-SA 2.5.
`src/languageFacts/data/webCustomData.ts` (shipped as `lib/esm/languageFacts/data/webCustomData.ts` and `lib/umd/languageFacts/data/webCustomData.ts`)
are built upon content from [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web) and distributed under CC BY-SA 2.5.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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