vscode-html-languageservice
Advanced tools
Comparing version 2.1.11-next.5 to 2.1.11-next.6
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 { HTMLData } from './languageFacts'; | ||
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, IHTMLDataProvider } from './htmlLanguageTypes'; | ||
export * from './htmlLanguageTypes'; | ||
export * from 'vscode-languageserver-types'; | ||
export { HTMLDataProvider } from './languageFacts'; | ||
export interface LanguageService { | ||
@@ -23,4 +23,4 @@ createScanner(input: string, initialOffset?: number): Scanner; | ||
export interface LanguageServiceOptions { | ||
customDataCollections?: HTMLData[]; | ||
customDataProviders?: IHTMLDataProvider[]; | ||
} | ||
export declare function getLanguageService(options?: LanguageServiceOptions): LanguageService; |
@@ -15,10 +15,11 @@ /*--------------------------------------------------------------------------------------------- | ||
import { getFoldingRanges } from './services/htmlFolding'; | ||
import { handleCustomData } from './languageFacts'; | ||
import { handleCustomDataProviders } from './languageFacts'; | ||
import { getSelectionRanges } from './services/htmlSelectionRange'; | ||
export * from './htmlLanguageTypes'; | ||
export * from 'vscode-languageserver-types'; | ||
export { HTMLDataProvider } from './languageFacts'; | ||
export function getLanguageService(options) { | ||
var htmlCompletion = new HTMLCompletion(); | ||
if (options && options.customDataCollections) { | ||
handleCustomData(options.customDataCollections); | ||
if (options && options.customDataProviders) { | ||
handleCustomDataProviders(options.customDataProviders); | ||
} | ||
@@ -25,0 +26,0 @@ return { |
import { TextDocument, Position, Range } from 'vscode-languageserver-types'; | ||
export { IEntryData, ITagEntryData, IAttributeEntryData, HTMLData } from './languageFacts'; | ||
export interface HTMLFormatConfiguration { | ||
@@ -105,1 +104,23 @@ tabSize?: number; | ||
} | ||
export interface IHTMLDataProvider { | ||
getId(): string; | ||
isApplicable(languageId: string): boolean; | ||
provideTags(): ITagData[]; | ||
provideAttributes(tag: string): IAttributeData[]; | ||
provideValues(tag: string, attribute: string): IValueData[]; | ||
} | ||
export interface ITagData { | ||
name: string; | ||
description?: string; | ||
attributes: IAttributeData[]; | ||
} | ||
export interface IAttributeData { | ||
name: string; | ||
description?: string; | ||
valueSet?: string; | ||
values?: IValueData[]; | ||
} | ||
export interface IValueData { | ||
name: string; | ||
description?: string; | ||
} |
@@ -8,3 +8,2 @@ /*--------------------------------------------------------------------------------------------- | ||
import { getHTML5DataProvider } from './data/html5'; | ||
import { HTMLDataProvider } from './dataProvider'; | ||
export var builtinDataProviders = [ | ||
@@ -19,26 +18,7 @@ getHTML5DataProvider() | ||
} | ||
export function handleCustomData(customDataCollections) { | ||
var allTags = []; | ||
var allGlobalAttributes = []; | ||
var allValueSetMap = {}; | ||
customDataCollections.forEach(function (customData) { | ||
var tags = customData.tags, globalAttributes = customData.globalAttributes, valueSetMap = customData.valueSetMap; | ||
if (tags) { | ||
allTags = allTags.concat(tags); | ||
} | ||
if (globalAttributes) { | ||
allGlobalAttributes = allGlobalAttributes.concat(globalAttributes); | ||
} | ||
if (valueSetMap) { | ||
for (var v in valueSetMap) { | ||
allValueSetMap[v] = valueSetMap[v]; | ||
} | ||
} | ||
export function handleCustomDataProviders(providers) { | ||
providers.forEach(function (p) { | ||
customDataProviders.push(p); | ||
}); | ||
customDataProviders.push(new HTMLDataProvider('customData', { | ||
tags: allTags, | ||
globalAttributes: allGlobalAttributes, | ||
valueSetMap: allValueSetMap | ||
})); | ||
} | ||
//# sourceMappingURL=builtinDataProviders.js.map |
@@ -1,6 +0,7 @@ | ||
import { HTMLDataProvider, ITagEntryData, IEntryData } from '../dataProvider'; | ||
import { HTMLDataProvider } from '../dataProvider'; | ||
import { ITagData, IAttributeData } from '../../htmlLanguageTypes'; | ||
export declare function getHTML5DataProvider(): HTMLDataProvider; | ||
export declare const HTML5_TAGS: ITagEntryData[]; | ||
export declare const HTML5_GLOBAL_ATTRIBUTES: IEntryData[]; | ||
export declare const HTML5_EVENTS: IEntryData[]; | ||
export declare const HTML5_TAGS: ITagData[]; | ||
export declare const HTML5_GLOBAL_ATTRIBUTES: IAttributeData[]; | ||
export declare const HTML5_EVENTS: IAttributeData[]; | ||
export declare const HTML5_VALUE_MAP: { | ||
@@ -7,0 +8,0 @@ b: { |
@@ -11,3 +11,3 @@ /*--------------------------------------------------------------------------------------------- | ||
globalAttributes: HTML5_GLOBAL_ATTRIBUTES.concat(HTML5_EVENTS), | ||
valueSetMap: HTML5_VALUE_MAP | ||
valueSets: HTML5_VALUE_MAP | ||
}); | ||
@@ -55,3 +55,4 @@ } | ||
{ | ||
name: 'crossorigin:xo' | ||
name: 'crossorigin', | ||
valueSet: 'xo' | ||
}, | ||
@@ -107,3 +108,4 @@ { | ||
{ | ||
name: 'scoped:v' | ||
name: 'scoped', | ||
valueSet: 'v' | ||
} | ||
@@ -251,3 +253,4 @@ ] | ||
{ | ||
name: 'reversed:v' | ||
name: 'reversed', | ||
valueSet: 'v' | ||
}, | ||
@@ -258,3 +261,4 @@ { | ||
{ | ||
name: 'type:lt' | ||
name: 'type', | ||
valueSet: 'lt' | ||
} | ||
@@ -523,3 +527,4 @@ ] | ||
{ | ||
name: 'crossorigin:xo' | ||
name: 'crossorigin', | ||
valueSet: 'xo' | ||
}, | ||
@@ -530,3 +535,4 @@ { | ||
{ | ||
name: 'ismap:v' | ||
name: 'ismap', | ||
valueSet: 'v' | ||
}, | ||
@@ -555,9 +561,12 @@ { | ||
{ | ||
name: 'sandbox:sb' | ||
name: 'sandbox', | ||
valueSet: 'sb' | ||
}, | ||
{ | ||
name: 'seamless:v' | ||
name: 'seamless', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'allowfullscreen:v' | ||
name: 'allowfullscreen', | ||
valueSet: 'v' | ||
}, | ||
@@ -601,3 +610,4 @@ { | ||
{ | ||
name: 'typemustmatch:v' | ||
name: 'typemustmatch', | ||
valueSet: 'v' | ||
}, | ||
@@ -641,3 +651,4 @@ { | ||
{ | ||
name: 'crossorigin:xo' | ||
name: 'crossorigin', | ||
valueSet: 'xo' | ||
}, | ||
@@ -648,6 +659,8 @@ { | ||
{ | ||
name: 'preload:pl' | ||
name: 'preload', | ||
valueSet: 'pl' | ||
}, | ||
{ | ||
name: 'autoplay:v' | ||
name: 'autoplay', | ||
valueSet: 'v' | ||
}, | ||
@@ -658,9 +671,12 @@ { | ||
{ | ||
name: 'loop:v' | ||
name: 'loop', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'muted:v' | ||
name: 'muted', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'controls:v' | ||
name: 'controls', | ||
valueSet: 'v' | ||
}, | ||
@@ -683,9 +699,12 @@ { | ||
{ | ||
name: 'crossorigin:xo' | ||
name: 'crossorigin', | ||
valueSet: 'xo' | ||
}, | ||
{ | ||
name: 'preload:pl' | ||
name: 'preload', | ||
valueSet: 'pl' | ||
}, | ||
{ | ||
name: 'autoplay:v' | ||
name: 'autoplay', | ||
valueSet: 'v' | ||
}, | ||
@@ -696,9 +715,12 @@ { | ||
{ | ||
name: 'loop:v' | ||
name: 'loop', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'muted:v' | ||
name: 'muted', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'controls:v' | ||
name: 'controls', | ||
valueSet: 'v' | ||
} | ||
@@ -724,6 +746,8 @@ ] | ||
{ | ||
name: 'default:v' | ||
name: 'default', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'kind:tk' | ||
name: 'kind', | ||
valueSet: 'tk' | ||
}, | ||
@@ -761,3 +785,4 @@ { | ||
{ | ||
name: 'shape:sh' | ||
name: 'shape', | ||
valueSet: 'sh' | ||
}, | ||
@@ -792,3 +817,4 @@ { | ||
{ | ||
name: 'sortable:v' | ||
name: 'sortable', | ||
valueSet: 'v' | ||
}, | ||
@@ -872,3 +898,4 @@ { | ||
{ | ||
name: 'scope:s' | ||
name: 'scope', | ||
valueSet: 's' | ||
}, | ||
@@ -894,9 +921,12 @@ { | ||
{ | ||
name: 'autocomplete:o' | ||
name: 'autocomplete', | ||
valueSet: 'o' | ||
}, | ||
{ | ||
name: 'enctype:et' | ||
name: 'enctype', | ||
valueSet: 'et' | ||
}, | ||
{ | ||
name: 'method:m' | ||
name: 'method', | ||
valueSet: 'm' | ||
}, | ||
@@ -907,3 +937,4 @@ { | ||
{ | ||
name: 'novalidate:v' | ||
name: 'novalidate', | ||
valueSet: 'v' | ||
}, | ||
@@ -938,9 +969,12 @@ { | ||
{ | ||
name: 'autocomplete:inputautocomplete' | ||
name: 'autocomplete', | ||
valueSet: 'inputautocomplete' | ||
}, | ||
{ | ||
name: 'autofocus:v' | ||
name: 'autofocus', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'checked:v' | ||
name: 'checked', | ||
valueSet: 'v' | ||
}, | ||
@@ -951,3 +985,4 @@ { | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -961,9 +996,12 @@ { | ||
{ | ||
name: 'formenctype:et' | ||
name: 'formenctype', | ||
valueSet: 'et' | ||
}, | ||
{ | ||
name: 'formmethod:fm' | ||
name: 'formmethod', | ||
valueSet: 'fm' | ||
}, | ||
{ | ||
name: 'formnovalidate:v' | ||
name: 'formnovalidate', | ||
valueSet: 'v' | ||
}, | ||
@@ -977,3 +1015,4 @@ { | ||
{ | ||
name: 'inputmode:im' | ||
name: 'inputmode', | ||
valueSet: 'im' | ||
}, | ||
@@ -996,3 +1035,4 @@ { | ||
{ | ||
name: 'multiple:v' | ||
name: 'multiple', | ||
valueSet: 'v' | ||
}, | ||
@@ -1009,6 +1049,8 @@ { | ||
{ | ||
name: 'readonly:v' | ||
name: 'readonly', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'required:v' | ||
name: 'required', | ||
valueSet: 'v' | ||
}, | ||
@@ -1025,3 +1067,4 @@ { | ||
{ | ||
name: 'type:t' | ||
name: 'type', | ||
valueSet: 't' | ||
}, | ||
@@ -1041,6 +1084,8 @@ { | ||
{ | ||
name: 'autofocus:v' | ||
name: 'autofocus', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -1054,9 +1099,12 @@ { | ||
{ | ||
name: 'formenctype:et' | ||
name: 'formenctype', | ||
valueSet: 'et' | ||
}, | ||
{ | ||
name: 'formmethod:fm' | ||
name: 'formmethod', | ||
valueSet: 'fm' | ||
}, | ||
{ | ||
name: 'formnovalidate:v' | ||
name: 'formnovalidate', | ||
valueSet: 'v' | ||
}, | ||
@@ -1070,3 +1118,4 @@ { | ||
{ | ||
name: 'type:bt' | ||
name: 'type', | ||
valueSet: 'bt' | ||
}, | ||
@@ -1083,9 +1132,12 @@ { | ||
{ | ||
name: 'autocomplete:inputautocomplete' | ||
name: 'autocomplete', | ||
valueSet: 'inputautocomplete' | ||
}, | ||
{ | ||
name: 'autofocus:v' | ||
name: 'autofocus', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -1096,3 +1148,4 @@ { | ||
{ | ||
name: 'multiple:v' | ||
name: 'multiple', | ||
valueSet: 'v' | ||
}, | ||
@@ -1103,3 +1156,4 @@ { | ||
{ | ||
name: 'required:v' | ||
name: 'required', | ||
valueSet: 'v' | ||
}, | ||
@@ -1121,3 +1175,4 @@ { | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -1134,3 +1189,4 @@ { | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -1141,3 +1197,4 @@ { | ||
{ | ||
name: 'selected:v' | ||
name: 'selected', | ||
valueSet: 'v' | ||
}, | ||
@@ -1154,6 +1211,8 @@ { | ||
{ | ||
name: 'autocomplete:inputautocomplete' | ||
name: 'autocomplete', | ||
valueSet: 'inputautocomplete' | ||
}, | ||
{ | ||
name: 'autofocus:v' | ||
name: 'autofocus', | ||
valueSet: 'v' | ||
}, | ||
@@ -1167,3 +1226,4 @@ { | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -1174,3 +1234,4 @@ { | ||
{ | ||
name: 'inputmode:im' | ||
name: 'inputmode', | ||
valueSet: 'im' | ||
}, | ||
@@ -1190,6 +1251,8 @@ { | ||
{ | ||
name: 'readonly:v' | ||
name: 'readonly', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'required:v' | ||
name: 'required', | ||
valueSet: 'v' | ||
}, | ||
@@ -1200,3 +1263,4 @@ { | ||
{ | ||
name: 'wrap:w' | ||
name: 'wrap', | ||
valueSet: 'w' | ||
} | ||
@@ -1261,3 +1325,4 @@ ] | ||
{ | ||
name: 'disabled:v' | ||
name: 'disabled', | ||
valueSet: 'v' | ||
}, | ||
@@ -1282,3 +1347,4 @@ { | ||
{ | ||
name: 'open:v' | ||
name: 'open', | ||
valueSet: 'v' | ||
} | ||
@@ -1311,9 +1377,12 @@ ] | ||
{ | ||
name: 'async:v' | ||
name: 'async', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'defer:v' | ||
name: 'defer', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'crossorigin:xo' | ||
name: 'crossorigin', | ||
valueSet: 'xo' | ||
}, | ||
@@ -1349,71 +1418,240 @@ { | ||
export var HTML5_GLOBAL_ATTRIBUTES = [ | ||
{ name: 'aria-activedescendant' }, | ||
{ name: 'aria-atomic:b' }, | ||
{ name: 'aria-autocomplete:autocomplete' }, | ||
{ name: 'aria-busy:b' }, | ||
{ name: 'aria-checked:tristate' }, | ||
{ name: 'aria-colcount' }, | ||
{ name: 'aria-colindex' }, | ||
{ name: 'aria-colspan' }, | ||
{ name: 'aria-controls' }, | ||
{ name: 'aria-current:current' }, | ||
{ name: 'aria-describedat' }, | ||
{ name: 'aria-describedby' }, | ||
{ name: 'aria-disabled:b' }, | ||
{ name: 'aria-dropeffect:dropeffect' }, | ||
{ name: 'aria-errormessage' }, | ||
{ name: 'aria-expanded:u' }, | ||
{ name: 'aria-flowto' }, | ||
{ name: 'aria-grabbed:u' }, | ||
{ name: 'aria-haspopup:b' }, | ||
{ name: 'aria-hidden:b' }, | ||
{ name: 'aria-invalid:invalid' }, | ||
{ name: 'aria-kbdshortcuts' }, | ||
{ name: 'aria-label' }, | ||
{ name: 'aria-labelledby' }, | ||
{ name: 'aria-level' }, | ||
{ name: 'aria-live:live' }, | ||
{ name: 'aria-modal:b' }, | ||
{ name: 'aria-multiline:b' }, | ||
{ name: 'aria-multiselectable:b' }, | ||
{ name: 'aria-orientation:orientation' }, | ||
{ name: 'aria-owns' }, | ||
{ name: 'aria-placeholder' }, | ||
{ name: 'aria-posinset' }, | ||
{ name: 'aria-pressed:tristate' }, | ||
{ name: 'aria-readonly:b' }, | ||
{ name: 'aria-relevant:relevant' }, | ||
{ name: 'aria-required:b' }, | ||
{ name: 'aria-roledescription' }, | ||
{ name: 'aria-rowcount' }, | ||
{ name: 'aria-rowindex' }, | ||
{ name: 'aria-rowspan' }, | ||
{ name: 'aria-selected:u' }, | ||
{ name: 'aria-setsize' }, | ||
{ name: 'aria-sort:sort' }, | ||
{ name: 'aria-valuemax' }, | ||
{ name: 'aria-valuemin' }, | ||
{ name: 'aria-valuenow' }, | ||
{ name: 'aria-valuetext' }, | ||
{ name: 'accesskey' }, | ||
{ name: 'class' }, | ||
{ name: 'contenteditable:b' }, | ||
{ name: 'contextmenu' }, | ||
{ name: 'dir:d' }, | ||
{ name: 'draggable:b' }, | ||
{ name: 'dropzone' }, | ||
{ name: 'hidden:v' }, | ||
{ name: 'id' }, | ||
{ name: 'itemid' }, | ||
{ name: 'itemprop' }, | ||
{ name: 'itemref' }, | ||
{ name: 'itemscope:v' }, | ||
{ name: 'itemtype' }, | ||
{ name: 'lang' }, | ||
{ name: 'role:roles' }, | ||
{ name: 'spellcheck:b' }, | ||
{ name: 'style' }, | ||
{ name: 'tabindex' }, | ||
{ name: 'title' }, | ||
{ name: 'translate:y' } | ||
{ | ||
name: 'aria-activedescendant' | ||
}, | ||
{ | ||
name: 'aria-atomic', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-autocomplete', | ||
valueSet: 'autocomplete' | ||
}, | ||
{ | ||
name: 'aria-busy', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-checked', | ||
valueSet: 'tristate' | ||
}, | ||
{ | ||
name: 'aria-colcount' | ||
}, | ||
{ | ||
name: 'aria-colindex' | ||
}, | ||
{ | ||
name: 'aria-colspan' | ||
}, | ||
{ | ||
name: 'aria-controls' | ||
}, | ||
{ | ||
name: 'aria-current', | ||
valueSet: 'current' | ||
}, | ||
{ | ||
name: 'aria-describedat' | ||
}, | ||
{ | ||
name: 'aria-describedby' | ||
}, | ||
{ | ||
name: 'aria-disabled', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-dropeffect', | ||
valueSet: 'dropeffect' | ||
}, | ||
{ | ||
name: 'aria-errormessage' | ||
}, | ||
{ | ||
name: 'aria-expanded', | ||
valueSet: 'u' | ||
}, | ||
{ | ||
name: 'aria-flowto' | ||
}, | ||
{ | ||
name: 'aria-grabbed', | ||
valueSet: 'u' | ||
}, | ||
{ | ||
name: 'aria-haspopup', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-hidden', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-invalid', | ||
valueSet: 'invalid' | ||
}, | ||
{ | ||
name: 'aria-kbdshortcuts' | ||
}, | ||
{ | ||
name: 'aria-label' | ||
}, | ||
{ | ||
name: 'aria-labelledby' | ||
}, | ||
{ | ||
name: 'aria-level' | ||
}, | ||
{ | ||
name: 'aria-live', | ||
valueSet: 'live' | ||
}, | ||
{ | ||
name: 'aria-modal', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-multiline', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-multiselectable', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-orientation', | ||
valueSet: 'orientation' | ||
}, | ||
{ | ||
name: 'aria-owns' | ||
}, | ||
{ | ||
name: 'aria-placeholder' | ||
}, | ||
{ | ||
name: 'aria-posinset' | ||
}, | ||
{ | ||
name: 'aria-pressed', | ||
valueSet: 'tristate' | ||
}, | ||
{ | ||
name: 'aria-readonly', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-relevant', | ||
valueSet: 'relevant' | ||
}, | ||
{ | ||
name: 'aria-required', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'aria-roledescription' | ||
}, | ||
{ | ||
name: 'aria-rowcount' | ||
}, | ||
{ | ||
name: 'aria-rowindex' | ||
}, | ||
{ | ||
name: 'aria-rowspan' | ||
}, | ||
{ | ||
name: 'aria-selected', | ||
valueSet: 'u' | ||
}, | ||
{ | ||
name: 'aria-setsize' | ||
}, | ||
{ | ||
name: 'aria-sort', | ||
valueSet: 'sort' | ||
}, | ||
{ | ||
name: 'aria-valuemax' | ||
}, | ||
{ | ||
name: 'aria-valuemin' | ||
}, | ||
{ | ||
name: 'aria-valuenow' | ||
}, | ||
{ | ||
name: 'aria-valuetext' | ||
}, | ||
{ | ||
name: 'accesskey' | ||
}, | ||
{ | ||
name: 'class' | ||
}, | ||
{ | ||
name: 'contenteditable', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'contextmenu' | ||
}, | ||
{ | ||
name: 'dir', | ||
valueSet: 'd' | ||
}, | ||
{ | ||
name: 'draggable', | ||
valueSet: 'b' | ||
}, | ||
{ | ||
name: 'dropzone' | ||
}, | ||
{ | ||
name: 'hidden', | ||
valueSet: 'v' | ||
}, | ||
{ | ||
name: 'id' | ||
}, | ||
{ | ||
name: 'itemid' | ||
}, | ||
{ | ||
name: "itemprop" | ||
}, | ||
{ | ||
"name": "itemref" | ||
}, | ||
{ | ||
"name": "itemscope", | ||
"valueSet": "v" | ||
}, | ||
{ | ||
"name": "itemtype" | ||
}, | ||
{ | ||
"name": "lang" | ||
}, | ||
{ | ||
"name": "role", | ||
"valueSet": "roles" | ||
}, | ||
{ | ||
"name": "spellcheck", | ||
"valueSet": "b" | ||
}, | ||
{ | ||
"name": "style" | ||
}, | ||
{ | ||
"name": "tabindex" | ||
}, | ||
{ | ||
"name": "title" | ||
}, | ||
{ | ||
"name": "translate", | ||
"valueSet": "y" | ||
} | ||
]; | ||
@@ -1420,0 +1658,0 @@ export var HTML5_EVENTS = [ |
@@ -1,2 +0,2 @@ | ||
import { IHTMLDataProvider } from '../dataProvider'; | ||
import { IHTMLDataProvider } from '../../htmlLanguageTypes'; | ||
export declare function getRazorDataProvider(): IHTMLDataProvider; |
@@ -6,28 +6,31 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
var RAZOR_TAGS = { | ||
a: ['asp-action', 'asp-controller', 'asp-fragment', 'asp-host', 'asp-protocol', 'asp-route'], | ||
div: ['asp-validation-summary'], | ||
form: ['asp-action', 'asp-controller', 'asp-anti-forgery'], | ||
input: ['asp-for', 'asp-format'], | ||
label: ['asp-for'], | ||
select: ['asp-for', 'asp-items'], | ||
span: ['asp-validation-for'] | ||
}; | ||
export function getRazorDataProvider() { | ||
var customTags = { | ||
a: ['asp-action', 'asp-controller', 'asp-fragment', 'asp-host', 'asp-protocol', 'asp-route'], | ||
div: ['asp-validation-summary'], | ||
form: ['asp-action', 'asp-controller', 'asp-anti-forgery'], | ||
input: ['asp-for', 'asp-format'], | ||
label: ['asp-for'], | ||
select: ['asp-for', 'asp-items'], | ||
span: ['asp-validation-for'] | ||
}; | ||
return { | ||
getId: function () { return 'razor'; }, | ||
isApplicable: function (languageId) { return languageId === 'razor'; }, | ||
collectTags: function (collector) { | ||
// no extra tags | ||
provideTags: function () { | ||
return []; | ||
}, | ||
collectAttributes: function (tag, collector) { | ||
if (tag) { | ||
var attributes = customTags[tag]; | ||
if (attributes) { | ||
attributes.forEach(function (a) { return collector(a); }); | ||
} | ||
provideAttributes: function (tag) { | ||
var attributes = RAZOR_TAGS[tag]; | ||
if (!attributes) { | ||
return []; | ||
} | ||
return attributes.map(function (a) { | ||
return { | ||
name: a | ||
}; | ||
}); | ||
}, | ||
collectValues: function (tag, attribute, collector) { | ||
// no values | ||
provideValues: function (tag, attribute) { | ||
return []; | ||
} | ||
@@ -34,0 +37,0 @@ }; |
@@ -6,3 +6,2 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
import { startsWith } from '../utils/strings'; | ||
var HTMLDataProvider = /** @class */ (function () { | ||
@@ -14,3 +13,3 @@ function HTMLDataProvider(id, customData) { | ||
this._attributeMap = {}; | ||
this._valueSetMap = {}; | ||
this._valueSets = {}; | ||
this._tags = customData.tags || []; | ||
@@ -27,4 +26,4 @@ this._globalAttributes = customData.globalAttributes || []; | ||
}); | ||
if (customData.valueSetMap) { | ||
this._valueSetMap = customData.valueSetMap; | ||
if (customData.valueSets) { | ||
this._valueSets = customData.valueSets; | ||
} | ||
@@ -38,16 +37,13 @@ } | ||
}; | ||
HTMLDataProvider.prototype.collectTags = function (collector) { | ||
this._tags.forEach(function (t) { | ||
collector(t.name, t.description); | ||
}); | ||
HTMLDataProvider.prototype.provideTags = function () { | ||
return this._tags; | ||
}; | ||
HTMLDataProvider.prototype.collectAttributes = function (tag, collector) { | ||
HTMLDataProvider.prototype.provideAttributes = function (tag) { | ||
var attributes = []; | ||
var processAttribute = function (a) { | ||
if (a.name.indexOf(':') !== -1) { | ||
var _a = a.name.split(':'), aName = _a[0], aSetName = _a[1]; | ||
collector(aName, aSetName, a.description); | ||
} | ||
else { | ||
collector(a.name, undefined, a.description); | ||
} | ||
attributes.push({ | ||
name: a.name, | ||
description: a.description, | ||
valueSet: a.valueSet | ||
}); | ||
}; | ||
@@ -62,21 +58,19 @@ if (this._tagMap[tag]) { | ||
}); | ||
return attributes; | ||
}; | ||
HTMLDataProvider.prototype.collectValues = function (tag, attribute, collector) { | ||
HTMLDataProvider.prototype.provideValues = function (tag, attribute) { | ||
var _this = this; | ||
var values = []; | ||
var processAttributes = function (attributes) { | ||
attributes.forEach(function (a) { | ||
if (a.values) { | ||
a.values.forEach(function (v) { | ||
collector(v.name); | ||
}); | ||
} | ||
if (startsWith(a.name, attribute + ':')) { | ||
var setName = a.name.split(':')[1]; | ||
if (setName === 'v') { | ||
collector(attribute); | ||
if (a.name === attribute) { | ||
if (a.values) { | ||
a.values.forEach(function (v) { | ||
values.push(v); | ||
}); | ||
} | ||
else { | ||
if (setName && _this._valueSetMap[setName]) { | ||
_this._valueSetMap[setName].forEach(function (v) { | ||
collector(v.name); | ||
if (a.valueSet) { | ||
if (_this._valueSets[a.valueSet]) { | ||
_this._valueSets[a.valueSet].forEach(function (v) { | ||
values.push(v); | ||
}); | ||
@@ -88,6 +82,8 @@ } | ||
}; | ||
if (this._tagMap[tag]) { | ||
processAttributes(this._tagMap[tag].attributes); | ||
if (!this._tagMap[tag]) { | ||
return []; | ||
} | ||
processAttributes(this._tagMap[tag].attributes); | ||
processAttributes(this._globalAttributes); | ||
return values; | ||
}; | ||
@@ -94,0 +90,0 @@ return HTMLDataProvider; |
@@ -28,3 +28,3 @@ /*--------------------------------------------------------------------------------------------- | ||
var completionParticipants = this.completionParticipants; | ||
var tagProviders = getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); }); | ||
var dataProviders = getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); }); | ||
var text = document.getText(); | ||
@@ -48,9 +48,9 @@ var offset = document.offsetAt(position); | ||
var range = getReplaceRange(afterOpenBracket, tagNameEnd); | ||
tagProviders.forEach(function (provider) { | ||
provider.collectTags(function (tag, description) { | ||
dataProviders.forEach(function (provider) { | ||
provider.provideTags().forEach(function (tag) { | ||
result.items.push({ | ||
label: tag, | ||
label: tag.name, | ||
kind: CompletionItemKind.Property, | ||
documentation: description, | ||
textEdit: TextEdit.replace(range, tag), | ||
documentation: tag.description, | ||
textEdit: TextEdit.replace(range, tag.name), | ||
insertTextFormat: InsertTextFormat.PlainText | ||
@@ -109,8 +109,8 @@ }); | ||
} | ||
tagProviders.forEach(function (provider) { | ||
provider.collectTags(function (tag, description) { | ||
dataProviders.forEach(function (provider) { | ||
provider.provideTags().forEach(function (tag) { | ||
result.items.push({ | ||
label: '/' + tag, | ||
label: '/' + tag.name, | ||
kind: CompletionItemKind.Property, | ||
documentation: description, | ||
documentation: tag.description, | ||
filterText: '/' + tag + closeTag, | ||
@@ -155,13 +155,13 @@ textEdit: TextEdit.replace(range, '/' + tag + closeTag), | ||
var seenAttributes = Object.create(null); | ||
tagProviders.forEach(function (provider) { | ||
provider.collectAttributes(tag, function (attribute, type, description) { | ||
if (seenAttributes[attribute]) { | ||
dataProviders.forEach(function (provider) { | ||
provider.provideAttributes(tag).forEach(function (attr) { | ||
if (seenAttributes[attr.name]) { | ||
return; | ||
} | ||
seenAttributes[attribute] = true; | ||
var codeSnippet = attribute; | ||
seenAttributes[attr.name] = true; | ||
var codeSnippet = attr.name; | ||
var command; | ||
if (type !== 'v' && value.length) { | ||
if (attr.valueSet !== 'v' && value.length) { | ||
codeSnippet = codeSnippet + value; | ||
if (type) { | ||
if (attr.valueSet) { | ||
command = { | ||
@@ -174,5 +174,5 @@ title: 'Suggest', | ||
result.items.push({ | ||
label: attribute, | ||
kind: type === 'handler' ? CompletionItemKind.Function : CompletionItemKind.Value, | ||
documentation: description, | ||
label: attr.name, | ||
kind: attr.valueSet === 'handler' ? CompletionItemKind.Function : CompletionItemKind.Value, | ||
documentation: attr.description, | ||
textEdit: TextEdit.replace(range, codeSnippet), | ||
@@ -244,8 +244,7 @@ insertTextFormat: InsertTextFormat.Snippet, | ||
} | ||
var value = scanner.getTokenText(); | ||
tagProviders.forEach(function (provider) { | ||
provider.collectValues(tag, attribute, function (value) { | ||
var insertText = addQuotes ? '"' + value + '"' : value; | ||
dataProviders.forEach(function (provider) { | ||
provider.provideValues(tag, attribute).forEach(function (value) { | ||
var insertText = addQuotes ? '"' + value.name + '"' : value.name; | ||
result.items.push({ | ||
label: value, | ||
label: value.name, | ||
filterText: insertText, | ||
@@ -252,0 +251,0 @@ kind: CompletionItemKind.Unit, |
@@ -16,12 +16,12 @@ /*--------------------------------------------------------------------------------------------- | ||
} | ||
var tagProviders = getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId); }); | ||
function getTagHover(tag, range, open) { | ||
tag = tag.toLowerCase(); | ||
var dataProviders = getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId); }); | ||
function getTagHover(currTag, range, open) { | ||
currTag = currTag.toLowerCase(); | ||
var _loop_1 = function (provider) { | ||
var hover = null; | ||
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(description)], range: range }; | ||
provider.provideTags().forEach(function (tag) { | ||
if (tag.name.toLowerCase() === currTag.toLowerCase()) { | ||
var tagLabel = open ? '<' + currTag + '>' : '</' + currTag + '>'; | ||
var tagDescription = tag.description || ''; | ||
hover = { contents: [{ language: 'html', value: tagLabel }, MarkedString.fromPlainText(tagDescription)], range: range }; | ||
} | ||
@@ -33,4 +33,4 @@ }); | ||
}; | ||
for (var _i = 0, tagProviders_1 = tagProviders; _i < tagProviders_1.length; _i++) { | ||
var provider = tagProviders_1[_i]; | ||
for (var _i = 0, dataProviders_1 = dataProviders; _i < dataProviders_1.length; _i++) { | ||
var provider = dataProviders_1[_i]; | ||
var state_1 = _loop_1(provider); | ||
@@ -37,0 +37,0 @@ if (typeof state_1 === "object") |
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 { HTMLData } from './languageFacts'; | ||
import { Scanner, HTMLDocument, CompletionConfiguration, ICompletionParticipant, HTMLFormatConfiguration, DocumentContext, IHTMLDataProvider } from './htmlLanguageTypes'; | ||
export * from './htmlLanguageTypes'; | ||
export * from 'vscode-languageserver-types'; | ||
export { HTMLDataProvider } from './languageFacts'; | ||
export interface LanguageService { | ||
@@ -23,4 +23,4 @@ createScanner(input: string, initialOffset?: number): Scanner; | ||
export interface LanguageServiceOptions { | ||
customDataCollections?: HTMLData[]; | ||
customDataProviders?: IHTMLDataProvider[]; | ||
} | ||
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", "./languageFacts", "./services/htmlSelectionRange", "./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", "./services/htmlSelectionRange", "./htmlLanguageTypes", "vscode-languageserver-types", "./languageFacts"], factory); | ||
} | ||
@@ -33,6 +33,8 @@ })(function (require, exports) { | ||
__export(require("vscode-languageserver-types")); | ||
var languageFacts_2 = require("./languageFacts"); | ||
exports.HTMLDataProvider = languageFacts_2.HTMLDataProvider; | ||
function getLanguageService(options) { | ||
var htmlCompletion = new htmlCompletion_1.HTMLCompletion(); | ||
if (options && options.customDataCollections) { | ||
languageFacts_1.handleCustomData(options.customDataCollections); | ||
if (options && options.customDataProviders) { | ||
languageFacts_1.handleCustomDataProviders(options.customDataProviders); | ||
} | ||
@@ -39,0 +41,0 @@ return { |
import { TextDocument, Position, Range } from 'vscode-languageserver-types'; | ||
export { IEntryData, ITagEntryData, IAttributeEntryData, HTMLData } from './languageFacts'; | ||
export interface HTMLFormatConfiguration { | ||
@@ -105,1 +104,23 @@ tabSize?: number; | ||
} | ||
export interface IHTMLDataProvider { | ||
getId(): string; | ||
isApplicable(languageId: string): boolean; | ||
provideTags(): ITagData[]; | ||
provideAttributes(tag: string): IAttributeData[]; | ||
provideValues(tag: string, attribute: string): IValueData[]; | ||
} | ||
export interface ITagData { | ||
name: string; | ||
description?: string; | ||
attributes: IAttributeData[]; | ||
} | ||
export interface IAttributeData { | ||
name: string; | ||
description?: string; | ||
valueSet?: string; | ||
values?: IValueData[]; | ||
} | ||
export interface IValueData { | ||
name: string; | ||
description?: string; | ||
} |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./data/razor", "./data/html5", "./dataProvider"], factory); | ||
define(["require", "exports", "./data/razor", "./data/html5"], factory); | ||
} | ||
@@ -19,3 +19,2 @@ })(function (require, exports) { | ||
var html5_1 = require("./data/html5"); | ||
var dataProvider_1 = require("./dataProvider"); | ||
exports.builtinDataProviders = [ | ||
@@ -31,28 +30,9 @@ html5_1.getHTML5DataProvider() | ||
exports.getAllDataProviders = getAllDataProviders; | ||
function handleCustomData(customDataCollections) { | ||
var allTags = []; | ||
var allGlobalAttributes = []; | ||
var allValueSetMap = {}; | ||
customDataCollections.forEach(function (customData) { | ||
var tags = customData.tags, globalAttributes = customData.globalAttributes, valueSetMap = customData.valueSetMap; | ||
if (tags) { | ||
allTags = allTags.concat(tags); | ||
} | ||
if (globalAttributes) { | ||
allGlobalAttributes = allGlobalAttributes.concat(globalAttributes); | ||
} | ||
if (valueSetMap) { | ||
for (var v in valueSetMap) { | ||
allValueSetMap[v] = valueSetMap[v]; | ||
} | ||
} | ||
function handleCustomDataProviders(providers) { | ||
providers.forEach(function (p) { | ||
customDataProviders.push(p); | ||
}); | ||
customDataProviders.push(new dataProvider_1.HTMLDataProvider('customData', { | ||
tags: allTags, | ||
globalAttributes: allGlobalAttributes, | ||
valueSetMap: allValueSetMap | ||
})); | ||
} | ||
exports.handleCustomData = handleCustomData; | ||
exports.handleCustomDataProviders = handleCustomDataProviders; | ||
}); | ||
//# sourceMappingURL=builtinDataProviders.js.map |
@@ -1,6 +0,7 @@ | ||
import { HTMLDataProvider, ITagEntryData, IEntryData } from '../dataProvider'; | ||
import { HTMLDataProvider } from '../dataProvider'; | ||
import { ITagData, IAttributeData } from '../../htmlLanguageTypes'; | ||
export declare function getHTML5DataProvider(): HTMLDataProvider; | ||
export declare const HTML5_TAGS: ITagEntryData[]; | ||
export declare const HTML5_GLOBAL_ATTRIBUTES: IEntryData[]; | ||
export declare const HTML5_EVENTS: IEntryData[]; | ||
export declare const HTML5_TAGS: ITagData[]; | ||
export declare const HTML5_GLOBAL_ATTRIBUTES: IAttributeData[]; | ||
export declare const HTML5_EVENTS: IAttributeData[]; | ||
export declare const HTML5_VALUE_MAP: { | ||
@@ -7,0 +8,0 @@ b: { |
@@ -1,2 +0,2 @@ | ||
import { IHTMLDataProvider } from '../dataProvider'; | ||
import { IHTMLDataProvider } from '../../htmlLanguageTypes'; | ||
export declare function getRazorDataProvider(): IHTMLDataProvider; |
@@ -16,28 +16,31 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var RAZOR_TAGS = { | ||
a: ['asp-action', 'asp-controller', 'asp-fragment', 'asp-host', 'asp-protocol', 'asp-route'], | ||
div: ['asp-validation-summary'], | ||
form: ['asp-action', 'asp-controller', 'asp-anti-forgery'], | ||
input: ['asp-for', 'asp-format'], | ||
label: ['asp-for'], | ||
select: ['asp-for', 'asp-items'], | ||
span: ['asp-validation-for'] | ||
}; | ||
function getRazorDataProvider() { | ||
var customTags = { | ||
a: ['asp-action', 'asp-controller', 'asp-fragment', 'asp-host', 'asp-protocol', 'asp-route'], | ||
div: ['asp-validation-summary'], | ||
form: ['asp-action', 'asp-controller', 'asp-anti-forgery'], | ||
input: ['asp-for', 'asp-format'], | ||
label: ['asp-for'], | ||
select: ['asp-for', 'asp-items'], | ||
span: ['asp-validation-for'] | ||
}; | ||
return { | ||
getId: function () { return 'razor'; }, | ||
isApplicable: function (languageId) { return languageId === 'razor'; }, | ||
collectTags: function (collector) { | ||
// no extra tags | ||
provideTags: function () { | ||
return []; | ||
}, | ||
collectAttributes: function (tag, collector) { | ||
if (tag) { | ||
var attributes = customTags[tag]; | ||
if (attributes) { | ||
attributes.forEach(function (a) { return collector(a); }); | ||
} | ||
provideAttributes: function (tag) { | ||
var attributes = RAZOR_TAGS[tag]; | ||
if (!attributes) { | ||
return []; | ||
} | ||
return attributes.map(function (a) { | ||
return { | ||
name: a | ||
}; | ||
}); | ||
}, | ||
collectValues: function (tag, attribute, collector) { | ||
// no values | ||
provideValues: function (tag, attribute) { | ||
return []; | ||
} | ||
@@ -44,0 +47,0 @@ }; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "../utils/strings"], factory); | ||
define(["require", "exports"], factory); | ||
} | ||
@@ -17,3 +17,2 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var strings_1 = require("../utils/strings"); | ||
var HTMLDataProvider = /** @class */ (function () { | ||
@@ -25,3 +24,3 @@ function HTMLDataProvider(id, customData) { | ||
this._attributeMap = {}; | ||
this._valueSetMap = {}; | ||
this._valueSets = {}; | ||
this._tags = customData.tags || []; | ||
@@ -38,4 +37,4 @@ this._globalAttributes = customData.globalAttributes || []; | ||
}); | ||
if (customData.valueSetMap) { | ||
this._valueSetMap = customData.valueSetMap; | ||
if (customData.valueSets) { | ||
this._valueSets = customData.valueSets; | ||
} | ||
@@ -49,16 +48,13 @@ } | ||
}; | ||
HTMLDataProvider.prototype.collectTags = function (collector) { | ||
this._tags.forEach(function (t) { | ||
collector(t.name, t.description); | ||
}); | ||
HTMLDataProvider.prototype.provideTags = function () { | ||
return this._tags; | ||
}; | ||
HTMLDataProvider.prototype.collectAttributes = function (tag, collector) { | ||
HTMLDataProvider.prototype.provideAttributes = function (tag) { | ||
var attributes = []; | ||
var processAttribute = function (a) { | ||
if (a.name.indexOf(':') !== -1) { | ||
var _a = a.name.split(':'), aName = _a[0], aSetName = _a[1]; | ||
collector(aName, aSetName, a.description); | ||
} | ||
else { | ||
collector(a.name, undefined, a.description); | ||
} | ||
attributes.push({ | ||
name: a.name, | ||
description: a.description, | ||
valueSet: a.valueSet | ||
}); | ||
}; | ||
@@ -73,21 +69,19 @@ if (this._tagMap[tag]) { | ||
}); | ||
return attributes; | ||
}; | ||
HTMLDataProvider.prototype.collectValues = function (tag, attribute, collector) { | ||
HTMLDataProvider.prototype.provideValues = function (tag, attribute) { | ||
var _this = this; | ||
var values = []; | ||
var processAttributes = function (attributes) { | ||
attributes.forEach(function (a) { | ||
if (a.values) { | ||
a.values.forEach(function (v) { | ||
collector(v.name); | ||
}); | ||
} | ||
if (strings_1.startsWith(a.name, attribute + ':')) { | ||
var setName = a.name.split(':')[1]; | ||
if (setName === 'v') { | ||
collector(attribute); | ||
if (a.name === attribute) { | ||
if (a.values) { | ||
a.values.forEach(function (v) { | ||
values.push(v); | ||
}); | ||
} | ||
else { | ||
if (setName && _this._valueSetMap[setName]) { | ||
_this._valueSetMap[setName].forEach(function (v) { | ||
collector(v.name); | ||
if (a.valueSet) { | ||
if (_this._valueSets[a.valueSet]) { | ||
_this._valueSets[a.valueSet].forEach(function (v) { | ||
values.push(v); | ||
}); | ||
@@ -99,6 +93,8 @@ } | ||
}; | ||
if (this._tagMap[tag]) { | ||
processAttributes(this._tagMap[tag].attributes); | ||
if (!this._tagMap[tag]) { | ||
return []; | ||
} | ||
processAttributes(this._tagMap[tag].attributes); | ||
processAttributes(this._globalAttributes); | ||
return values; | ||
}; | ||
@@ -105,0 +101,0 @@ return HTMLDataProvider; |
@@ -38,3 +38,3 @@ (function (factory) { | ||
var completionParticipants = this.completionParticipants; | ||
var tagProviders = languageFacts_2.getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); }); | ||
var dataProviders = languageFacts_2.getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); }); | ||
var text = document.getText(); | ||
@@ -58,9 +58,9 @@ var offset = document.offsetAt(position); | ||
var range = getReplaceRange(afterOpenBracket, tagNameEnd); | ||
tagProviders.forEach(function (provider) { | ||
provider.collectTags(function (tag, description) { | ||
dataProviders.forEach(function (provider) { | ||
provider.provideTags().forEach(function (tag) { | ||
result.items.push({ | ||
label: tag, | ||
label: tag.name, | ||
kind: vscode_languageserver_types_1.CompletionItemKind.Property, | ||
documentation: description, | ||
textEdit: vscode_languageserver_types_1.TextEdit.replace(range, tag), | ||
documentation: tag.description, | ||
textEdit: vscode_languageserver_types_1.TextEdit.replace(range, tag.name), | ||
insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.PlainText | ||
@@ -119,8 +119,8 @@ }); | ||
} | ||
tagProviders.forEach(function (provider) { | ||
provider.collectTags(function (tag, description) { | ||
dataProviders.forEach(function (provider) { | ||
provider.provideTags().forEach(function (tag) { | ||
result.items.push({ | ||
label: '/' + tag, | ||
label: '/' + tag.name, | ||
kind: vscode_languageserver_types_1.CompletionItemKind.Property, | ||
documentation: description, | ||
documentation: tag.description, | ||
filterText: '/' + tag + closeTag, | ||
@@ -165,13 +165,13 @@ textEdit: vscode_languageserver_types_1.TextEdit.replace(range, '/' + tag + closeTag), | ||
var seenAttributes = Object.create(null); | ||
tagProviders.forEach(function (provider) { | ||
provider.collectAttributes(tag, function (attribute, type, description) { | ||
if (seenAttributes[attribute]) { | ||
dataProviders.forEach(function (provider) { | ||
provider.provideAttributes(tag).forEach(function (attr) { | ||
if (seenAttributes[attr.name]) { | ||
return; | ||
} | ||
seenAttributes[attribute] = true; | ||
var codeSnippet = attribute; | ||
seenAttributes[attr.name] = true; | ||
var codeSnippet = attr.name; | ||
var command; | ||
if (type !== 'v' && value.length) { | ||
if (attr.valueSet !== 'v' && value.length) { | ||
codeSnippet = codeSnippet + value; | ||
if (type) { | ||
if (attr.valueSet) { | ||
command = { | ||
@@ -184,5 +184,5 @@ title: 'Suggest', | ||
result.items.push({ | ||
label: attribute, | ||
kind: type === 'handler' ? vscode_languageserver_types_1.CompletionItemKind.Function : vscode_languageserver_types_1.CompletionItemKind.Value, | ||
documentation: description, | ||
label: attr.name, | ||
kind: attr.valueSet === 'handler' ? vscode_languageserver_types_1.CompletionItemKind.Function : vscode_languageserver_types_1.CompletionItemKind.Value, | ||
documentation: attr.description, | ||
textEdit: vscode_languageserver_types_1.TextEdit.replace(range, codeSnippet), | ||
@@ -254,8 +254,7 @@ insertTextFormat: vscode_languageserver_types_1.InsertTextFormat.Snippet, | ||
} | ||
var value = scanner.getTokenText(); | ||
tagProviders.forEach(function (provider) { | ||
provider.collectValues(tag, attribute, function (value) { | ||
var insertText = addQuotes ? '"' + value + '"' : value; | ||
dataProviders.forEach(function (provider) { | ||
provider.provideValues(tag, attribute).forEach(function (value) { | ||
var insertText = addQuotes ? '"' + value.name + '"' : value.name; | ||
result.items.push({ | ||
label: value, | ||
label: value.name, | ||
filterText: insertText, | ||
@@ -262,0 +261,0 @@ kind: vscode_languageserver_types_1.CompletionItemKind.Unit, |
@@ -26,12 +26,12 @@ (function (factory) { | ||
} | ||
var tagProviders = languageFacts_1.getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId); }); | ||
function getTagHover(tag, range, open) { | ||
tag = tag.toLowerCase(); | ||
var dataProviders = languageFacts_1.getAllDataProviders().filter(function (p) { return p.isApplicable(document.languageId); }); | ||
function getTagHover(currTag, range, open) { | ||
currTag = currTag.toLowerCase(); | ||
var _loop_1 = function (provider) { | ||
var hover = null; | ||
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(description)], range: range }; | ||
provider.provideTags().forEach(function (tag) { | ||
if (tag.name.toLowerCase() === currTag.toLowerCase()) { | ||
var tagLabel = open ? '<' + currTag + '>' : '</' + currTag + '>'; | ||
var tagDescription = tag.description || ''; | ||
hover = { contents: [{ language: 'html', value: tagLabel }, vscode_languageserver_types_1.MarkedString.fromPlainText(tagDescription)], range: range }; | ||
} | ||
@@ -43,4 +43,4 @@ }); | ||
}; | ||
for (var _i = 0, tagProviders_1 = tagProviders; _i < tagProviders_1.length; _i++) { | ||
var provider = tagProviders_1[_i]; | ||
for (var _i = 0, dataProviders_1 = dataProviders; _i < dataProviders_1.length; _i++) { | ||
var provider = dataProviders_1[_i]; | ||
var state_1 = _loop_1(provider); | ||
@@ -47,0 +47,0 @@ if (typeof state_1 === "object") |
{ | ||
"name": "vscode-html-languageservice", | ||
"version": "2.1.11-next.5", | ||
"version": "2.1.11-next.6", | ||
"description": "Language service for HTML", | ||
@@ -5,0 +5,0 @@ "main": "./lib/umd/htmlLanguageService.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
758226
66
19853