How to use the vscode-html-languageservice/lib/umd/languageFacts/data/html5.HTML5_VALUE_MAP.map function in vscode-html-languageservice

To help you get started, we’ve selected a few vscode-html-languageservice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github runem / lit-analyzer / packages / lit-analyzer / src / analyze / data / get-built-in-html-collection.ts View on Github external
export function getBuiltInHtmlCollection(): HtmlDataCollection {
	// Combine data with extra html5 events because vscode-html-language-service hasn't included all events yet.
	const ALL_HTML5_EVENTS: typeof HTML5_EVENTS = [
		...HTML5_EVENTS,
		...EXTRA_HTML5_EVENTS.filter(evt => HTML5_EVENTS.find(existingEvt => existingEvt.name === evt.name) == null)
	];

	// It seems like the autocompletion value map for <select>, </select><textarea> and &lt;input&gt; needs "on" and "off" values
	const EXTENDED_HTML5_VALUE_MAP = HTML5_VALUE_MAP.map(VALUE_MAP =&gt; {
		switch (VALUE_MAP.name) {
			case "inputautocomplete":
				return {
					...VALUE_MAP,
					values: [{ name: "on" }, { name: "off" }, ...VALUE_MAP.values]
				};
			default:
				return VALUE_MAP;
		}
	});

	const result = parseHtmlData({
		version: 1,
		tags: HTML5_TAGS,
		globalAttributes: [...HTML5_GLOBAL_ATTRIBUTES, ...ALL_HTML5_EVENTS, ...ARIA_ATTRIBUTES],
		valueSets: EXTENDED_HTML5_VALUE_MAP</textarea>