@coherent.js/language-server 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/analysis/coherent-analyzer.d.ts +93 -0
- package/dist/analysis/coherent-analyzer.d.ts.map +1 -0
- package/dist/analysis/coherent-analyzer.js +288 -0
- package/dist/analysis/coherent-analyzer.js.map +1 -0
- package/dist/analysis/element-validator.d.ts +45 -0
- package/dist/analysis/element-validator.d.ts.map +1 -0
- package/dist/analysis/element-validator.js +84 -0
- package/dist/analysis/element-validator.js.map +1 -0
- package/dist/analysis/nesting-validator.d.ts +49 -0
- package/dist/analysis/nesting-validator.d.ts.map +1 -0
- package/dist/analysis/nesting-validator.js +68 -0
- package/dist/analysis/nesting-validator.js.map +1 -0
- package/dist/data/element-attributes.d.ts +92 -0
- package/dist/data/element-attributes.d.ts.map +1 -0
- package/dist/data/element-attributes.generated.json +7085 -0
- package/dist/data/element-attributes.js +282 -0
- package/dist/data/element-attributes.js.map +1 -0
- package/dist/data/nesting-rules.d.ts +67 -0
- package/dist/data/nesting-rules.d.ts.map +1 -0
- package/dist/data/nesting-rules.js +240 -0
- package/dist/data/nesting-rules.js.map +1 -0
- package/dist/providers/code-actions.d.ts +15 -0
- package/dist/providers/code-actions.d.ts.map +1 -0
- package/dist/providers/code-actions.js +191 -0
- package/dist/providers/code-actions.js.map +1 -0
- package/dist/providers/completion.d.ts +15 -0
- package/dist/providers/completion.d.ts.map +1 -0
- package/dist/providers/completion.js +247 -0
- package/dist/providers/completion.js.map +1 -0
- package/dist/providers/diagnostics.d.ts +26 -0
- package/dist/providers/diagnostics.d.ts.map +1 -0
- package/dist/providers/diagnostics.js +143 -0
- package/dist/providers/diagnostics.js.map +1 -0
- package/dist/providers/hover.d.ts +15 -0
- package/dist/providers/hover.d.ts.map +1 -0
- package/dist/providers/hover.js +215 -0
- package/dist/providers/hover.js.map +1 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +82 -0
- package/dist/server.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element attribute data for the Coherent.js Language Server
|
|
3
|
+
*
|
|
4
|
+
* This module provides runtime access to HTML element attribute information,
|
|
5
|
+
* imported from the generated JSON file created by extract-attributes.ts.
|
|
6
|
+
*
|
|
7
|
+
* The data is extracted at build time from packages/core/types/elements.d.ts
|
|
8
|
+
* to maintain a single source of truth for element definitions.
|
|
9
|
+
*/
|
|
10
|
+
import { createRequire } from 'module';
|
|
11
|
+
// Use createRequire to import JSON in ESM
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
// Load generated data or use fallback
|
|
14
|
+
let data;
|
|
15
|
+
try {
|
|
16
|
+
data = require('./element-attributes.generated.json');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// Fallback for development when generated file doesn't exist
|
|
20
|
+
data = {
|
|
21
|
+
elements: {},
|
|
22
|
+
voidElements: ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'],
|
|
23
|
+
globalAttributes: [
|
|
24
|
+
{ name: 'id', type: 'string', optional: true },
|
|
25
|
+
{ name: 'className', type: 'string', optional: true },
|
|
26
|
+
{ name: 'class', type: 'string', optional: true },
|
|
27
|
+
{ name: 'style', type: 'string | Record<string, string | number>', optional: true },
|
|
28
|
+
{ name: 'title', type: 'string', optional: true },
|
|
29
|
+
{ name: 'hidden', type: 'boolean', optional: true },
|
|
30
|
+
{ name: 'tabIndex', type: 'number', optional: true },
|
|
31
|
+
{ name: 'key', type: 'string | number', optional: true },
|
|
32
|
+
{ name: 'text', type: 'string | number', optional: true },
|
|
33
|
+
{ name: 'html', type: 'string', optional: true },
|
|
34
|
+
{ name: 'children', type: 'CoherentChild | CoherentChild[]', optional: true },
|
|
35
|
+
],
|
|
36
|
+
eventHandlers: [
|
|
37
|
+
{ name: 'onClick', type: 'string | ((event: MouseEvent) => void)', optional: true },
|
|
38
|
+
{ name: 'onChange', type: 'string | ((event: Event) => void)', optional: true },
|
|
39
|
+
{ name: 'onSubmit', type: 'string | ((event: SubmitEvent) => void)', optional: true },
|
|
40
|
+
],
|
|
41
|
+
generatedAt: 'fallback',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Set of all valid HTML element tag names.
|
|
46
|
+
*/
|
|
47
|
+
export const HTML_ELEMENTS = new Set([
|
|
48
|
+
// Always include core elements
|
|
49
|
+
'div', 'span', 'p', 'a', 'button', 'input', 'img', 'form',
|
|
50
|
+
'ul', 'ol', 'li', 'table', 'tr', 'td', 'th', 'thead', 'tbody',
|
|
51
|
+
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
|
52
|
+
'section', 'article', 'header', 'footer', 'nav', 'main', 'aside',
|
|
53
|
+
'label', 'select', 'option', 'textarea', 'fieldset', 'legend',
|
|
54
|
+
'video', 'audio', 'source', 'canvas', 'iframe',
|
|
55
|
+
'script', 'style', 'link', 'meta',
|
|
56
|
+
'br', 'hr', 'pre', 'code', 'em', 'strong', 'small', 'mark',
|
|
57
|
+
'figure', 'figcaption', 'blockquote', 'cite',
|
|
58
|
+
'details', 'summary', 'dialog', 'menu',
|
|
59
|
+
'time', 'progress', 'meter', 'output', 'datalist',
|
|
60
|
+
'dl', 'dt', 'dd', 'address', 'abbr', 'dfn', 'sub', 'sup',
|
|
61
|
+
'i', 'b', 'u', 's', 'kbd', 'samp', 'var', 'ruby', 'rt', 'rp',
|
|
62
|
+
'bdi', 'bdo', 'wbr', 'data', 'embed', 'object', 'param',
|
|
63
|
+
'map', 'area', 'track', 'picture', 'col', 'colgroup', 'caption',
|
|
64
|
+
'tfoot', 'optgroup', 'html', 'head', 'body', 'title', 'base',
|
|
65
|
+
'template', 'slot', 'noscript', 'hgroup', 'search',
|
|
66
|
+
// Add any elements from generated data
|
|
67
|
+
...Object.keys(data.elements),
|
|
68
|
+
]);
|
|
69
|
+
/**
|
|
70
|
+
* Set of void elements that cannot have children.
|
|
71
|
+
*/
|
|
72
|
+
export const VOID_ELEMENTS = new Set(data.voidElements);
|
|
73
|
+
/**
|
|
74
|
+
* Coherent.js specific properties that can appear on any element.
|
|
75
|
+
*/
|
|
76
|
+
const COHERENT_PROPERTIES = [
|
|
77
|
+
{ name: 'text', type: 'string | number', optional: true, description: 'Text content (escaped during render)' },
|
|
78
|
+
{ name: 'html', type: 'string', optional: true, description: 'Raw HTML content (not escaped - use with caution)' },
|
|
79
|
+
{ name: 'children', type: 'CoherentChild | CoherentChild[]', optional: true, description: 'Child elements' },
|
|
80
|
+
{ name: 'key', type: 'string | number', optional: true, description: 'Unique key for list reconciliation' },
|
|
81
|
+
];
|
|
82
|
+
/**
|
|
83
|
+
* Get all valid attributes for a given HTML element.
|
|
84
|
+
*
|
|
85
|
+
* Returns element-specific attributes combined with global attributes,
|
|
86
|
+
* event handlers, and Coherent.js properties.
|
|
87
|
+
*
|
|
88
|
+
* @param tagName - The HTML element tag name (e.g., 'div', 'input')
|
|
89
|
+
* @returns Array of attribute information
|
|
90
|
+
*/
|
|
91
|
+
export function getAttributesForElement(tagName) {
|
|
92
|
+
const elementInfo = data.elements[tagName];
|
|
93
|
+
const attributes = [];
|
|
94
|
+
const seenNames = new Set();
|
|
95
|
+
// Add element-specific attributes first
|
|
96
|
+
if (elementInfo) {
|
|
97
|
+
for (const attr of elementInfo.attributes) {
|
|
98
|
+
if (!seenNames.has(attr.name)) {
|
|
99
|
+
attributes.push(attr);
|
|
100
|
+
seenNames.add(attr.name);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Add global HTML attributes
|
|
105
|
+
for (const attr of data.globalAttributes) {
|
|
106
|
+
if (!seenNames.has(attr.name)) {
|
|
107
|
+
attributes.push(attr);
|
|
108
|
+
seenNames.add(attr.name);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Add event handlers
|
|
112
|
+
for (const attr of data.eventHandlers) {
|
|
113
|
+
if (!seenNames.has(attr.name)) {
|
|
114
|
+
attributes.push(attr);
|
|
115
|
+
seenNames.add(attr.name);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Add Coherent-specific properties (unless void element)
|
|
119
|
+
if (!isVoidElement(tagName)) {
|
|
120
|
+
for (const attr of COHERENT_PROPERTIES) {
|
|
121
|
+
if (!seenNames.has(attr.name)) {
|
|
122
|
+
attributes.push(attr);
|
|
123
|
+
seenNames.add(attr.name);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Void elements can still have text/html but not children
|
|
129
|
+
for (const attr of COHERENT_PROPERTIES) {
|
|
130
|
+
if (attr.name !== 'children' && !seenNames.has(attr.name)) {
|
|
131
|
+
attributes.push(attr);
|
|
132
|
+
seenNames.add(attr.name);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return attributes;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Check if an element is a void element (cannot have children).
|
|
140
|
+
*
|
|
141
|
+
* @param tagName - The HTML element tag name
|
|
142
|
+
* @returns true if the element is a void element
|
|
143
|
+
*/
|
|
144
|
+
export function isVoidElement(tagName) {
|
|
145
|
+
return VOID_ELEMENTS.has(tagName);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Check if an attribute is valid for a given element.
|
|
149
|
+
*
|
|
150
|
+
* @param tagName - The HTML element tag name
|
|
151
|
+
* @param attributeName - The attribute name to check
|
|
152
|
+
* @returns true if the attribute is valid for the element
|
|
153
|
+
*/
|
|
154
|
+
export function isValidAttribute(tagName, attributeName) {
|
|
155
|
+
// Always allow data-* attributes
|
|
156
|
+
if (attributeName.startsWith('data-')) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
// Always allow aria-* attributes
|
|
160
|
+
if (attributeName.startsWith('aria-')) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
const validAttrs = getAttributesForElement(tagName);
|
|
164
|
+
return validAttrs.some(attr => attr.name === attributeName);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get suggestions for a potentially misspelled attribute name.
|
|
168
|
+
*
|
|
169
|
+
* Uses Levenshtein distance to find similar attribute names.
|
|
170
|
+
*
|
|
171
|
+
* @param tagName - The HTML element tag name
|
|
172
|
+
* @param attributeName - The potentially misspelled attribute name
|
|
173
|
+
* @param maxDistance - Maximum edit distance for suggestions (default: 3)
|
|
174
|
+
* @returns Array of suggested attribute names, sorted by distance
|
|
175
|
+
*/
|
|
176
|
+
export function getSuggestions(tagName, attributeName, maxDistance = 3) {
|
|
177
|
+
const validAttrs = getAttributesForElement(tagName);
|
|
178
|
+
const suggestions = [];
|
|
179
|
+
for (const attr of validAttrs) {
|
|
180
|
+
// Skip exact matches
|
|
181
|
+
if (attr.name === attributeName) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
// Check for case-insensitive match (common typo)
|
|
185
|
+
if (attr.name.toLowerCase() === attributeName.toLowerCase()) {
|
|
186
|
+
// Case mismatch is treated as distance 1
|
|
187
|
+
suggestions.push({ name: attr.name, distance: 1 });
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
// Calculate edit distance
|
|
191
|
+
const distance = levenshteinDistance(attributeName.toLowerCase(), attr.name.toLowerCase());
|
|
192
|
+
if (distance <= maxDistance && distance > 0) {
|
|
193
|
+
suggestions.push({ name: attr.name, distance });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return suggestions
|
|
197
|
+
.sort((a, b) => a.distance - b.distance)
|
|
198
|
+
.slice(0, 3)
|
|
199
|
+
.map(s => s.name);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Calculate Levenshtein distance between two strings.
|
|
203
|
+
*/
|
|
204
|
+
function levenshteinDistance(a, b) {
|
|
205
|
+
if (a.length === 0)
|
|
206
|
+
return b.length;
|
|
207
|
+
if (b.length === 0)
|
|
208
|
+
return a.length;
|
|
209
|
+
const matrix = [];
|
|
210
|
+
for (let i = 0; i <= b.length; i++) {
|
|
211
|
+
matrix[i] = [i];
|
|
212
|
+
}
|
|
213
|
+
for (let j = 0; j <= a.length; j++) {
|
|
214
|
+
matrix[0][j] = j;
|
|
215
|
+
}
|
|
216
|
+
for (let i = 1; i <= b.length; i++) {
|
|
217
|
+
for (let j = 1; j <= a.length; j++) {
|
|
218
|
+
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
219
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
|
223
|
+
matrix[i][j - 1] + 1, // insertion
|
|
224
|
+
matrix[i - 1][j] + 1 // deletion
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return matrix[b.length][a.length];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get the type description for an attribute.
|
|
233
|
+
*
|
|
234
|
+
* @param tagName - The HTML element tag name
|
|
235
|
+
* @param attributeName - The attribute name
|
|
236
|
+
* @returns Type string or undefined if attribute not found
|
|
237
|
+
*/
|
|
238
|
+
export function getAttributeType(tagName, attributeName) {
|
|
239
|
+
const validAttrs = getAttributesForElement(tagName);
|
|
240
|
+
const attr = validAttrs.find(a => a.name === attributeName);
|
|
241
|
+
return attr?.type;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get the description for an attribute.
|
|
245
|
+
*
|
|
246
|
+
* @param tagName - The HTML element tag name
|
|
247
|
+
* @param attributeName - The attribute name
|
|
248
|
+
* @returns Description string or undefined if not available
|
|
249
|
+
*/
|
|
250
|
+
export function getAttributeDescription(tagName, attributeName) {
|
|
251
|
+
const validAttrs = getAttributesForElement(tagName);
|
|
252
|
+
const attr = validAttrs.find(a => a.name === attributeName);
|
|
253
|
+
return attr?.description;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Get element-specific description for hover documentation.
|
|
257
|
+
*/
|
|
258
|
+
export function getElementDescription(tagName) {
|
|
259
|
+
const descriptions = {
|
|
260
|
+
div: 'Generic container element for flow content',
|
|
261
|
+
span: 'Generic inline container for phrasing content',
|
|
262
|
+
p: 'Paragraph element for text content',
|
|
263
|
+
a: 'Anchor element for creating hyperlinks',
|
|
264
|
+
button: 'Clickable button for forms and actions',
|
|
265
|
+
input: 'Input control for forms (void element)',
|
|
266
|
+
img: 'Image embedding element (void element)',
|
|
267
|
+
form: 'Form container for submitting user data',
|
|
268
|
+
ul: 'Unordered list container',
|
|
269
|
+
ol: 'Ordered list container',
|
|
270
|
+
li: 'List item element',
|
|
271
|
+
table: 'Table container for tabular data',
|
|
272
|
+
section: 'Generic section of a document',
|
|
273
|
+
article: 'Self-contained composition in a document',
|
|
274
|
+
header: 'Introductory content or navigational aids',
|
|
275
|
+
footer: 'Footer for nearest sectioning content',
|
|
276
|
+
nav: 'Navigation links section',
|
|
277
|
+
main: 'Main content of the document body',
|
|
278
|
+
aside: 'Content tangentially related to surrounding content',
|
|
279
|
+
};
|
|
280
|
+
return descriptions[tagName] || `HTML <${tagName}> element`;
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=element-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-attributes.js","sourceRoot":"","sources":["../../src/data/element-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,0CAA0C;AAC1C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAuB/C,sCAAsC;AACtC,IAAI,IAAmB,CAAC;AAExB,IAAI,CAAC;IACH,IAAI,GAAG,OAAO,CAA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AK,EAAE,kCAAkC;QACzC,OAAO,EAAE,+BAA+B;QACxC,OAAO,EAAE,0CAA0C;QACnD,MAAM,EAAE,2CAA2C;QACnD,MAAM,EAAE,uCAAuC;QAC/C,GAAG,EAAE,0BAA0B;QAC/B,IAAI,EAAE,mCAAmC;QACzC,KAAK,EAAE,qDAAqD;KAC7D,CAAC;IAEF,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,SAAS,OAAO,WAAW,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML5 Nesting Validation Rules
|
|
3
|
+
*
|
|
4
|
+
* Based on the HTML5 specification content model requirements.
|
|
5
|
+
* These rules detect invalid parent/child relationships before runtime.
|
|
6
|
+
*/
|
|
7
|
+
export interface NestingRule {
|
|
8
|
+
/**
|
|
9
|
+
* Parent elements that are forbidden for this element.
|
|
10
|
+
* If the element appears inside any of these parents, it's an error.
|
|
11
|
+
*/
|
|
12
|
+
forbiddenParents?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Parent elements that are required for this element.
|
|
15
|
+
* If specified, the element MUST be a direct child of one of these.
|
|
16
|
+
*/
|
|
17
|
+
allowedParents?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether this element can contain block-level elements.
|
|
20
|
+
* If false, block elements inside will produce warnings.
|
|
21
|
+
*/
|
|
22
|
+
canContainBlocks?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Additional error message context.
|
|
25
|
+
*/
|
|
26
|
+
message?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Block-level elements that should not appear inside inline elements.
|
|
30
|
+
*/
|
|
31
|
+
export declare const BLOCK_ELEMENTS: Set<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Inline elements that cannot contain block-level elements.
|
|
34
|
+
*/
|
|
35
|
+
export declare const INLINE_ELEMENTS: Set<string>;
|
|
36
|
+
/**
|
|
37
|
+
* HTML5 nesting rules for specific elements.
|
|
38
|
+
*/
|
|
39
|
+
export declare const NESTING_RULES: Record<string, NestingRule>;
|
|
40
|
+
export interface ValidationError {
|
|
41
|
+
message: string;
|
|
42
|
+
severity: 'error' | 'warning';
|
|
43
|
+
code: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Validate nesting of an element within a parent.
|
|
47
|
+
*
|
|
48
|
+
* @param childTag - The child element tag name
|
|
49
|
+
* @param parentTag - The parent element tag name (or null for root)
|
|
50
|
+
* @returns Array of validation errors (empty if valid)
|
|
51
|
+
*/
|
|
52
|
+
export declare function validateNesting(childTag: string, parentTag: string | null): ValidationError[];
|
|
53
|
+
/**
|
|
54
|
+
* Get all valid parent elements for a given element.
|
|
55
|
+
*
|
|
56
|
+
* @param tagName - The element tag name
|
|
57
|
+
* @returns Array of valid parent tag names, or null if any parent is valid
|
|
58
|
+
*/
|
|
59
|
+
export declare function getValidParents(tagName: string): string[] | null;
|
|
60
|
+
/**
|
|
61
|
+
* Check if an element has nesting restrictions.
|
|
62
|
+
*
|
|
63
|
+
* @param tagName - The element tag name
|
|
64
|
+
* @returns true if the element has specific nesting rules
|
|
65
|
+
*/
|
|
66
|
+
export declare function hasNestingRestrictions(tagName: string): boolean;
|
|
67
|
+
//# sourceMappingURL=nesting-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nesting-rules.d.ts","sourceRoot":"","sources":["../../src/data/nesting-rules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,aAQzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,aAK1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAuJrD,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,EAAE,CA+C7F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAGhE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE/D"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML5 Nesting Validation Rules
|
|
3
|
+
*
|
|
4
|
+
* Based on the HTML5 specification content model requirements.
|
|
5
|
+
* These rules detect invalid parent/child relationships before runtime.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Block-level elements that should not appear inside inline elements.
|
|
9
|
+
*/
|
|
10
|
+
export const BLOCK_ELEMENTS = new Set([
|
|
11
|
+
'div', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
|
12
|
+
'ul', 'ol', 'li', 'dl', 'dt', 'dd',
|
|
13
|
+
'table', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th',
|
|
14
|
+
'form', 'fieldset', 'legend',
|
|
15
|
+
'section', 'article', 'aside', 'header', 'footer', 'nav', 'main',
|
|
16
|
+
'figure', 'figcaption', 'blockquote', 'pre', 'address',
|
|
17
|
+
'details', 'dialog', 'menu', 'hgroup', 'search',
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* Inline elements that cannot contain block-level elements.
|
|
21
|
+
*/
|
|
22
|
+
export const INLINE_ELEMENTS = new Set([
|
|
23
|
+
'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small',
|
|
24
|
+
'mark', 'abbr', 'cite', 'code', 'dfn', 'kbd', 'samp', 'var',
|
|
25
|
+
'sub', 'sup', 'q', 'time', 'data', 'bdi', 'bdo', 'ruby', 'rt', 'rp',
|
|
26
|
+
'label',
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* HTML5 nesting rules for specific elements.
|
|
30
|
+
*/
|
|
31
|
+
export const NESTING_RULES = {
|
|
32
|
+
// Block elements cannot be inside inline elements
|
|
33
|
+
div: {
|
|
34
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label'],
|
|
35
|
+
message: 'Block-level element cannot be nested inside inline element',
|
|
36
|
+
},
|
|
37
|
+
section: {
|
|
38
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label'],
|
|
39
|
+
message: 'Block-level element cannot be nested inside inline element',
|
|
40
|
+
},
|
|
41
|
+
article: {
|
|
42
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label'],
|
|
43
|
+
message: 'Block-level element cannot be nested inside inline element',
|
|
44
|
+
},
|
|
45
|
+
aside: {
|
|
46
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label'],
|
|
47
|
+
message: 'Block-level element cannot be nested inside inline element',
|
|
48
|
+
},
|
|
49
|
+
header: {
|
|
50
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label', 'header', 'footer'],
|
|
51
|
+
message: 'Block-level element cannot be nested inside inline element; header cannot be inside header/footer',
|
|
52
|
+
},
|
|
53
|
+
footer: {
|
|
54
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label', 'header', 'footer'],
|
|
55
|
+
message: 'Block-level element cannot be nested inside inline element; footer cannot be inside header/footer',
|
|
56
|
+
},
|
|
57
|
+
nav: {
|
|
58
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label'],
|
|
59
|
+
message: 'Block-level element cannot be nested inside inline element',
|
|
60
|
+
},
|
|
61
|
+
main: {
|
|
62
|
+
forbiddenParents: ['p', 'span', 'a', 'em', 'strong', 'b', 'i', 'u', 's', 'small', 'label', 'article', 'aside', 'footer', 'header', 'nav'],
|
|
63
|
+
message: 'main element cannot be nested inside sectioning content',
|
|
64
|
+
},
|
|
65
|
+
// <p> cannot nest inside <p> (auto-closes)
|
|
66
|
+
p: {
|
|
67
|
+
forbiddenParents: ['p'],
|
|
68
|
+
canContainBlocks: false,
|
|
69
|
+
message: '<p> cannot be nested inside another <p> element',
|
|
70
|
+
},
|
|
71
|
+
// List items must be in lists
|
|
72
|
+
li: {
|
|
73
|
+
allowedParents: ['ul', 'ol', 'menu'],
|
|
74
|
+
message: '<li> must be a direct child of <ul>, <ol>, or <menu>',
|
|
75
|
+
},
|
|
76
|
+
dt: {
|
|
77
|
+
allowedParents: ['dl'],
|
|
78
|
+
message: '<dt> must be a direct child of <dl>',
|
|
79
|
+
},
|
|
80
|
+
dd: {
|
|
81
|
+
allowedParents: ['dl'],
|
|
82
|
+
message: '<dd> must be a direct child of <dl>',
|
|
83
|
+
},
|
|
84
|
+
// Table structure
|
|
85
|
+
tr: {
|
|
86
|
+
allowedParents: ['table', 'thead', 'tbody', 'tfoot'],
|
|
87
|
+
message: '<tr> must be a direct child of <table>, <thead>, <tbody>, or <tfoot>',
|
|
88
|
+
},
|
|
89
|
+
td: {
|
|
90
|
+
allowedParents: ['tr'],
|
|
91
|
+
message: '<td> must be a direct child of <tr>',
|
|
92
|
+
},
|
|
93
|
+
th: {
|
|
94
|
+
allowedParents: ['tr'],
|
|
95
|
+
message: '<th> must be a direct child of <tr>',
|
|
96
|
+
},
|
|
97
|
+
thead: {
|
|
98
|
+
allowedParents: ['table'],
|
|
99
|
+
message: '<thead> must be a direct child of <table>',
|
|
100
|
+
},
|
|
101
|
+
tbody: {
|
|
102
|
+
allowedParents: ['table'],
|
|
103
|
+
message: '<tbody> must be a direct child of <table>',
|
|
104
|
+
},
|
|
105
|
+
tfoot: {
|
|
106
|
+
allowedParents: ['table'],
|
|
107
|
+
message: '<tfoot> must be a direct child of <table>',
|
|
108
|
+
},
|
|
109
|
+
caption: {
|
|
110
|
+
allowedParents: ['table'],
|
|
111
|
+
message: '<caption> must be a direct child of <table>',
|
|
112
|
+
},
|
|
113
|
+
colgroup: {
|
|
114
|
+
allowedParents: ['table'],
|
|
115
|
+
message: '<colgroup> must be a direct child of <table>',
|
|
116
|
+
},
|
|
117
|
+
col: {
|
|
118
|
+
allowedParents: ['colgroup', 'table'],
|
|
119
|
+
message: '<col> must be a direct child of <colgroup> or <table>',
|
|
120
|
+
},
|
|
121
|
+
// Form elements
|
|
122
|
+
option: {
|
|
123
|
+
allowedParents: ['select', 'optgroup', 'datalist'],
|
|
124
|
+
message: '<option> must be a direct child of <select>, <optgroup>, or <datalist>',
|
|
125
|
+
},
|
|
126
|
+
optgroup: {
|
|
127
|
+
allowedParents: ['select'],
|
|
128
|
+
message: '<optgroup> must be a direct child of <select>',
|
|
129
|
+
},
|
|
130
|
+
legend: {
|
|
131
|
+
allowedParents: ['fieldset'],
|
|
132
|
+
message: '<legend> must be a direct child of <fieldset>',
|
|
133
|
+
},
|
|
134
|
+
// Details/Summary
|
|
135
|
+
summary: {
|
|
136
|
+
allowedParents: ['details'],
|
|
137
|
+
message: '<summary> must be a direct child of <details>',
|
|
138
|
+
},
|
|
139
|
+
// Ruby annotations
|
|
140
|
+
rt: {
|
|
141
|
+
allowedParents: ['ruby'],
|
|
142
|
+
message: '<rt> must be a direct child of <ruby>',
|
|
143
|
+
},
|
|
144
|
+
rp: {
|
|
145
|
+
allowedParents: ['ruby'],
|
|
146
|
+
message: '<rp> must be a direct child of <ruby>',
|
|
147
|
+
},
|
|
148
|
+
// Figure
|
|
149
|
+
figcaption: {
|
|
150
|
+
allowedParents: ['figure'],
|
|
151
|
+
message: '<figcaption> must be a direct child of <figure>',
|
|
152
|
+
},
|
|
153
|
+
// Source and track
|
|
154
|
+
source: {
|
|
155
|
+
allowedParents: ['audio', 'video', 'picture'],
|
|
156
|
+
message: '<source> must be a direct child of <audio>, <video>, or <picture>',
|
|
157
|
+
},
|
|
158
|
+
track: {
|
|
159
|
+
allowedParents: ['audio', 'video'],
|
|
160
|
+
message: '<track> must be a direct child of <audio> or <video>',
|
|
161
|
+
},
|
|
162
|
+
// Area
|
|
163
|
+
area: {
|
|
164
|
+
allowedParents: ['map'],
|
|
165
|
+
message: '<area> must be a direct child of <map>',
|
|
166
|
+
},
|
|
167
|
+
// Param (deprecated but still supported)
|
|
168
|
+
param: {
|
|
169
|
+
allowedParents: ['object'],
|
|
170
|
+
message: '<param> must be a direct child of <object>',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Validate nesting of an element within a parent.
|
|
175
|
+
*
|
|
176
|
+
* @param childTag - The child element tag name
|
|
177
|
+
* @param parentTag - The parent element tag name (or null for root)
|
|
178
|
+
* @returns Array of validation errors (empty if valid)
|
|
179
|
+
*/
|
|
180
|
+
export function validateNesting(childTag, parentTag) {
|
|
181
|
+
const errors = [];
|
|
182
|
+
if (!parentTag) {
|
|
183
|
+
return errors; // Root elements have no parent to check
|
|
184
|
+
}
|
|
185
|
+
const rules = NESTING_RULES[childTag];
|
|
186
|
+
// Check forbidden parents
|
|
187
|
+
if (rules?.forbiddenParents?.includes(parentTag)) {
|
|
188
|
+
errors.push({
|
|
189
|
+
message: rules.message || `<${childTag}> cannot be nested inside <${parentTag}>`,
|
|
190
|
+
severity: 'error',
|
|
191
|
+
code: 'invalid-nesting',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// Check required parents
|
|
195
|
+
if (rules?.allowedParents && !rules.allowedParents.includes(parentTag)) {
|
|
196
|
+
errors.push({
|
|
197
|
+
message: rules.message || `<${childTag}> must be a direct child of ${rules.allowedParents.map(p => `<${p}>`).join(', ')}`,
|
|
198
|
+
severity: 'error',
|
|
199
|
+
code: 'invalid-parent',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// Check block-in-inline (if not already caught by forbiddenParents)
|
|
203
|
+
if (!rules && BLOCK_ELEMENTS.has(childTag) && INLINE_ELEMENTS.has(parentTag)) {
|
|
204
|
+
errors.push({
|
|
205
|
+
message: `Block-level element <${childTag}> should not be nested inside inline element <${parentTag}>`,
|
|
206
|
+
severity: 'warning',
|
|
207
|
+
code: 'block-in-inline',
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
// Check canContainBlocks rule for parent
|
|
211
|
+
const parentRules = NESTING_RULES[parentTag];
|
|
212
|
+
if (parentRules?.canContainBlocks === false && BLOCK_ELEMENTS.has(childTag)) {
|
|
213
|
+
errors.push({
|
|
214
|
+
message: `<${parentTag}> should not contain block-level element <${childTag}>`,
|
|
215
|
+
severity: 'warning',
|
|
216
|
+
code: 'invalid-child',
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return errors;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get all valid parent elements for a given element.
|
|
223
|
+
*
|
|
224
|
+
* @param tagName - The element tag name
|
|
225
|
+
* @returns Array of valid parent tag names, or null if any parent is valid
|
|
226
|
+
*/
|
|
227
|
+
export function getValidParents(tagName) {
|
|
228
|
+
const rules = NESTING_RULES[tagName];
|
|
229
|
+
return rules?.allowedParents || null;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Check if an element has nesting restrictions.
|
|
233
|
+
*
|
|
234
|
+
* @param tagName - The element tag name
|
|
235
|
+
* @returns true if the element has specific nesting rules
|
|
236
|
+
*/
|
|
237
|
+
export function hasNestingRestrictions(tagName) {
|
|
238
|
+
return tagName in NESTING_RULES;
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=nesting-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nesting-rules.js","sourceRoot":"","sources":["../../src/data/nesting-rules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IACpC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC9C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACpD,MAAM,EAAE,UAAU,EAAE,QAAQ;IAC5B,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM;IAChE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IACtD,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;CAChD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IACrC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO;IACxD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAC3D,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI;IACnE,OAAO;CACR,CAAC,CA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
*
|
|
4
|
+
* Provides quick fix code actions for validation errors.
|
|
5
|
+
*/
|
|
6
|
+
import { Connection, TextDocuments } from 'vscode-languageserver';
|
|
7
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
8
|
+
/**
|
|
9
|
+
* Register the code action provider.
|
|
10
|
+
*
|
|
11
|
+
* @param connection - LSP connection
|
|
12
|
+
* @param documents - Text document manager
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerCodeActionProvider(connection: Connection, documents: TextDocuments<TextDocument>): void;
|
|
15
|
+
//# sourceMappingURL=code-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-actions.d.ts","sourceRoot":"","sources":["../../src/providers/code-actions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,UAAU,EACV,aAAa,EAMd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC,GACrC,IAAI,CAqBN"}
|