@marko/language-server 1.2.1 → 1.3.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/dist/index.js +355 -484
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +356 -486
- package/dist/index.mjs.map +3 -3
- package/dist/service/html/axe-rules/axe-rules.d.ts +205 -180
- package/dist/service/html/axe-rules/rule-exceptions.d.ts +1 -1
- package/package.json +14 -15
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
2
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
3
|
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
6
|
});
|
|
8
7
|
|
|
@@ -111,12 +110,10 @@ function getAllOpen() {
|
|
|
111
110
|
}
|
|
112
111
|
function get(uri) {
|
|
113
112
|
const doc = docs.get(uri);
|
|
114
|
-
if (doc)
|
|
115
|
-
return doc;
|
|
113
|
+
if (doc) return doc;
|
|
116
114
|
const { fsPath, scheme } = URI2.parse(uri);
|
|
117
115
|
if (scheme === "file") {
|
|
118
|
-
if (fileExists.get(uri) === false)
|
|
119
|
-
return void 0;
|
|
116
|
+
if (fileExists.get(uri) === false) return void 0;
|
|
120
117
|
try {
|
|
121
118
|
const newDoc = TextDocument.create(
|
|
122
119
|
uri,
|
|
@@ -134,8 +131,7 @@ function get(uri) {
|
|
|
134
131
|
}
|
|
135
132
|
function exists(uri) {
|
|
136
133
|
const cached = fileExists.get(uri);
|
|
137
|
-
if (cached !== void 0)
|
|
138
|
-
return cached;
|
|
134
|
+
if (cached !== void 0) return cached;
|
|
139
135
|
const { fsPath, scheme } = URI2.parse(uri);
|
|
140
136
|
if (scheme === "file") {
|
|
141
137
|
try {
|
|
@@ -284,8 +280,7 @@ function display(type, data) {
|
|
|
284
280
|
const msg = typeof data === "string" ? data : inspect(data, { colors: false });
|
|
285
281
|
const previousMessages = previousMessagesByType.get(type);
|
|
286
282
|
if (previousMessages) {
|
|
287
|
-
if (previousMessages.includes(msg))
|
|
288
|
-
return;
|
|
283
|
+
if (previousMessages.includes(msg)) return;
|
|
289
284
|
previousMessages.push(msg);
|
|
290
285
|
if (previousMessages.length > 3) {
|
|
291
286
|
previousMessages.unshift();
|
|
@@ -307,505 +302,530 @@ import { JSDOM } from "jsdom";
|
|
|
307
302
|
// src/service/html/axe-rules/axe-rules.ts
|
|
308
303
|
var keyboard = {
|
|
309
304
|
/**
|
|
310
|
-
* -
|
|
311
|
-
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
305
|
+
* - Ensure every accesskey attribute value is unique
|
|
306
|
+
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.10/accesskeys?application=axeAPI))
|
|
312
307
|
*/
|
|
313
308
|
accesskeys: "accesskeys",
|
|
314
309
|
/**
|
|
315
|
-
* -
|
|
316
|
-
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
310
|
+
* - Ensure each page has at least one mechanism for a user to bypass navigation and jump straight to the content
|
|
311
|
+
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.10/bypass?application=axeAPI))
|
|
317
312
|
*/
|
|
318
313
|
bypass: "bypass",
|
|
319
314
|
/**
|
|
320
|
-
* -
|
|
321
|
-
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
315
|
+
* - Ensure elements in the focus order have a role appropriate for interactive content
|
|
316
|
+
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.10/focus-order-semantics?application=axeAPI))
|
|
322
317
|
*/
|
|
323
318
|
focusOrderSemantics: "focus-order-semantics",
|
|
324
319
|
/**
|
|
325
|
-
* -
|
|
326
|
-
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.
|
|
320
|
+
* - Ensure `<frame>` and `<iframe>` elements with focusable content do not have tabindex=-1
|
|
321
|
+
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.10/frame-focusable-content?application=axeAPI))
|
|
327
322
|
*/
|
|
328
323
|
frameFocusableContent: "frame-focusable-content",
|
|
329
324
|
/**
|
|
330
|
-
* -
|
|
331
|
-
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.
|
|
325
|
+
* - Ensure interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies
|
|
326
|
+
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.10/nested-interactive?application=axeAPI))
|
|
332
327
|
*/
|
|
333
328
|
nestedInteractive: "nested-interactive",
|
|
334
329
|
/**
|
|
335
|
-
* -
|
|
336
|
-
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
330
|
+
* - Ensure all page content is contained by landmarks
|
|
331
|
+
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.10/region?application=axeAPI))
|
|
337
332
|
*/
|
|
338
333
|
region: "region",
|
|
339
334
|
/**
|
|
340
335
|
* - Ensure elements that have scrollable content are accessible by keyboard
|
|
341
|
-
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.
|
|
336
|
+
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.10/scrollable-region-focusable?application=axeAPI))
|
|
342
337
|
*/
|
|
343
338
|
scrollableRegionFocusable: "scrollable-region-focusable",
|
|
344
339
|
/**
|
|
345
340
|
* - Ensure all skip links have a focusable target
|
|
346
|
-
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.
|
|
341
|
+
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.10/skip-link?application=axeAPI))
|
|
347
342
|
*/
|
|
348
343
|
skipLink: "skip-link",
|
|
349
344
|
/**
|
|
350
|
-
* -
|
|
351
|
-
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.
|
|
345
|
+
* - Ensure tabindex attribute values are not greater than 0
|
|
346
|
+
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.10/tabindex?application=axeAPI))
|
|
352
347
|
*/
|
|
353
348
|
tabindex: "tabindex"
|
|
354
349
|
};
|
|
355
350
|
var textAlternatives = {
|
|
356
351
|
/**
|
|
357
|
-
* -
|
|
358
|
-
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
352
|
+
* - Ensure `<area>` elements of image maps have alternate text
|
|
353
|
+
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/area-alt?application=axeAPI))
|
|
359
354
|
*/
|
|
360
355
|
areaAlt: "area-alt",
|
|
361
356
|
/**
|
|
362
|
-
* -
|
|
363
|
-
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
357
|
+
* - Ensure each HTML document contains a non-empty `<title>` element
|
|
358
|
+
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.10/document-title?application=axeAPI))
|
|
364
359
|
*/
|
|
365
360
|
documentTitle: "document-title",
|
|
366
361
|
/**
|
|
367
|
-
* -
|
|
368
|
-
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
362
|
+
* - Ensure `<iframe>` and `<frame>` elements contain a unique title attribute
|
|
363
|
+
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.10/frame-title-unique?application=axeAPI))
|
|
369
364
|
*/
|
|
370
365
|
frameTitleUnique: "frame-title-unique",
|
|
371
366
|
/**
|
|
372
|
-
* -
|
|
373
|
-
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
367
|
+
* - Ensure `<iframe>` and `<frame>` elements have an accessible name
|
|
368
|
+
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/frame-title?application=axeAPI))
|
|
374
369
|
*/
|
|
375
370
|
frameTitle: "frame-title",
|
|
376
371
|
/**
|
|
377
|
-
* -
|
|
378
|
-
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
372
|
+
* - Ensure `<img>` elements have alternate text or a role of none or presentation
|
|
373
|
+
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/image-alt?application=axeAPI))
|
|
379
374
|
*/
|
|
380
375
|
imageAlt: "image-alt",
|
|
381
376
|
/**
|
|
382
377
|
* - Ensure image alternative is not repeated as text
|
|
383
|
-
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
378
|
+
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.10/image-redundant-alt?application=axeAPI))
|
|
384
379
|
*/
|
|
385
380
|
imageRedundantAlt: "image-redundant-alt",
|
|
386
381
|
/**
|
|
387
|
-
* -
|
|
388
|
-
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
382
|
+
* - Ensure `<input type="image">` elements have alternate text
|
|
383
|
+
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/input-image-alt?application=axeAPI))
|
|
389
384
|
*/
|
|
390
385
|
inputImageAlt: "input-image-alt",
|
|
391
386
|
/**
|
|
392
|
-
* -
|
|
393
|
-
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
387
|
+
* - Ensure `<object>` elements have alternate text
|
|
388
|
+
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/object-alt?application=axeAPI))
|
|
394
389
|
*/
|
|
395
390
|
objectAlt: "object-alt",
|
|
396
391
|
/**
|
|
397
|
-
* -
|
|
398
|
-
* - [role=
|
|
392
|
+
* - Ensure [role="img"] elements have alternate text
|
|
393
|
+
* - [role="img"] elements must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.10/role-img-alt?application=axeAPI))
|
|
399
394
|
*/
|
|
400
395
|
roleImgAlt: "role-img-alt",
|
|
401
396
|
/**
|
|
402
|
-
* -
|
|
403
|
-
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
397
|
+
* - Ensure that server-side image maps are not used
|
|
398
|
+
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/server-side-image-map?application=axeAPI))
|
|
404
399
|
*/
|
|
405
400
|
serverSideImageMap: "server-side-image-map",
|
|
406
401
|
/**
|
|
407
|
-
* -
|
|
408
|
-
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
402
|
+
* - Ensure `<svg>` elements with an img, graphics-document or graphics-symbol role have an accessible text
|
|
403
|
+
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.10/svg-img-alt?application=axeAPI))
|
|
409
404
|
*/
|
|
410
405
|
svgImgAlt: "svg-img-alt",
|
|
411
406
|
/**
|
|
412
|
-
* -
|
|
413
|
-
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.
|
|
407
|
+
* - Ensure `<video>` elements have captions
|
|
408
|
+
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.10/video-caption?application=axeAPI))
|
|
414
409
|
*/
|
|
415
410
|
videoCaption: "video-caption"
|
|
416
411
|
};
|
|
417
412
|
var aria = {
|
|
418
413
|
/**
|
|
419
|
-
* -
|
|
420
|
-
* - Elements must only use
|
|
414
|
+
* - Ensure an element's role supports its ARIA attributes
|
|
415
|
+
* - Elements must only use supported ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.10/aria-allowed-attr?application=axeAPI))
|
|
421
416
|
*/
|
|
422
417
|
ariaAllowedAttr: "aria-allowed-attr",
|
|
423
418
|
/**
|
|
424
|
-
* -
|
|
425
|
-
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.
|
|
419
|
+
* - Ensure role attribute has an appropriate value for the element
|
|
420
|
+
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.10/aria-allowed-role?application=axeAPI))
|
|
426
421
|
*/
|
|
427
422
|
ariaAllowedRole: "aria-allowed-role",
|
|
428
423
|
/**
|
|
429
|
-
* -
|
|
430
|
-
* -
|
|
424
|
+
* - Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent
|
|
425
|
+
* - aria-braille attributes must have a non-braille equivalent ([url](https://dequeuniversity.com/rules/axe/4.10/aria-braille-equivalent?application=axeAPI))
|
|
426
|
+
*/
|
|
427
|
+
ariaBrailleEquivalent: "aria-braille-equivalent",
|
|
428
|
+
/**
|
|
429
|
+
* - Ensure every ARIA button, link and menuitem has an accessible name
|
|
430
|
+
* - ARIA commands must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-command-name?application=axeAPI))
|
|
431
431
|
*/
|
|
432
432
|
ariaCommandName: "aria-command-name",
|
|
433
433
|
/**
|
|
434
|
-
* -
|
|
435
|
-
* - ARIA
|
|
434
|
+
* - Ensure ARIA attributes are used as described in the specification of the element's role
|
|
435
|
+
* - ARIA attributes must be used as specified for the element's role ([url](https://dequeuniversity.com/rules/axe/4.10/aria-conditional-attr?application=axeAPI))
|
|
436
|
+
*/
|
|
437
|
+
ariaConditionalAttr: "aria-conditional-attr",
|
|
438
|
+
/**
|
|
439
|
+
* - Ensure elements do not use deprecated roles
|
|
440
|
+
* - Deprecated ARIA roles must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/aria-deprecated-role?application=axeAPI))
|
|
441
|
+
*/
|
|
442
|
+
ariaDeprecatedRole: "aria-deprecated-role",
|
|
443
|
+
/**
|
|
444
|
+
* - Ensure every ARIA dialog and alertdialog node has an accessible name
|
|
445
|
+
* - ARIA dialog and alertdialog nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-dialog-name?application=axeAPI))
|
|
436
446
|
*/
|
|
437
447
|
ariaDialogName: "aria-dialog-name",
|
|
438
448
|
/**
|
|
439
|
-
* -
|
|
440
|
-
* - aria-hidden=
|
|
449
|
+
* - Ensure aria-hidden="true" is not present on the document body.
|
|
450
|
+
* - aria-hidden="true" must not be present on the document body ([url](https://dequeuniversity.com/rules/axe/4.10/aria-hidden-body?application=axeAPI))
|
|
441
451
|
*/
|
|
442
452
|
ariaHiddenBody: "aria-hidden-body",
|
|
443
453
|
/**
|
|
444
|
-
* -
|
|
445
|
-
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
454
|
+
* - Ensure every ARIA input field has an accessible name
|
|
455
|
+
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-input-field-name?application=axeAPI))
|
|
446
456
|
*/
|
|
447
457
|
ariaInputFieldName: "aria-input-field-name",
|
|
448
458
|
/**
|
|
449
|
-
* -
|
|
450
|
-
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
459
|
+
* - Ensure every ARIA meter node has an accessible name
|
|
460
|
+
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-meter-name?application=axeAPI))
|
|
451
461
|
*/
|
|
452
462
|
ariaMeterName: "aria-meter-name",
|
|
453
463
|
/**
|
|
454
|
-
* -
|
|
455
|
-
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
464
|
+
* - Ensure every ARIA progressbar node has an accessible name
|
|
465
|
+
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-progressbar-name?application=axeAPI))
|
|
456
466
|
*/
|
|
457
467
|
ariaProgressbarName: "aria-progressbar-name",
|
|
458
468
|
/**
|
|
459
|
-
* -
|
|
460
|
-
* -
|
|
469
|
+
* - Ensure ARIA attributes are not prohibited for an element's role
|
|
470
|
+
* - Elements must only use permitted ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.10/aria-prohibited-attr?application=axeAPI))
|
|
471
|
+
*/
|
|
472
|
+
ariaProhibitedAttr: "aria-prohibited-attr",
|
|
473
|
+
/**
|
|
474
|
+
* - Ensure elements with ARIA roles have all required ARIA attributes
|
|
475
|
+
* - Required ARIA attributes must be provided ([url](https://dequeuniversity.com/rules/axe/4.10/aria-required-attr?application=axeAPI))
|
|
461
476
|
*/
|
|
462
477
|
ariaRequiredAttr: "aria-required-attr",
|
|
463
478
|
/**
|
|
464
|
-
* -
|
|
465
|
-
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.
|
|
479
|
+
* - Ensure elements with an ARIA role that require child roles contain them
|
|
480
|
+
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.10/aria-required-children?application=axeAPI))
|
|
466
481
|
*/
|
|
467
482
|
ariaRequiredChildren: "aria-required-children",
|
|
468
483
|
/**
|
|
469
|
-
* -
|
|
470
|
-
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.
|
|
484
|
+
* - Ensure elements with an ARIA role that require parent roles are contained by them
|
|
485
|
+
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.10/aria-required-parent?application=axeAPI))
|
|
471
486
|
*/
|
|
472
487
|
ariaRequiredParent: "aria-required-parent",
|
|
473
488
|
/**
|
|
474
489
|
* - Ensure aria-roledescription is only used on elements with an implicit or explicit role
|
|
475
|
-
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
490
|
+
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.10/aria-roledescription?application=axeAPI))
|
|
476
491
|
*/
|
|
477
492
|
ariaRoledescription: "aria-roledescription",
|
|
478
493
|
/**
|
|
479
|
-
* -
|
|
480
|
-
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
494
|
+
* - Ensure all elements with a role attribute use a valid value
|
|
495
|
+
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.10/aria-roles?application=axeAPI))
|
|
481
496
|
*/
|
|
482
497
|
ariaRoles: "aria-roles",
|
|
483
498
|
/**
|
|
484
|
-
* -
|
|
485
|
-
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.
|
|
499
|
+
* - Ensure role="text" is used on elements with no focusable descendants
|
|
500
|
+
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.10/aria-text?application=axeAPI))
|
|
486
501
|
*/
|
|
487
502
|
ariaText: "aria-text",
|
|
488
503
|
/**
|
|
489
|
-
* -
|
|
490
|
-
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
504
|
+
* - Ensure every ARIA toggle field has an accessible name
|
|
505
|
+
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-toggle-field-name?application=axeAPI))
|
|
491
506
|
*/
|
|
492
507
|
ariaToggleFieldName: "aria-toggle-field-name",
|
|
493
508
|
/**
|
|
494
|
-
* -
|
|
495
|
-
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
509
|
+
* - Ensure every ARIA tooltip node has an accessible name
|
|
510
|
+
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-tooltip-name?application=axeAPI))
|
|
496
511
|
*/
|
|
497
512
|
ariaTooltipName: "aria-tooltip-name",
|
|
498
513
|
/**
|
|
499
|
-
* -
|
|
500
|
-
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
514
|
+
* - Ensure every ARIA treeitem node has an accessible name
|
|
515
|
+
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-treeitem-name?application=axeAPI))
|
|
501
516
|
*/
|
|
502
517
|
ariaTreeitemName: "aria-treeitem-name",
|
|
503
518
|
/**
|
|
504
|
-
* -
|
|
505
|
-
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
519
|
+
* - Ensure all ARIA attributes have valid values
|
|
520
|
+
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.10/aria-valid-attr-value?application=axeAPI))
|
|
506
521
|
*/
|
|
507
522
|
ariaValidAttrValue: "aria-valid-attr-value",
|
|
508
523
|
/**
|
|
509
|
-
* -
|
|
510
|
-
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.
|
|
524
|
+
* - Ensure attributes that begin with aria- are valid ARIA attributes
|
|
525
|
+
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.10/aria-valid-attr?application=axeAPI))
|
|
511
526
|
*/
|
|
512
527
|
ariaValidAttr: "aria-valid-attr",
|
|
513
528
|
/**
|
|
514
529
|
* - Elements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them
|
|
515
|
-
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.
|
|
530
|
+
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.10/presentation-role-conflict?application=axeAPI))
|
|
516
531
|
*/
|
|
517
532
|
presentationRoleConflict: "presentation-role-conflict"
|
|
518
533
|
};
|
|
519
534
|
var nameRoleValue = {
|
|
520
535
|
/**
|
|
521
|
-
* -
|
|
522
|
-
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
536
|
+
* - Ensure aria-hidden elements are not focusable nor contain focusable elements
|
|
537
|
+
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI))
|
|
523
538
|
*/
|
|
524
539
|
ariaHiddenFocus: "aria-hidden-focus",
|
|
525
540
|
/**
|
|
526
|
-
* -
|
|
527
|
-
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
541
|
+
* - Ensure buttons have discernible text
|
|
542
|
+
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/button-name?application=axeAPI))
|
|
528
543
|
*/
|
|
529
544
|
buttonName: "button-name",
|
|
530
545
|
/**
|
|
531
|
-
* -
|
|
532
|
-
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
546
|
+
* - Ensure headings have discernible text
|
|
547
|
+
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.10/empty-heading?application=axeAPI))
|
|
533
548
|
*/
|
|
534
549
|
emptyHeading: "empty-heading",
|
|
535
550
|
/**
|
|
536
|
-
* -
|
|
537
|
-
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
551
|
+
* - Ensure table headers have discernible text
|
|
552
|
+
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.10/empty-table-header?application=axeAPI))
|
|
538
553
|
*/
|
|
539
554
|
emptyTableHeader: "empty-table-header",
|
|
540
555
|
/**
|
|
541
|
-
* -
|
|
542
|
-
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
556
|
+
* - Ensure input buttons have discernible text
|
|
557
|
+
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/input-button-name?application=axeAPI))
|
|
543
558
|
*/
|
|
544
559
|
inputButtonName: "input-button-name",
|
|
545
560
|
/**
|
|
546
|
-
* -
|
|
547
|
-
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
561
|
+
* - Ensure links have discernible text
|
|
562
|
+
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/link-name?application=axeAPI))
|
|
563
|
+
*/
|
|
564
|
+
linkName: "link-name",
|
|
565
|
+
/**
|
|
566
|
+
* - Ensure summary elements have discernible text
|
|
567
|
+
* - Summary elements must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/summary-name?application=axeAPI))
|
|
548
568
|
*/
|
|
549
|
-
|
|
569
|
+
summaryName: "summary-name"
|
|
550
570
|
};
|
|
551
571
|
var timeAndMedia = {
|
|
552
572
|
/**
|
|
553
|
-
* -
|
|
554
|
-
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.
|
|
573
|
+
* - Ensure `<audio>` elements have captions
|
|
574
|
+
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.10/audio-caption?application=axeAPI))
|
|
555
575
|
*/
|
|
556
576
|
audioCaption: "audio-caption",
|
|
557
577
|
/**
|
|
558
|
-
* -
|
|
559
|
-
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
578
|
+
* - Ensure `<blink>` elements are not used
|
|
579
|
+
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/blink?application=axeAPI))
|
|
560
580
|
*/
|
|
561
581
|
blink: "blink",
|
|
562
582
|
/**
|
|
563
|
-
* -
|
|
564
|
-
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
583
|
+
* - Ensure `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
584
|
+
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/meta-refresh-no-exceptions?application=axeAPI))
|
|
565
585
|
*/
|
|
566
586
|
metaRefreshNoExceptions: "meta-refresh-no-exceptions",
|
|
567
587
|
/**
|
|
568
|
-
* -
|
|
569
|
-
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
588
|
+
* - Ensure `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
589
|
+
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/meta-refresh?application=axeAPI))
|
|
570
590
|
*/
|
|
571
591
|
metaRefresh: "meta-refresh",
|
|
572
592
|
/**
|
|
573
|
-
* -
|
|
574
|
-
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.
|
|
593
|
+
* - Ensure `<video>` or `<audio>` elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio
|
|
594
|
+
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.10/no-autoplay-audio?application=axeAPI))
|
|
575
595
|
*/
|
|
576
596
|
noAutoplayAudio: "no-autoplay-audio"
|
|
577
597
|
};
|
|
578
598
|
var forms = {
|
|
579
599
|
/**
|
|
580
600
|
* - Ensure the autocomplete attribute is correct and suitable for the form field
|
|
581
|
-
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
601
|
+
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.10/autocomplete-valid?application=axeAPI))
|
|
582
602
|
*/
|
|
583
603
|
autocompleteValid: "autocomplete-valid",
|
|
584
604
|
/**
|
|
585
|
-
* -
|
|
586
|
-
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
605
|
+
* - Ensure form field does not have multiple label elements
|
|
606
|
+
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.10/form-field-multiple-labels?application=axeAPI))
|
|
587
607
|
*/
|
|
588
608
|
formFieldMultipleLabels: "form-field-multiple-labels",
|
|
589
609
|
/**
|
|
590
|
-
* -
|
|
591
|
-
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.
|
|
610
|
+
* - Ensure that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes
|
|
611
|
+
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.10/label-title-only?application=axeAPI))
|
|
592
612
|
*/
|
|
593
613
|
labelTitleOnly: "label-title-only",
|
|
594
614
|
/**
|
|
595
|
-
* -
|
|
596
|
-
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.
|
|
615
|
+
* - Ensure every form element has a label
|
|
616
|
+
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.10/label?application=axeAPI))
|
|
597
617
|
*/
|
|
598
618
|
label: "label",
|
|
599
619
|
/**
|
|
600
|
-
* -
|
|
601
|
-
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
620
|
+
* - Ensure select element has an accessible name
|
|
621
|
+
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/select-name?application=axeAPI))
|
|
602
622
|
*/
|
|
603
623
|
selectName: "select-name"
|
|
604
624
|
};
|
|
605
625
|
var structure = {
|
|
606
626
|
/**
|
|
607
627
|
* - Ensure that text spacing set through style attributes can be adjusted with custom stylesheets
|
|
608
|
-
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.
|
|
628
|
+
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.10/avoid-inline-spacing?application=axeAPI))
|
|
609
629
|
*/
|
|
610
630
|
avoidInlineSpacing: "avoid-inline-spacing",
|
|
611
631
|
/**
|
|
612
|
-
* -
|
|
613
|
-
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
632
|
+
* - Ensure content is not locked to any specific display orientation, and the content is operable in all display orientations
|
|
633
|
+
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.10/css-orientation-lock?application=axeAPI))
|
|
614
634
|
*/
|
|
615
635
|
cssOrientationLock: "css-orientation-lock",
|
|
616
636
|
/**
|
|
617
|
-
* -
|
|
618
|
-
* - `<dl>` elements must only directly contain properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
637
|
+
* - Ensure `<dl>` elements are structured correctly
|
|
638
|
+
* - `<dl>` elements must only directly contain properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements ([url](https://dequeuniversity.com/rules/axe/4.10/definition-list?application=axeAPI))
|
|
619
639
|
*/
|
|
620
640
|
definitionList: "definition-list",
|
|
621
641
|
/**
|
|
622
|
-
* -
|
|
623
|
-
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
642
|
+
* - Ensure `<dt>` and `<dd>` elements are contained by a `<dl>`
|
|
643
|
+
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.10/dlitem?application=axeAPI))
|
|
624
644
|
*/
|
|
625
645
|
dlitem: "dlitem",
|
|
626
646
|
/**
|
|
627
|
-
* -
|
|
628
|
-
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.
|
|
647
|
+
* - Ensure `<iframe>` and `<frame>` elements contain the axe-core script
|
|
648
|
+
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.10/frame-tested?application=axeAPI))
|
|
629
649
|
*/
|
|
630
650
|
frameTested: "frame-tested",
|
|
631
651
|
/**
|
|
632
652
|
* - Informs users about hidden content.
|
|
633
|
-
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.
|
|
653
|
+
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.10/hidden-content?application=axeAPI))
|
|
634
654
|
*/
|
|
635
655
|
hiddenContent: "hidden-content",
|
|
636
656
|
/**
|
|
637
|
-
* -
|
|
638
|
-
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
657
|
+
* - Ensure that lists are structured correctly
|
|
658
|
+
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.10/list?application=axeAPI))
|
|
639
659
|
*/
|
|
640
660
|
list: "list",
|
|
641
661
|
/**
|
|
642
|
-
* -
|
|
643
|
-
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
662
|
+
* - Ensure `<li>` elements are used semantically
|
|
663
|
+
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.10/listitem?application=axeAPI))
|
|
644
664
|
*/
|
|
645
665
|
listitem: "listitem"
|
|
646
666
|
};
|
|
647
667
|
var parsing = {
|
|
648
668
|
/**
|
|
649
|
-
* -
|
|
650
|
-
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
669
|
+
* - Ensure every id attribute value of active elements is unique
|
|
670
|
+
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.10/duplicate-id-active?application=axeAPI))
|
|
651
671
|
*/
|
|
652
672
|
duplicateIdActive: "duplicate-id-active",
|
|
653
673
|
/**
|
|
654
|
-
* -
|
|
655
|
-
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
674
|
+
* - Ensure every id attribute value used in ARIA and in labels is unique
|
|
675
|
+
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.10/duplicate-id-aria?application=axeAPI))
|
|
656
676
|
*/
|
|
657
677
|
duplicateIdAria: "duplicate-id-aria",
|
|
658
678
|
/**
|
|
659
|
-
* -
|
|
660
|
-
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
679
|
+
* - Ensure every id attribute value is unique
|
|
680
|
+
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.10/duplicate-id?application=axeAPI))
|
|
661
681
|
*/
|
|
662
682
|
duplicateId: "duplicate-id",
|
|
663
683
|
/**
|
|
664
|
-
* -
|
|
665
|
-
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
684
|
+
* - Ensure `<marquee>` elements are not used
|
|
685
|
+
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/marquee?application=axeAPI))
|
|
666
686
|
*/
|
|
667
687
|
marquee: "marquee"
|
|
668
688
|
};
|
|
669
689
|
var semantics = {
|
|
670
690
|
/**
|
|
671
|
-
* -
|
|
672
|
-
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.
|
|
691
|
+
* - Ensure the order of headings is semantically correct
|
|
692
|
+
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.10/heading-order?application=axeAPI))
|
|
673
693
|
*/
|
|
674
694
|
headingOrder: "heading-order",
|
|
675
695
|
/**
|
|
676
696
|
* - Ensure that links with the same accessible name serve a similar purpose
|
|
677
|
-
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.
|
|
697
|
+
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.10/identical-links-same-purpose?application=axeAPI))
|
|
678
698
|
*/
|
|
679
699
|
identicalLinksSamePurpose: "identical-links-same-purpose",
|
|
680
700
|
/**
|
|
681
|
-
* -
|
|
682
|
-
* - Elements must have their visible text as part of their accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
701
|
+
* - Ensure that elements labelled through their content must have their visible text as part of their accessible name
|
|
702
|
+
* - Elements must have their visible text as part of their accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/label-content-name-mismatch?application=axeAPI))
|
|
683
703
|
*/
|
|
684
704
|
labelContentNameMismatch: "label-content-name-mismatch",
|
|
685
705
|
/**
|
|
686
|
-
* -
|
|
687
|
-
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
706
|
+
* - Ensure the banner landmark is at top level
|
|
707
|
+
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-banner-is-top-level?application=axeAPI))
|
|
688
708
|
*/
|
|
689
709
|
landmarkBannerIsTopLevel: "landmark-banner-is-top-level",
|
|
690
710
|
/**
|
|
691
|
-
* -
|
|
692
|
-
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
711
|
+
* - Ensure the complementary landmark or aside is at top level
|
|
712
|
+
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-complementary-is-top-level?application=axeAPI))
|
|
693
713
|
*/
|
|
694
714
|
landmarkComplementaryIsTopLevel: "landmark-complementary-is-top-level",
|
|
695
715
|
/**
|
|
696
|
-
* -
|
|
697
|
-
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
716
|
+
* - Ensure the contentinfo landmark is at top level
|
|
717
|
+
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-contentinfo-is-top-level?application=axeAPI))
|
|
698
718
|
*/
|
|
699
719
|
landmarkContentinfoIsTopLevel: "landmark-contentinfo-is-top-level",
|
|
700
720
|
/**
|
|
701
|
-
* -
|
|
702
|
-
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
721
|
+
* - Ensure the main landmark is at top level
|
|
722
|
+
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-main-is-top-level?application=axeAPI))
|
|
703
723
|
*/
|
|
704
724
|
landmarkMainIsTopLevel: "landmark-main-is-top-level",
|
|
705
725
|
/**
|
|
706
|
-
* -
|
|
707
|
-
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
726
|
+
* - Ensure the document has at most one banner landmark
|
|
727
|
+
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-no-duplicate-banner?application=axeAPI))
|
|
708
728
|
*/
|
|
709
729
|
landmarkNoDuplicateBanner: "landmark-no-duplicate-banner",
|
|
710
730
|
/**
|
|
711
|
-
* -
|
|
712
|
-
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
731
|
+
* - Ensure the document has at most one contentinfo landmark
|
|
732
|
+
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-no-duplicate-contentinfo?application=axeAPI))
|
|
713
733
|
*/
|
|
714
734
|
landmarkNoDuplicateContentinfo: "landmark-no-duplicate-contentinfo",
|
|
715
735
|
/**
|
|
716
|
-
* -
|
|
717
|
-
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
736
|
+
* - Ensure the document has at most one main landmark
|
|
737
|
+
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-no-duplicate-main?application=axeAPI))
|
|
718
738
|
*/
|
|
719
739
|
landmarkNoDuplicateMain: "landmark-no-duplicate-main",
|
|
720
740
|
/**
|
|
721
|
-
* -
|
|
722
|
-
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
741
|
+
* - Ensure the document has a main landmark
|
|
742
|
+
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-one-main?application=axeAPI))
|
|
723
743
|
*/
|
|
724
744
|
landmarkOneMain: "landmark-one-main",
|
|
725
745
|
/**
|
|
726
|
-
* -
|
|
727
|
-
* -
|
|
746
|
+
* - Ensure landmarks are unique
|
|
747
|
+
* - Landmarks should have a unique role or role/label/title (i.e. accessible name) combination ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-unique?application=axeAPI))
|
|
728
748
|
*/
|
|
729
749
|
landmarkUnique: "landmark-unique",
|
|
730
750
|
/**
|
|
731
751
|
* - Ensure bold, italic text and font-size is not used to style `<p>` elements as a heading
|
|
732
|
-
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.
|
|
752
|
+
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.10/p-as-heading?application=axeAPI))
|
|
733
753
|
*/
|
|
734
754
|
pAsHeading: "p-as-heading",
|
|
735
755
|
/**
|
|
736
756
|
* - Ensure that the page, or at least one of its frames contains a level-one heading
|
|
737
|
-
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.
|
|
757
|
+
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.10/page-has-heading-one?application=axeAPI))
|
|
738
758
|
*/
|
|
739
759
|
pageHasHeadingOne: "page-has-heading-one"
|
|
740
760
|
};
|
|
741
761
|
var language = {
|
|
742
762
|
/**
|
|
743
|
-
* -
|
|
744
|
-
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
763
|
+
* - Ensure every HTML document has a lang attribute
|
|
764
|
+
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.10/html-has-lang?application=axeAPI))
|
|
745
765
|
*/
|
|
746
766
|
htmlHasLang: "html-has-lang",
|
|
747
767
|
/**
|
|
748
|
-
* -
|
|
749
|
-
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
768
|
+
* - Ensure the lang attribute of the `<html>` element has a valid value
|
|
769
|
+
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.10/html-lang-valid?application=axeAPI))
|
|
750
770
|
*/
|
|
751
771
|
htmlLangValid: "html-lang-valid",
|
|
752
772
|
/**
|
|
753
773
|
* - Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page
|
|
754
|
-
* - HTML elements with lang and xml:lang must have the same base language ([url](https://dequeuniversity.com/rules/axe/4.
|
|
774
|
+
* - HTML elements with lang and xml:lang must have the same base language ([url](https://dequeuniversity.com/rules/axe/4.10/html-xml-lang-mismatch?application=axeAPI))
|
|
755
775
|
*/
|
|
756
776
|
htmlXmlLangMismatch: "html-xml-lang-mismatch",
|
|
757
777
|
/**
|
|
758
|
-
* -
|
|
759
|
-
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.
|
|
778
|
+
* - Ensure lang attributes have valid values
|
|
779
|
+
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.10/valid-lang?application=axeAPI))
|
|
760
780
|
*/
|
|
761
781
|
validLang: "valid-lang"
|
|
762
782
|
};
|
|
763
783
|
var sensoryAndVisualCues = {
|
|
764
784
|
/**
|
|
765
|
-
* -
|
|
766
|
-
* - Users should be able to zoom and scale the text up to 500% ([url](https://dequeuniversity.com/rules/axe/4.
|
|
785
|
+
* - Ensure `<meta name="viewport">` can scale a significant amount
|
|
786
|
+
* - Users should be able to zoom and scale the text up to 500% ([url](https://dequeuniversity.com/rules/axe/4.10/meta-viewport-large?application=axeAPI))
|
|
767
787
|
*/
|
|
768
788
|
metaViewportLarge: "meta-viewport-large",
|
|
769
789
|
/**
|
|
770
|
-
* -
|
|
771
|
-
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.
|
|
790
|
+
* - Ensure `<meta name="viewport">` does not disable text scaling and zooming
|
|
791
|
+
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.10/meta-viewport?application=axeAPI))
|
|
772
792
|
*/
|
|
773
793
|
metaViewport: "meta-viewport",
|
|
774
794
|
/**
|
|
775
|
-
* - Ensure touch
|
|
776
|
-
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.
|
|
795
|
+
* - Ensure touch targets have sufficient size and space
|
|
796
|
+
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.10/target-size?application=axeAPI))
|
|
777
797
|
*/
|
|
778
798
|
targetSize: "target-size"
|
|
779
799
|
};
|
|
780
800
|
var tables = {
|
|
781
801
|
/**
|
|
782
|
-
* -
|
|
783
|
-
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
802
|
+
* - Ensure the scope attribute is used correctly on tables
|
|
803
|
+
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.10/scope-attr-valid?application=axeAPI))
|
|
784
804
|
*/
|
|
785
805
|
scopeAttrValid: "scope-attr-valid",
|
|
786
806
|
/**
|
|
787
807
|
* - Ensure the `<caption>` element does not contain the same text as the summary attribute
|
|
788
|
-
* -
|
|
808
|
+
* - Tables should not have the same summary and caption ([url](https://dequeuniversity.com/rules/axe/4.10/table-duplicate-name?application=axeAPI))
|
|
789
809
|
*/
|
|
790
810
|
tableDuplicateName: "table-duplicate-name",
|
|
791
811
|
/**
|
|
792
812
|
* - Ensure that tables with a caption use the `<caption>` element.
|
|
793
|
-
* - Data or header cells must not be used to give caption to a data table. ([url](https://dequeuniversity.com/rules/axe/4.
|
|
813
|
+
* - Data or header cells must not be used to give caption to a data table. ([url](https://dequeuniversity.com/rules/axe/4.10/table-fake-caption?application=axeAPI))
|
|
794
814
|
*/
|
|
795
815
|
tableFakeCaption: "table-fake-caption",
|
|
796
816
|
/**
|
|
797
817
|
* - Ensure that each non-empty data cell in a `<table>` larger than 3 by 3 has one or more table headers
|
|
798
|
-
* - Non-empty `<td>` elements in larger `<table>` must have an associated table header ([url](https://dequeuniversity.com/rules/axe/4.
|
|
818
|
+
* - Non-empty `<td>` elements in larger `<table>` must have an associated table header ([url](https://dequeuniversity.com/rules/axe/4.10/td-has-header?application=axeAPI))
|
|
799
819
|
*/
|
|
800
820
|
tdHasHeader: "td-has-header",
|
|
801
821
|
/**
|
|
802
822
|
* - Ensure that each cell in a table that uses the headers attribute refers only to other cells in that table
|
|
803
|
-
* - Table cells that use the headers attribute must only refer to cells in the same table ([url](https://dequeuniversity.com/rules/axe/4.
|
|
823
|
+
* - Table cells that use the headers attribute must only refer to cells in the same table ([url](https://dequeuniversity.com/rules/axe/4.10/td-headers-attr?application=axeAPI))
|
|
804
824
|
*/
|
|
805
825
|
tdHeadersAttr: "td-headers-attr",
|
|
806
826
|
/**
|
|
807
827
|
* - Ensure that `<th>` elements and elements with role=columnheader/rowheader have data cells they describe
|
|
808
|
-
* - Table headers in a data table must refer to data cells ([url](https://dequeuniversity.com/rules/axe/4.
|
|
828
|
+
* - Table headers in a data table must refer to data cells ([url](https://dequeuniversity.com/rules/axe/4.10/th-has-data-cells?application=axeAPI))
|
|
809
829
|
*/
|
|
810
830
|
thHasDataCells: "th-has-data-cells"
|
|
811
831
|
};
|
|
@@ -813,12 +833,16 @@ var tables = {
|
|
|
813
833
|
// src/service/html/axe-rules/rule-exceptions.ts
|
|
814
834
|
var ruleExceptions = {
|
|
815
835
|
[aria.ariaAllowedRole]: { dynamicAttrs: ["role"] },
|
|
836
|
+
[aria.ariaBrailleEquivalent]: { attrSpread: true },
|
|
816
837
|
[aria.ariaCommandName]: { unknownBody: true, attrSpread: true },
|
|
838
|
+
[aria.ariaConditionalAttr]: { unknownBody: true, attrSpread: true },
|
|
839
|
+
[aria.ariaDeprecatedRole]: { dynamicAttrs: ["role"] },
|
|
817
840
|
[aria.ariaDialogName]: { unknownBody: true, attrSpread: true },
|
|
818
841
|
[aria.ariaHiddenBody]: {},
|
|
819
842
|
[aria.ariaInputFieldName]: { unknownBody: true, attrSpread: true },
|
|
820
843
|
[aria.ariaMeterName]: { unknownBody: true, attrSpread: true },
|
|
821
844
|
[aria.ariaProgressbarName]: { unknownBody: true, attrSpread: true },
|
|
845
|
+
[aria.ariaProhibitedAttr]: {},
|
|
822
846
|
[aria.ariaRequiredAttr]: { attrSpread: true },
|
|
823
847
|
[aria.ariaRequiredChildren]: { unknownBody: true },
|
|
824
848
|
[aria.ariaRoles]: { dynamicAttrs: ["role"] },
|
|
@@ -830,7 +854,6 @@ var ruleExceptions = {
|
|
|
830
854
|
[forms.autocompleteValid]: {},
|
|
831
855
|
[forms.formFieldMultipleLabels]: {},
|
|
832
856
|
[keyboard.accesskeys]: {},
|
|
833
|
-
[keyboard.focusOrderSemantics]: {},
|
|
834
857
|
[keyboard.frameFocusableContent]: { unknownBody: true },
|
|
835
858
|
[keyboard.skipLink]: { unknownBody: true },
|
|
836
859
|
[keyboard.tabindex]: {},
|
|
@@ -847,9 +870,9 @@ var ruleExceptions = {
|
|
|
847
870
|
attrSpread: true
|
|
848
871
|
},
|
|
849
872
|
[nameRoleValue.linkName]: { unknownBody: true, attrSpread: true },
|
|
873
|
+
[nameRoleValue.summaryName]: { unknownBody: true, attrSpread: true },
|
|
850
874
|
[parsing.marquee]: {},
|
|
851
875
|
[semantics.identicalLinksSamePurpose]: {},
|
|
852
|
-
[semantics.labelContentNameMismatch]: { unknownBody: true },
|
|
853
876
|
[semantics.landmarkNoDuplicateBanner]: {},
|
|
854
877
|
[semantics.landmarkNoDuplicateContentinfo]: {},
|
|
855
878
|
[semantics.landmarkNoDuplicateMain]: {},
|
|
@@ -860,7 +883,6 @@ var ruleExceptions = {
|
|
|
860
883
|
[structure.list]: { unknownBody: true },
|
|
861
884
|
[tables.scopeAttrValid]: {},
|
|
862
885
|
[tables.tableDuplicateName]: { unknownBody: true },
|
|
863
|
-
[tables.tableFakeCaption]: { unknownBody: true },
|
|
864
886
|
[tables.thHasDataCells]: { unknownBody: true },
|
|
865
887
|
[textAlternatives.areaAlt]: { attrSpread: true },
|
|
866
888
|
[textAlternatives.documentTitle]: { unknownBody: true },
|
|
@@ -887,8 +909,7 @@ var HTMLService = {
|
|
|
887
909
|
commands: {
|
|
888
910
|
"$/showHtmlOutput": async (uri) => {
|
|
889
911
|
const doc = get(uri);
|
|
890
|
-
if (!doc)
|
|
891
|
-
return;
|
|
912
|
+
if (!doc) return;
|
|
892
913
|
const { extracted } = extract(doc);
|
|
893
914
|
return {
|
|
894
915
|
language: "html",
|
|
@@ -916,28 +937,24 @@ var HTMLService = {
|
|
|
916
937
|
const violations = await getViolationNodes(Object.keys(ruleExceptions));
|
|
917
938
|
release();
|
|
918
939
|
return violations.flatMap((result) => {
|
|
919
|
-
var _a;
|
|
920
940
|
const { element } = result;
|
|
921
|
-
if (!element)
|
|
922
|
-
return [];
|
|
941
|
+
if (!element) return [];
|
|
923
942
|
const ruleId = result.ruleId;
|
|
924
943
|
if (element.dataset.markoNodeId) {
|
|
925
944
|
const details = nodeDetails[element.dataset.markoNodeId];
|
|
926
|
-
if (ruleExceptions[ruleId].attrSpread && details.hasDynamicAttrs || ruleExceptions[ruleId].unknownBody && details.hasDynamicBody ||
|
|
945
|
+
if (ruleExceptions[ruleId].attrSpread && details.hasDynamicAttrs || ruleExceptions[ruleId].unknownBody && details.hasDynamicBody || ruleExceptions[ruleId].dynamicAttrs?.some(
|
|
927
946
|
(attr) => element.getAttribute(attr) === "dynamic"
|
|
928
|
-
))
|
|
947
|
+
)) {
|
|
929
948
|
return [];
|
|
930
949
|
}
|
|
931
950
|
}
|
|
932
951
|
const generatedLoc = jsdom.nodeLocation(element);
|
|
933
|
-
if (!generatedLoc)
|
|
934
|
-
return [];
|
|
952
|
+
if (!generatedLoc) return [];
|
|
935
953
|
const sourceRange = extracted.sourceLocationAt(
|
|
936
954
|
generatedLoc.startOffset + 1,
|
|
937
955
|
generatedLoc.startOffset + 1 + element.tagName.length
|
|
938
956
|
);
|
|
939
|
-
if (!sourceRange)
|
|
940
|
-
return [];
|
|
957
|
+
if (!sourceRange) return [];
|
|
941
958
|
return [
|
|
942
959
|
{
|
|
943
960
|
range: sourceRange,
|
|
@@ -1109,8 +1126,7 @@ var linkedAttrs = /* @__PURE__ */ new Map([
|
|
|
1109
1126
|
["poster", /* @__PURE__ */ new Set(["video"])]
|
|
1110
1127
|
]);
|
|
1111
1128
|
function isDocumentLinkAttr(code, tag, attr) {
|
|
1112
|
-
|
|
1113
|
-
return tag.nameText && attr.type === NodeType.AttrNamed && ((_a = attr.value) == null ? void 0 : _a.type) === NodeType.AttrValue && /^['"]$/.test(code[attr.value.value.start]) && ((_b = linkedAttrs.get(code.slice(attr.name.start, attr.name.end))) == null ? void 0 : _b.has(tag.nameText)) || false;
|
|
1129
|
+
return tag.nameText && attr.type === NodeType.AttrNamed && attr.value?.type === NodeType.AttrValue && /^['"]$/.test(code[attr.value.value.start]) && linkedAttrs.get(code.slice(attr.name.start, attr.name.end))?.has(tag.nameText) || false;
|
|
1114
1130
|
}
|
|
1115
1131
|
|
|
1116
1132
|
// src/utils/file-system.ts
|
|
@@ -1128,10 +1144,8 @@ async function stat(uri) {
|
|
|
1128
1144
|
let size = -1;
|
|
1129
1145
|
try {
|
|
1130
1146
|
const stat2 = await fs2.stat(fileURLToPath(uri));
|
|
1131
|
-
if (stat2.isDirectory())
|
|
1132
|
-
|
|
1133
|
-
else if (stat2.isFile())
|
|
1134
|
-
type = FileType.File;
|
|
1147
|
+
if (stat2.isDirectory()) type = FileType.Directory;
|
|
1148
|
+
else if (stat2.isFile()) type = FileType.File;
|
|
1135
1149
|
ctime = stat2.ctimeMs;
|
|
1136
1150
|
mtime = stat2.mtimeMs;
|
|
1137
1151
|
size = stat2.size;
|
|
@@ -1163,8 +1177,7 @@ async function readDirectory(uri) {
|
|
|
1163
1177
|
function resolveUrl(to, base) {
|
|
1164
1178
|
try {
|
|
1165
1179
|
const url = new URL(to, base);
|
|
1166
|
-
if (url.protocol === "file:")
|
|
1167
|
-
return url.toString();
|
|
1180
|
+
if (url.protocol === "file:") return url.toString();
|
|
1168
1181
|
} catch {
|
|
1169
1182
|
return void 0;
|
|
1170
1183
|
}
|
|
@@ -1179,8 +1192,7 @@ async function AttrValue({
|
|
|
1179
1192
|
const attr = node.parent;
|
|
1180
1193
|
if (isDocumentLinkAttr(code, attr.parent, attr)) {
|
|
1181
1194
|
const start = node.value.start + 1;
|
|
1182
|
-
if (code[start] !== ".")
|
|
1183
|
-
return;
|
|
1195
|
+
if (code[start] !== ".") return;
|
|
1184
1196
|
const end = node.value.end - 1;
|
|
1185
1197
|
const relativeOffset = offset - start;
|
|
1186
1198
|
const rawValue = parsed.read({
|
|
@@ -1188,8 +1200,7 @@ async function AttrValue({
|
|
|
1188
1200
|
end
|
|
1189
1201
|
});
|
|
1190
1202
|
const segmentStart = rawValue.lastIndexOf("/", relativeOffset);
|
|
1191
|
-
if (segmentStart === -1)
|
|
1192
|
-
return;
|
|
1203
|
+
if (segmentStart === -1) return;
|
|
1193
1204
|
const req = rawValue.slice(0, segmentStart);
|
|
1194
1205
|
const resolved = resolveUrl(req, uri);
|
|
1195
1206
|
if (resolved) {
|
|
@@ -1243,7 +1254,6 @@ function getTagNameCompletion({
|
|
|
1243
1254
|
showAutoComplete,
|
|
1244
1255
|
importer
|
|
1245
1256
|
}) {
|
|
1246
|
-
var _a;
|
|
1247
1257
|
let label = tag.isNestedTag ? `@${tag.name}` : tag.name;
|
|
1248
1258
|
const fileForTag = tag.template || tag.renderer || tag.filePath;
|
|
1249
1259
|
const fileURIForTag = URI3.file(fileForTag).toString();
|
|
@@ -1263,7 +1273,7 @@ function getTagNameCompletion({
|
|
|
1263
1273
|
|
|
1264
1274
|
${tag.description}`;
|
|
1265
1275
|
}
|
|
1266
|
-
const autocomplete = showAutoComplete ?
|
|
1276
|
+
const autocomplete = showAutoComplete ? tag.autocomplete?.[0] : void 0;
|
|
1267
1277
|
if (autocomplete) {
|
|
1268
1278
|
if (autocomplete.displayText) {
|
|
1269
1279
|
label = autocomplete.displayText;
|
|
@@ -1285,17 +1295,16 @@ ${autocomplete.description}`;
|
|
|
1285
1295
|
tags: tag.deprecated ? deprecated : void 0,
|
|
1286
1296
|
insertTextFormat: autocomplete ? InsertTextFormat2.Snippet : void 0,
|
|
1287
1297
|
kind: tag.html ? CompletionItemKind3.Property : CompletionItemKind3.Class,
|
|
1288
|
-
textEdit: range && TextEdit3.replace(range,
|
|
1298
|
+
textEdit: range && TextEdit3.replace(range, autocomplete?.snippet || label)
|
|
1289
1299
|
};
|
|
1290
1300
|
}
|
|
1291
1301
|
|
|
1292
1302
|
// src/service/marko/complete/Import.ts
|
|
1293
|
-
var importTagReg = /(['"])<((?:[
|
|
1303
|
+
var importTagReg = /(['"])<((?:[^'"\\>]+|\\.)*)>?\1/;
|
|
1294
1304
|
function Import({
|
|
1295
1305
|
node,
|
|
1296
1306
|
file: { parsed, filename, lookup }
|
|
1297
1307
|
}) {
|
|
1298
|
-
var _a;
|
|
1299
1308
|
const value = parsed.read(node);
|
|
1300
1309
|
const match = importTagReg.exec(value);
|
|
1301
1310
|
if (match) {
|
|
@@ -1307,7 +1316,7 @@ function Import({
|
|
|
1307
1316
|
});
|
|
1308
1317
|
const result = [];
|
|
1309
1318
|
for (const tag of lookup.getTagsSorted()) {
|
|
1310
|
-
if ((tag.template || tag.renderer) && !(tag.html || tag.parser || tag.translator || tag.isNestedTag || tag.name === "*" ||
|
|
1319
|
+
if ((tag.template || tag.renderer) && !(tag.html || tag.parser || tag.translator || tag.isNestedTag || tag.name === "*" || tag.parseOptions?.statement || /^@?marko[/-]/.test(tag.taglibId) || tag.name[0] === "_" && /[\\/]node_modules[\\/]/.test(tag.filePath))) {
|
|
1311
1320
|
const completion = getTagNameCompletion({
|
|
1312
1321
|
tag,
|
|
1313
1322
|
importer: filename
|
|
@@ -1327,15 +1336,13 @@ function OpenTagName({
|
|
|
1327
1336
|
node,
|
|
1328
1337
|
file: { parsed, filename, lookup }
|
|
1329
1338
|
}) {
|
|
1330
|
-
var _a;
|
|
1331
1339
|
const tag = node.parent;
|
|
1332
1340
|
const range = parsed.locationAt(node);
|
|
1333
1341
|
const isAttrTag = tag.type === NodeType2.AttrTag;
|
|
1334
1342
|
const result = [];
|
|
1335
1343
|
if (isAttrTag) {
|
|
1336
1344
|
let parentTag = tag.owner;
|
|
1337
|
-
while (
|
|
1338
|
-
parentTag = parentTag.owner;
|
|
1345
|
+
while (parentTag?.type === NodeType2.AttrTag) parentTag = parentTag.owner;
|
|
1339
1346
|
const parentTagDef = parentTag && parentTag.nameText && lookup.getTag(parentTag.nameText);
|
|
1340
1347
|
if (parentTagDef) {
|
|
1341
1348
|
const { nestedTags } = parentTagDef;
|
|
@@ -1356,7 +1363,7 @@ function OpenTagName({
|
|
|
1356
1363
|
} else {
|
|
1357
1364
|
const skipStatements = !(tag.concise && tag.parent.type === NodeType2.Program);
|
|
1358
1365
|
for (const tag2 of lookup.getTagsSorted()) {
|
|
1359
|
-
if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements &&
|
|
1366
|
+
if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements && tag2.parseOptions?.statement || tag2.name[0] === "_" && /^@?marko[/-]|[\\/]node_modules[\\/]/.test(tag2.filePath))) {
|
|
1360
1367
|
const completion = getTagNameCompletion({
|
|
1361
1368
|
tag: tag2,
|
|
1362
1369
|
range,
|
|
@@ -1385,8 +1392,7 @@ function Tag({
|
|
|
1385
1392
|
file: { parsed, code }
|
|
1386
1393
|
}) {
|
|
1387
1394
|
const isClosed = node.end !== UNFINISHED;
|
|
1388
|
-
if (isClosed || node.concise)
|
|
1389
|
-
return;
|
|
1395
|
+
if (isClosed || node.concise) return;
|
|
1390
1396
|
const closingTagStr = `</${node.nameText || ""}>`;
|
|
1391
1397
|
if (offset === node.open.end) {
|
|
1392
1398
|
return [
|
|
@@ -1430,17 +1436,16 @@ var handlers = {
|
|
|
1430
1436
|
Import
|
|
1431
1437
|
};
|
|
1432
1438
|
var doComplete = async (doc, params) => {
|
|
1433
|
-
var _a;
|
|
1434
1439
|
const file = getMarkoFile(doc);
|
|
1435
1440
|
const offset = doc.offsetAt(params.position);
|
|
1436
1441
|
const node = file.parsed.nodeAt(offset);
|
|
1437
1442
|
return {
|
|
1438
|
-
items: await
|
|
1443
|
+
items: await handlers[NodeType3[node.type]]?.({
|
|
1439
1444
|
file,
|
|
1440
1445
|
params,
|
|
1441
1446
|
offset,
|
|
1442
1447
|
node
|
|
1443
|
-
})
|
|
1448
|
+
}) || [],
|
|
1444
1449
|
isIncomplete: true
|
|
1445
1450
|
};
|
|
1446
1451
|
};
|
|
@@ -1500,7 +1505,7 @@ function AttrName2({
|
|
|
1500
1505
|
if (!attrDef) {
|
|
1501
1506
|
return;
|
|
1502
1507
|
}
|
|
1503
|
-
const attrEntryFile = attrDef.filePath ||
|
|
1508
|
+
const attrEntryFile = attrDef.filePath || tagDef?.filePath;
|
|
1504
1509
|
if (!attrEntryFile) {
|
|
1505
1510
|
return;
|
|
1506
1511
|
}
|
|
@@ -1545,8 +1550,7 @@ function OpenTagName2({
|
|
|
1545
1550
|
let range = START_LOCATION;
|
|
1546
1551
|
if (tag.type === NodeType4.AttrTag) {
|
|
1547
1552
|
let parentTag = tag.owner;
|
|
1548
|
-
while (
|
|
1549
|
-
parentTag = parentTag.owner;
|
|
1553
|
+
while (parentTag?.type === NodeType4.AttrTag) parentTag = parentTag.owner;
|
|
1550
1554
|
tagDef = parentTag && parentTag.nameText ? lookup.getTag(parentTag.nameText) : void 0;
|
|
1551
1555
|
} else {
|
|
1552
1556
|
tagDef = tag.nameText ? lookup.getTag(tag.nameText) : void 0;
|
|
@@ -1587,21 +1591,20 @@ var handlers2 = {
|
|
|
1587
1591
|
AttrName: AttrName2
|
|
1588
1592
|
};
|
|
1589
1593
|
var findDefinition = async (doc, params) => {
|
|
1590
|
-
var _a;
|
|
1591
1594
|
const file = getMarkoFile(doc);
|
|
1592
1595
|
const offset = doc.offsetAt(params.position);
|
|
1593
1596
|
const node = file.parsed.nodeAt(offset);
|
|
1594
|
-
return await
|
|
1597
|
+
return await handlers2[NodeType5[node.type]]?.({
|
|
1595
1598
|
file,
|
|
1596
1599
|
params,
|
|
1597
1600
|
offset,
|
|
1598
1601
|
node
|
|
1599
|
-
})
|
|
1602
|
+
}) || [];
|
|
1600
1603
|
};
|
|
1601
1604
|
|
|
1602
1605
|
// src/service/marko/document-links.ts
|
|
1603
1606
|
import { NodeType as NodeType6 } from "@marko/language-tools";
|
|
1604
|
-
var importTagReg2 = /(['"])<((?:[
|
|
1607
|
+
var importTagReg2 = /(['"])<((?:[^'"\\>]+|\\.)*)>?\1/g;
|
|
1605
1608
|
var findDocumentLinks = async (doc) => {
|
|
1606
1609
|
return processDoc(doc, extractDocumentLinks);
|
|
1607
1610
|
};
|
|
@@ -1694,13 +1697,12 @@ function extractDocumentSymbols({
|
|
|
1694
1697
|
const symbols = [];
|
|
1695
1698
|
const { program } = parsed;
|
|
1696
1699
|
const visit = (node) => {
|
|
1697
|
-
var _a, _b;
|
|
1698
1700
|
switch (node.type) {
|
|
1699
1701
|
case NodeType7.Tag:
|
|
1700
1702
|
case NodeType7.AttrTag:
|
|
1701
1703
|
symbols.push({
|
|
1702
|
-
name: (node.type === NodeType7.AttrTag ?
|
|
1703
|
-
kind: node.nameText &&
|
|
1704
|
+
name: (node.type === NodeType7.AttrTag ? node.nameText?.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
|
|
1705
|
+
kind: node.nameText && lookup.getTag(node.nameText)?.html && SymbolKind.Property || SymbolKind.Class,
|
|
1704
1706
|
location: {
|
|
1705
1707
|
uri,
|
|
1706
1708
|
range: parsed.locationAt(node)
|
|
@@ -1742,8 +1744,7 @@ async function formatDocument(doc, formatOptions, cancel) {
|
|
|
1742
1744
|
}).catch(() => null) : null
|
|
1743
1745
|
};
|
|
1744
1746
|
markoPrettier.setCompiler(Project3.getCompiler(dir), Project3.getConfig(dir));
|
|
1745
|
-
if (cancel
|
|
1746
|
-
return;
|
|
1747
|
+
if (cancel?.isCancellationRequested) return;
|
|
1747
1748
|
return [
|
|
1748
1749
|
TextEdit6.replace(
|
|
1749
1750
|
{
|
|
@@ -1792,16 +1793,15 @@ var handlers3 = {
|
|
|
1792
1793
|
OpenTagName: OpenTagName3
|
|
1793
1794
|
};
|
|
1794
1795
|
var doHover = async (doc, params) => {
|
|
1795
|
-
var _a;
|
|
1796
1796
|
const file = getMarkoFile(doc);
|
|
1797
1797
|
const offset = doc.offsetAt(params.position);
|
|
1798
1798
|
const node = file.parsed.nodeAt(offset);
|
|
1799
|
-
return await
|
|
1799
|
+
return await handlers3[NodeType8[node.type]]?.({
|
|
1800
1800
|
file,
|
|
1801
1801
|
params,
|
|
1802
1802
|
offset,
|
|
1803
1803
|
node
|
|
1804
|
-
})
|
|
1804
|
+
});
|
|
1805
1805
|
};
|
|
1806
1806
|
|
|
1807
1807
|
// src/service/marko/validate.ts
|
|
@@ -1897,8 +1897,7 @@ function addDiagnosticsForError(err, diagnostics) {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
} else if (isErrorWithLoc(err)) {
|
|
1899
1899
|
const message = err.label || err.message || err.stack;
|
|
1900
|
-
if (!message)
|
|
1901
|
-
return;
|
|
1900
|
+
if (!message) return;
|
|
1902
1901
|
const { loc } = err;
|
|
1903
1902
|
diagnostics.push({
|
|
1904
1903
|
range: {
|
|
@@ -1940,12 +1939,11 @@ function isError(err) {
|
|
|
1940
1939
|
return err != null && typeof err === "object" && typeof err.message === "string";
|
|
1941
1940
|
}
|
|
1942
1941
|
function isAggregateError(err) {
|
|
1943
|
-
return Array.isArray(err
|
|
1942
|
+
return Array.isArray(err?.errors);
|
|
1944
1943
|
}
|
|
1945
1944
|
function isErrorWithLoc(err) {
|
|
1946
|
-
const loc = err
|
|
1947
|
-
if (typeof loc !== "object")
|
|
1948
|
-
return false;
|
|
1945
|
+
const loc = err?.loc;
|
|
1946
|
+
if (typeof loc !== "object") return false;
|
|
1949
1947
|
return loc !== null && typeof loc === "object" && typeof loc.start === "object" && typeof loc.end === "object" && typeof loc.start.line === "number" && typeof loc.start.column === "number" && typeof loc.end.line === "number" && typeof loc.end.column === "number";
|
|
1950
1948
|
}
|
|
1951
1949
|
|
|
@@ -2000,16 +1998,12 @@ import {
|
|
|
2000
1998
|
var fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
|
|
2001
1999
|
var modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
|
|
2002
2000
|
function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
2003
|
-
var _a, _b, _c;
|
|
2004
2001
|
const processors = Processors.create({
|
|
2005
2002
|
ts: ts2,
|
|
2006
2003
|
host,
|
|
2007
2004
|
configFile
|
|
2008
2005
|
});
|
|
2009
|
-
const rootNames = Object.values(processors).map((processor) =>
|
|
2010
|
-
var _a2;
|
|
2011
|
-
return (_a2 = processor.getRootNames) == null ? void 0 : _a2.call(processor);
|
|
2012
|
-
}).flat().filter(Boolean);
|
|
2006
|
+
const rootNames = Object.values(processors).map((processor) => processor.getRootNames?.()).flat().filter(Boolean);
|
|
2013
2007
|
const trackFile = ps ? (fileName) => {
|
|
2014
2008
|
ps.getOrCreateScriptInfoForNormalizedPath(
|
|
2015
2009
|
fileName,
|
|
@@ -2025,12 +2019,11 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2025
2019
|
host.getScriptFileNames = () => [
|
|
2026
2020
|
...new Set(rootNames.concat(getScriptFileNames()))
|
|
2027
2021
|
];
|
|
2028
|
-
const getScriptKind =
|
|
2022
|
+
const getScriptKind = host.getScriptKind?.bind(host);
|
|
2029
2023
|
if (getScriptKind) {
|
|
2030
2024
|
host.getScriptKind = (fileName) => {
|
|
2031
2025
|
const processor = getProcessor(fileName);
|
|
2032
|
-
if (processor)
|
|
2033
|
-
return processor.getScriptKind(fileName);
|
|
2026
|
+
if (processor) return processor.getScriptKind(fileName);
|
|
2034
2027
|
return getScriptKind(fileName);
|
|
2035
2028
|
};
|
|
2036
2029
|
}
|
|
@@ -2058,24 +2051,23 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2058
2051
|
const getScriptVersion = host.getScriptVersion.bind(host);
|
|
2059
2052
|
host.getScriptVersion = (fileName) => {
|
|
2060
2053
|
const processor = getProcessor(fileName);
|
|
2061
|
-
if (processor)
|
|
2062
|
-
return host.getProjectVersion();
|
|
2054
|
+
if (processor) return host.getProjectVersion();
|
|
2063
2055
|
return getScriptVersion(fileName);
|
|
2064
2056
|
};
|
|
2065
2057
|
}
|
|
2066
|
-
const readDirectory2 =
|
|
2058
|
+
const readDirectory2 = host.readDirectory?.bind(host);
|
|
2067
2059
|
if (readDirectory2) {
|
|
2068
2060
|
host.readDirectory = (path9, extensions, exclude, include, depth) => {
|
|
2069
2061
|
return readDirectory2(
|
|
2070
2062
|
path9,
|
|
2071
|
-
extensions
|
|
2063
|
+
extensions?.concat(Processors.extensions),
|
|
2072
2064
|
exclude,
|
|
2073
2065
|
include,
|
|
2074
2066
|
depth
|
|
2075
2067
|
);
|
|
2076
2068
|
};
|
|
2077
2069
|
}
|
|
2078
|
-
const resolveModuleNameLiterals =
|
|
2070
|
+
const resolveModuleNameLiterals = host.resolveModuleNameLiterals?.bind(host);
|
|
2079
2071
|
if (resolveModuleNameLiterals) {
|
|
2080
2072
|
host.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) => {
|
|
2081
2073
|
let normalModuleLiterals = moduleLiterals;
|
|
@@ -2179,14 +2171,13 @@ var REG_LINE = /\r\n|\n/;
|
|
|
2179
2171
|
var REG_CODE_BLOCK = /^\s*[~`]{3}/m;
|
|
2180
2172
|
var REG_CAPTION = /^<caption>(.*?)<\/caption>\s*(\r\n|\n)/;
|
|
2181
2173
|
function printJSDocTag(tag) {
|
|
2182
|
-
var _a;
|
|
2183
2174
|
switch (tag.name) {
|
|
2184
2175
|
case "augments":
|
|
2185
2176
|
case "extends":
|
|
2186
2177
|
case "param":
|
|
2187
2178
|
case "template": {
|
|
2188
2179
|
const body = getTagBodyParts(tag);
|
|
2189
|
-
if (
|
|
2180
|
+
if (body?.length === 3) {
|
|
2190
2181
|
const [, param, text] = body;
|
|
2191
2182
|
return `${printTagName(tag.name)} \`${param}\`${printTagBody(
|
|
2192
2183
|
replaceLinks(text)
|
|
@@ -2196,8 +2187,7 @@ function printJSDocTag(tag) {
|
|
|
2196
2187
|
}
|
|
2197
2188
|
case "return":
|
|
2198
2189
|
case "returns": {
|
|
2199
|
-
if (!
|
|
2200
|
-
return void 0;
|
|
2190
|
+
if (!tag.text?.length) return void 0;
|
|
2201
2191
|
break;
|
|
2202
2192
|
}
|
|
2203
2193
|
}
|
|
@@ -2215,8 +2205,7 @@ function getTagBodyParts(tag) {
|
|
|
2215
2205
|
return convertLinkTags(tag.text).split(/^(\S+)\s*-?\s*/);
|
|
2216
2206
|
}
|
|
2217
2207
|
function getTagBodyText(tag) {
|
|
2218
|
-
if (!tag.text)
|
|
2219
|
-
return "";
|
|
2208
|
+
if (!tag.text) return "";
|
|
2220
2209
|
const text = convertLinkTags(tag.text);
|
|
2221
2210
|
switch (tag.name) {
|
|
2222
2211
|
case "example": {
|
|
@@ -2244,10 +2233,8 @@ ${ensureCodeblock(
|
|
|
2244
2233
|
return replaceLinks(text);
|
|
2245
2234
|
}
|
|
2246
2235
|
function convertLinkTags(parts) {
|
|
2247
|
-
if (!parts)
|
|
2248
|
-
|
|
2249
|
-
if (typeof parts === "string")
|
|
2250
|
-
return parts;
|
|
2236
|
+
if (!parts) return "";
|
|
2237
|
+
if (typeof parts === "string") return parts;
|
|
2251
2238
|
let result = "";
|
|
2252
2239
|
let currentLink;
|
|
2253
2240
|
for (const part of parts) {
|
|
@@ -2367,11 +2354,9 @@ var ScriptService = {
|
|
|
2367
2354
|
commands: {
|
|
2368
2355
|
"$/showScriptOutput": async (uri) => {
|
|
2369
2356
|
const doc = get(uri);
|
|
2370
|
-
if (
|
|
2371
|
-
return;
|
|
2357
|
+
if (doc?.languageId !== "marko") return;
|
|
2372
2358
|
const filename = getFSPath(doc);
|
|
2373
|
-
if (!filename)
|
|
2374
|
-
return;
|
|
2359
|
+
if (!filename) return;
|
|
2375
2360
|
const tsProject = getTSProject(filename);
|
|
2376
2361
|
const extracted = processScript(doc, tsProject);
|
|
2377
2362
|
const lang = Project5.getScriptLang(
|
|
@@ -2406,32 +2391,27 @@ var ScriptService = {
|
|
|
2406
2391
|
});
|
|
2407
2392
|
},
|
|
2408
2393
|
async doComplete(doc, params) {
|
|
2409
|
-
var _a;
|
|
2410
2394
|
const fileName = getFSPath(doc);
|
|
2411
|
-
if (!fileName)
|
|
2412
|
-
return;
|
|
2395
|
+
if (!fileName) return;
|
|
2413
2396
|
const project = getTSProject(fileName);
|
|
2414
2397
|
const extracted = processScript(doc, project);
|
|
2415
2398
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2416
2399
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2417
|
-
if (generatedOffset === void 0)
|
|
2418
|
-
return;
|
|
2400
|
+
if (generatedOffset === void 0) return;
|
|
2419
2401
|
const completions = project.service.getCompletionsAtPosition(
|
|
2420
2402
|
fileName,
|
|
2421
2403
|
generatedOffset,
|
|
2422
2404
|
{
|
|
2423
2405
|
...await getPreferences(project.markoScriptLang),
|
|
2424
2406
|
...params.context,
|
|
2425
|
-
triggerCharacter: getTSTriggerChar(
|
|
2407
|
+
triggerCharacter: getTSTriggerChar(params.context?.triggerCharacter)
|
|
2426
2408
|
}
|
|
2427
2409
|
);
|
|
2428
|
-
if (!
|
|
2429
|
-
return;
|
|
2410
|
+
if (!completions?.entries.length) return;
|
|
2430
2411
|
const result = [];
|
|
2431
2412
|
for (const completion of completions.entries) {
|
|
2432
2413
|
let { name: label, insertText, sortText } = completion;
|
|
2433
|
-
if (label.startsWith(localInternalsPrefix))
|
|
2434
|
-
continue;
|
|
2414
|
+
if (label.startsWith(localInternalsPrefix)) continue;
|
|
2435
2415
|
const { replacementSpan } = completion;
|
|
2436
2416
|
let textEdit;
|
|
2437
2417
|
let detail;
|
|
@@ -2505,14 +2485,11 @@ var ScriptService = {
|
|
|
2505
2485
|
},
|
|
2506
2486
|
async doCompletionResolve(item) {
|
|
2507
2487
|
const { data } = item;
|
|
2508
|
-
if (!data)
|
|
2509
|
-
return;
|
|
2488
|
+
if (!data) return;
|
|
2510
2489
|
const { fileName } = data;
|
|
2511
|
-
if (!fileName)
|
|
2512
|
-
return;
|
|
2490
|
+
if (!fileName) return;
|
|
2513
2491
|
const doc = get(filenameToURI(fileName));
|
|
2514
|
-
if (!doc)
|
|
2515
|
-
return;
|
|
2492
|
+
if (!doc) return;
|
|
2516
2493
|
const project = getTSProject(fileName);
|
|
2517
2494
|
const detail = project.service.getCompletionEntryDetails(
|
|
2518
2495
|
fileName,
|
|
@@ -2523,14 +2500,12 @@ var ScriptService = {
|
|
|
2523
2500
|
await getPreferences(project.markoScriptLang),
|
|
2524
2501
|
data.originalData
|
|
2525
2502
|
);
|
|
2526
|
-
if (!
|
|
2527
|
-
return;
|
|
2503
|
+
if (!detail?.codeActions) return;
|
|
2528
2504
|
const extracted = processScript(doc, project);
|
|
2529
2505
|
const textEdits = item.additionalTextEdits = item.additionalTextEdits || [];
|
|
2530
2506
|
for (const action of detail.codeActions) {
|
|
2531
2507
|
for (const change of action.changes) {
|
|
2532
|
-
if (change.fileName !== fileName)
|
|
2533
|
-
continue;
|
|
2508
|
+
if (change.fileName !== fileName) continue;
|
|
2534
2509
|
for (const { span, newText: rawText } of change.textChanges) {
|
|
2535
2510
|
let range;
|
|
2536
2511
|
let newText = rawText;
|
|
@@ -2562,20 +2537,17 @@ var ScriptService = {
|
|
|
2562
2537
|
},
|
|
2563
2538
|
findDefinition(doc, params) {
|
|
2564
2539
|
const fileName = getFSPath(doc);
|
|
2565
|
-
if (!fileName)
|
|
2566
|
-
return;
|
|
2540
|
+
if (!fileName) return;
|
|
2567
2541
|
const project = getTSProject(fileName);
|
|
2568
2542
|
const extracted = processScript(doc, project);
|
|
2569
2543
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2570
2544
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2571
|
-
if (generatedOffset === void 0)
|
|
2572
|
-
return;
|
|
2545
|
+
if (generatedOffset === void 0) return;
|
|
2573
2546
|
const boundary = project.service.getDefinitionAndBoundSpan(
|
|
2574
2547
|
fileName,
|
|
2575
2548
|
generatedOffset
|
|
2576
2549
|
);
|
|
2577
|
-
if (!
|
|
2578
|
-
return;
|
|
2550
|
+
if (!boundary?.definitions) return;
|
|
2579
2551
|
const originSelectionRange = sourceLocationAtTextSpan(
|
|
2580
2552
|
extracted,
|
|
2581
2553
|
boundary.textSpan
|
|
@@ -2584,8 +2556,7 @@ var ScriptService = {
|
|
|
2584
2556
|
for (const def of boundary.definitions) {
|
|
2585
2557
|
const targetUri = filenameToURI(def.fileName);
|
|
2586
2558
|
const defDoc = get(targetUri);
|
|
2587
|
-
if (!defDoc)
|
|
2588
|
-
continue;
|
|
2559
|
+
if (!defDoc) continue;
|
|
2589
2560
|
let link;
|
|
2590
2561
|
if (markoFileReg.test(targetUri)) {
|
|
2591
2562
|
const extracted2 = processScript(defDoc, project);
|
|
@@ -2621,23 +2592,19 @@ var ScriptService = {
|
|
|
2621
2592
|
},
|
|
2622
2593
|
doHover(doc, params) {
|
|
2623
2594
|
const fileName = getFSPath(doc);
|
|
2624
|
-
if (!fileName)
|
|
2625
|
-
return;
|
|
2595
|
+
if (!fileName) return;
|
|
2626
2596
|
const project = getTSProject(fileName);
|
|
2627
2597
|
const extracted = processScript(doc, project);
|
|
2628
2598
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2629
2599
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2630
|
-
if (generatedOffset === void 0)
|
|
2631
|
-
return;
|
|
2600
|
+
if (generatedOffset === void 0) return;
|
|
2632
2601
|
const quickInfo = project.service.getQuickInfoAtPosition(
|
|
2633
2602
|
fileName,
|
|
2634
2603
|
generatedOffset
|
|
2635
2604
|
);
|
|
2636
|
-
if (!quickInfo)
|
|
2637
|
-
return;
|
|
2605
|
+
if (!quickInfo) return;
|
|
2638
2606
|
const sourceRange = sourceLocationAtTextSpan(extracted, quickInfo.textSpan);
|
|
2639
|
-
if (!sourceRange)
|
|
2640
|
-
return;
|
|
2607
|
+
if (!sourceRange) return;
|
|
2641
2608
|
let contents = "";
|
|
2642
2609
|
const displayParts = ts.displayPartsToString(quickInfo.displayParts);
|
|
2643
2610
|
if (displayParts) {
|
|
@@ -2661,14 +2628,12 @@ ${documentation}`;
|
|
|
2661
2628
|
},
|
|
2662
2629
|
doRename(doc, params) {
|
|
2663
2630
|
const fileName = getFSPath(doc);
|
|
2664
|
-
if (!fileName)
|
|
2665
|
-
return;
|
|
2631
|
+
if (!fileName) return;
|
|
2666
2632
|
const project = getTSProject(fileName);
|
|
2667
2633
|
const extracted = processScript(doc, project);
|
|
2668
2634
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2669
2635
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2670
|
-
if (generatedOffset === void 0)
|
|
2671
|
-
return;
|
|
2636
|
+
if (generatedOffset === void 0) return;
|
|
2672
2637
|
const renameLocations = project.service.findRenameLocations(
|
|
2673
2638
|
fileName,
|
|
2674
2639
|
generatedOffset,
|
|
@@ -2676,15 +2641,13 @@ ${documentation}`;
|
|
|
2676
2641
|
false,
|
|
2677
2642
|
false
|
|
2678
2643
|
);
|
|
2679
|
-
if (!renameLocations)
|
|
2680
|
-
return;
|
|
2644
|
+
if (!renameLocations) return;
|
|
2681
2645
|
const changes = {};
|
|
2682
2646
|
for (const rename of renameLocations) {
|
|
2683
2647
|
const renameURI = filenameToURI(rename.fileName);
|
|
2684
2648
|
const renameDoc = get(renameURI);
|
|
2685
2649
|
let edit;
|
|
2686
|
-
if (!renameDoc)
|
|
2687
|
-
continue;
|
|
2650
|
+
if (!renameDoc) continue;
|
|
2688
2651
|
if (markoFileReg.test(renameURI)) {
|
|
2689
2652
|
const extracted2 = processScript(renameDoc, project);
|
|
2690
2653
|
const sourceRange = sourceLocationAtTextSpan(
|
|
@@ -2717,8 +2680,7 @@ ${documentation}`;
|
|
|
2717
2680
|
},
|
|
2718
2681
|
doValidate(doc) {
|
|
2719
2682
|
const fileName = getFSPath(doc);
|
|
2720
|
-
if (!fileName)
|
|
2721
|
-
return;
|
|
2683
|
+
if (!fileName) return;
|
|
2722
2684
|
const project = getTSProject(fileName);
|
|
2723
2685
|
const extracted = processScript(doc, project);
|
|
2724
2686
|
let results;
|
|
@@ -2746,14 +2708,13 @@ ${documentation}`;
|
|
|
2746
2708
|
};
|
|
2747
2709
|
function processScript(doc, tsProject) {
|
|
2748
2710
|
return processDoc(doc, ({ filename, parsed, lookup }) => {
|
|
2749
|
-
var _a;
|
|
2750
2711
|
const { host, markoScriptLang } = tsProject;
|
|
2751
2712
|
return extractScript({
|
|
2752
2713
|
ts,
|
|
2753
2714
|
parsed,
|
|
2754
2715
|
lookup,
|
|
2755
2716
|
scriptLang: filename ? Project5.getScriptLang(filename, markoScriptLang, ts, host) : markoScriptLang,
|
|
2756
|
-
runtimeTypesCode:
|
|
2717
|
+
runtimeTypesCode: Project5.getTypeLibs(tsProject.rootDir, ts, host)?.markoTypesCode
|
|
2757
2718
|
});
|
|
2758
2719
|
});
|
|
2759
2720
|
}
|
|
@@ -2794,8 +2755,7 @@ function getOffsetAfterComments(node) {
|
|
|
2794
2755
|
return Math.max(0, node.start - 1);
|
|
2795
2756
|
}
|
|
2796
2757
|
function sourceLocationAtTextSpan(extracted, { start, length }) {
|
|
2797
|
-
if (start === 0 && length === 0)
|
|
2798
|
-
return START_LOCATION;
|
|
2758
|
+
if (start === 0 && length === 0) return START_LOCATION;
|
|
2799
2759
|
return extracted.sourceLocationAt(start, start + length);
|
|
2800
2760
|
}
|
|
2801
2761
|
function docLocationAtTextSpan(doc, { start, length }) {
|
|
@@ -2822,12 +2782,11 @@ function getTSConfigFile(fileName) {
|
|
|
2822
2782
|
return configFile;
|
|
2823
2783
|
}
|
|
2824
2784
|
function getTSProject(docFsPath) {
|
|
2825
|
-
var _a;
|
|
2826
2785
|
let configFile;
|
|
2827
2786
|
let markoScriptLang = ScriptLang.js;
|
|
2828
2787
|
if (docFsPath) {
|
|
2829
2788
|
configFile = getTSConfigFile(docFsPath);
|
|
2830
|
-
if (configFile
|
|
2789
|
+
if (configFile?.endsWith("tsconfig.json")) {
|
|
2831
2790
|
markoScriptLang = ScriptLang.ts;
|
|
2832
2791
|
}
|
|
2833
2792
|
}
|
|
@@ -2837,8 +2796,7 @@ function getTSProject(docFsPath) {
|
|
|
2837
2796
|
let cached;
|
|
2838
2797
|
if (projectCache) {
|
|
2839
2798
|
cached = projectCache.get(basePath);
|
|
2840
|
-
if (cached)
|
|
2841
|
-
return cached;
|
|
2799
|
+
if (cached) return cached;
|
|
2842
2800
|
} else {
|
|
2843
2801
|
projectCache = /* @__PURE__ */ new Map();
|
|
2844
2802
|
cache.set(getTSProject, projectCache);
|
|
@@ -2856,7 +2814,7 @@ function getTSProject(docFsPath) {
|
|
|
2856
2814
|
const potentialGlobalFiles = new Set(
|
|
2857
2815
|
fileNames.filter((file) => /\.[cm]?ts$/.test(file))
|
|
2858
2816
|
);
|
|
2859
|
-
const tsPkgFile = configFile &&
|
|
2817
|
+
const tsPkgFile = configFile && ts.resolveModuleName("typescript/package.json", configFile, options, ts.sys).resolvedModule?.resolvedFileName;
|
|
2860
2818
|
const defaultLibFile = path8.join(
|
|
2861
2819
|
tsPkgFile ? path8.join(tsPkgFile, "../lib") : __dirname,
|
|
2862
2820
|
ts.getDefaultLibFileName(options)
|
|
@@ -2906,10 +2864,7 @@ function getTSProject(docFsPath) {
|
|
|
2906
2864
|
});
|
|
2907
2865
|
},
|
|
2908
2866
|
readDirectory: ts.sys.readDirectory,
|
|
2909
|
-
readFile: (filename) =>
|
|
2910
|
-
var _a2;
|
|
2911
|
-
return (_a2 = get(filenameToURI(filename))) == null ? void 0 : _a2.getText();
|
|
2912
|
-
},
|
|
2867
|
+
readFile: (filename) => get(filenameToURI(filename))?.getText(),
|
|
2913
2868
|
fileExists: (filename) => exists(filenameToURI(filename)),
|
|
2914
2869
|
getScriptFileNames() {
|
|
2915
2870
|
const result = new Set(potentialGlobalFiles);
|
|
@@ -2925,8 +2880,7 @@ function getTSProject(docFsPath) {
|
|
|
2925
2880
|
return [...result];
|
|
2926
2881
|
},
|
|
2927
2882
|
getScriptVersion(filename) {
|
|
2928
|
-
|
|
2929
|
-
return `${((_a2 = get(filenameToURI(filename))) == null ? void 0 : _a2.version) ?? -1}`;
|
|
2883
|
+
return `${get(filenameToURI(filename))?.version ?? -1}`;
|
|
2930
2884
|
},
|
|
2931
2885
|
getScriptKind(filename) {
|
|
2932
2886
|
switch (path8.extname(filename)) {
|
|
@@ -2952,8 +2906,7 @@ function getTSProject(docFsPath) {
|
|
|
2952
2906
|
let snapshot = snapshotCache.get(filename);
|
|
2953
2907
|
if (!snapshot) {
|
|
2954
2908
|
const doc = get(filenameToURI(filename));
|
|
2955
|
-
if (!doc)
|
|
2956
|
-
return;
|
|
2909
|
+
if (!doc) return;
|
|
2957
2910
|
snapshot = ts.ScriptSnapshot.fromString(doc.getText());
|
|
2958
2911
|
snapshotCache.set(filename, snapshot);
|
|
2959
2912
|
}
|
|
@@ -2974,7 +2927,6 @@ function filenameToURI(filename) {
|
|
|
2974
2927
|
return URI6.file(filename).toString();
|
|
2975
2928
|
}
|
|
2976
2929
|
async function getPreferences(scriptLang) {
|
|
2977
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2978
2930
|
const configName = scriptLang === ScriptLang.js ? "javascript" : "typescript";
|
|
2979
2931
|
const [preferencesConfig, suggestConfig, inlayHintsConfig] = await Promise.all([
|
|
2980
2932
|
getConfig(`${configName}.preferences`),
|
|
@@ -2989,8 +2941,8 @@ async function getPreferences(scriptLang) {
|
|
|
2989
2941
|
includeCompletionsWithSnippetText: suggestConfig.includeCompletionsWithSnippetText ?? true,
|
|
2990
2942
|
includeAutomaticOptionalChainCompletions: suggestConfig.includeAutomaticOptionalChainCompletions ?? true,
|
|
2991
2943
|
includeCompletionsWithInsertText: true,
|
|
2992
|
-
includeCompletionsWithClassMemberSnippets:
|
|
2993
|
-
includeCompletionsWithObjectLiteralMethodSnippets:
|
|
2944
|
+
includeCompletionsWithClassMemberSnippets: suggestConfig.classMemberSnippets?.enabled ?? true,
|
|
2945
|
+
includeCompletionsWithObjectLiteralMethodSnippets: suggestConfig.objectLiteralMethodSnippets?.enabled ?? true,
|
|
2994
2946
|
useLabelDetailsInCompletionEntries: true,
|
|
2995
2947
|
allowIncompleteCompletions: true,
|
|
2996
2948
|
importModuleSpecifierPreference: preferencesConfig.importModuleSpecifierPreference,
|
|
@@ -3000,13 +2952,13 @@ async function getPreferences(scriptLang) {
|
|
|
3000
2952
|
includePackageJsonAutoImports: preferencesConfig.includePackageJsonAutoImports ?? true,
|
|
3001
2953
|
provideRefactorNotApplicableReason: true,
|
|
3002
2954
|
jsxAttributeCompletionStyle: preferencesConfig.jsxAttributeCompletionStyle ?? "auto",
|
|
3003
|
-
includeInlayParameterNameHints:
|
|
3004
|
-
includeInlayParameterNameHintsWhenArgumentMatchesName: !
|
|
3005
|
-
includeInlayFunctionParameterTypeHints:
|
|
3006
|
-
includeInlayVariableTypeHints:
|
|
3007
|
-
includeInlayPropertyDeclarationTypeHints:
|
|
3008
|
-
includeInlayFunctionLikeReturnTypeHints:
|
|
3009
|
-
includeInlayEnumMemberValueHints:
|
|
2955
|
+
includeInlayParameterNameHints: inlayHintsConfig.parameterNames?.enabled ?? "none",
|
|
2956
|
+
includeInlayParameterNameHintsWhenArgumentMatchesName: !inlayHintsConfig.parameterNames?.suppressWhenArgumentMatchesName,
|
|
2957
|
+
includeInlayFunctionParameterTypeHints: inlayHintsConfig.parameterTypes?.enabled ?? true,
|
|
2958
|
+
includeInlayVariableTypeHints: inlayHintsConfig.variableTypes?.enabled ?? true,
|
|
2959
|
+
includeInlayPropertyDeclarationTypeHints: inlayHintsConfig.propertyDeclarationTypes?.enabled ?? true,
|
|
2960
|
+
includeInlayFunctionLikeReturnTypeHints: inlayHintsConfig.functionLikeReturnTypes?.enabled ?? true,
|
|
2961
|
+
includeInlayEnumMemberValueHints: inlayHintsConfig.enumMemberValues?.enabled ?? true
|
|
3010
2962
|
};
|
|
3011
2963
|
}
|
|
3012
2964
|
function printDocumentation(docs2, tags) {
|
|
@@ -3055,10 +3007,8 @@ function convertDiagTags(tsDiag) {
|
|
|
3055
3007
|
tags = [DiagnosticTag.Deprecated];
|
|
3056
3008
|
}
|
|
3057
3009
|
if (tsDiag.reportsUnnecessary) {
|
|
3058
|
-
if (tags)
|
|
3059
|
-
|
|
3060
|
-
else
|
|
3061
|
-
tags = [DiagnosticTag.Unnecessary];
|
|
3010
|
+
if (tags) tags.push(DiagnosticTag.Unnecessary);
|
|
3011
|
+
else tags = [DiagnosticTag.Unnecessary];
|
|
3062
3012
|
}
|
|
3063
3013
|
return tags;
|
|
3064
3014
|
}
|
|
@@ -3153,8 +3103,7 @@ var StyleSheetService = {
|
|
|
3153
3103
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3154
3104
|
for (const style of processStyle(doc)) {
|
|
3155
3105
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3156
|
-
if (generatedPos === void 0)
|
|
3157
|
-
continue;
|
|
3106
|
+
if (generatedPos === void 0) continue;
|
|
3158
3107
|
const result = await style.service.doComplete2(
|
|
3159
3108
|
style.virtualDoc,
|
|
3160
3109
|
generatedPos,
|
|
@@ -3190,8 +3139,7 @@ var StyleSheetService = {
|
|
|
3190
3139
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3191
3140
|
for (const style of processStyle(doc)) {
|
|
3192
3141
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3193
|
-
if (generatedPos === void 0)
|
|
3194
|
-
continue;
|
|
3142
|
+
if (generatedPos === void 0) continue;
|
|
3195
3143
|
const result = style.service.findDefinition(
|
|
3196
3144
|
style.virtualDoc,
|
|
3197
3145
|
generatedPos,
|
|
@@ -3213,8 +3161,7 @@ var StyleSheetService = {
|
|
|
3213
3161
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3214
3162
|
for (const style of processStyle(doc)) {
|
|
3215
3163
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3216
|
-
if (generatedPos === void 0)
|
|
3217
|
-
continue;
|
|
3164
|
+
if (generatedPos === void 0) continue;
|
|
3218
3165
|
const result = [];
|
|
3219
3166
|
for (const location of style.service.findReferences(
|
|
3220
3167
|
style.virtualDoc,
|
|
@@ -3283,8 +3230,7 @@ var StyleSheetService = {
|
|
|
3283
3230
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3284
3231
|
for (const style of processStyle(doc)) {
|
|
3285
3232
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3286
|
-
if (generatedPos === void 0)
|
|
3287
|
-
continue;
|
|
3233
|
+
if (generatedPos === void 0) continue;
|
|
3288
3234
|
const result = [];
|
|
3289
3235
|
for (const highlight of style.service.findDocumentHighlights(
|
|
3290
3236
|
style.virtualDoc,
|
|
@@ -3323,8 +3269,7 @@ var StyleSheetService = {
|
|
|
3323
3269
|
getColorPresentations(doc, params) {
|
|
3324
3270
|
for (const extracted of processStyle(doc)) {
|
|
3325
3271
|
const generatedRange = getGeneratedRange(doc, extracted, params.range);
|
|
3326
|
-
if (generatedRange === void 0)
|
|
3327
|
-
continue;
|
|
3272
|
+
if (generatedRange === void 0) continue;
|
|
3328
3273
|
const result = [];
|
|
3329
3274
|
for (const colorPresentation of extracted.service.getColorPresentations(
|
|
3330
3275
|
extracted.virtualDoc,
|
|
@@ -3349,8 +3294,7 @@ var StyleSheetService = {
|
|
|
3349
3294
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3350
3295
|
for (const style of processStyle(doc)) {
|
|
3351
3296
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3352
|
-
if (generatedPos === void 0)
|
|
3353
|
-
continue;
|
|
3297
|
+
if (generatedPos === void 0) continue;
|
|
3354
3298
|
const result = style.service.doHover(
|
|
3355
3299
|
style.virtualDoc,
|
|
3356
3300
|
generatedPos,
|
|
@@ -3375,8 +3319,7 @@ var StyleSheetService = {
|
|
|
3375
3319
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3376
3320
|
for (const style of processStyle(doc)) {
|
|
3377
3321
|
const generatedOffset = style.extracted.generatedOffsetAt(sourceOffset);
|
|
3378
|
-
if (generatedOffset === void 0)
|
|
3379
|
-
continue;
|
|
3322
|
+
if (generatedOffset === void 0) continue;
|
|
3380
3323
|
const result = style.service.doRename(
|
|
3381
3324
|
style.virtualDoc,
|
|
3382
3325
|
style.virtualDoc.positionAt(generatedOffset),
|
|
@@ -3403,11 +3346,9 @@ var StyleSheetService = {
|
|
|
3403
3346
|
}
|
|
3404
3347
|
},
|
|
3405
3348
|
doCodeActions(doc, params) {
|
|
3406
|
-
var _a;
|
|
3407
3349
|
for (const extracted of processStyle(doc)) {
|
|
3408
3350
|
const generatedRange = getGeneratedRange(doc, extracted, params.range);
|
|
3409
|
-
if (generatedRange === void 0)
|
|
3410
|
-
continue;
|
|
3351
|
+
if (generatedRange === void 0) continue;
|
|
3411
3352
|
const result = extracted.service.doCodeActions(
|
|
3412
3353
|
extracted.virtualDoc,
|
|
3413
3354
|
generatedRange,
|
|
@@ -3415,7 +3356,7 @@ var StyleSheetService = {
|
|
|
3415
3356
|
extracted.parsed
|
|
3416
3357
|
);
|
|
3417
3358
|
for (const command of result) {
|
|
3418
|
-
const edits =
|
|
3359
|
+
const edits = command.arguments?.[2];
|
|
3419
3360
|
if (edits && Array.isArray(edits) && isTextEdit(edits[0])) {
|
|
3420
3361
|
command.arguments[2] = getSourceEdits(extracted, edits);
|
|
3421
3362
|
}
|
|
@@ -3443,13 +3384,12 @@ var StyleSheetService = {
|
|
|
3443
3384
|
};
|
|
3444
3385
|
function processStyle(doc) {
|
|
3445
3386
|
return processDoc(doc, ({ uri, version, parsed, lookup }) => {
|
|
3446
|
-
var _a;
|
|
3447
3387
|
const result = [];
|
|
3448
3388
|
for (const [ext, extracted] of extractStyle({
|
|
3449
3389
|
parsed,
|
|
3450
3390
|
lookup
|
|
3451
3391
|
})) {
|
|
3452
|
-
const service2 =
|
|
3392
|
+
const service2 = services[ext]?.({
|
|
3453
3393
|
fileSystemProvider: file_system_default,
|
|
3454
3394
|
clientCapabilities
|
|
3455
3395
|
});
|
|
@@ -3534,25 +3474,17 @@ var service = {
|
|
|
3534
3474
|
commands: Object.assign({}, ...plugins.map(({ commands }) => commands)),
|
|
3535
3475
|
async initialize(params) {
|
|
3536
3476
|
await Promise.allSettled(
|
|
3537
|
-
plugins.map((plugin) =>
|
|
3538
|
-
var _a;
|
|
3539
|
-
return (_a = plugin.initialize) == null ? void 0 : _a.call(plugin, params);
|
|
3540
|
-
})
|
|
3477
|
+
plugins.map((plugin) => plugin.initialize?.(params))
|
|
3541
3478
|
);
|
|
3542
3479
|
},
|
|
3543
3480
|
async doComplete(doc, params, cancel) {
|
|
3544
3481
|
const results = await Promise.allSettled(
|
|
3545
|
-
plugins.map((plugin) =>
|
|
3546
|
-
var _a;
|
|
3547
|
-
return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3548
|
-
})
|
|
3482
|
+
plugins.map((plugin) => plugin.doComplete?.(doc, params, cancel))
|
|
3549
3483
|
);
|
|
3550
|
-
if (cancel.isCancellationRequested)
|
|
3551
|
-
return;
|
|
3484
|
+
if (cancel.isCancellationRequested) return;
|
|
3552
3485
|
const itemsByLabel = /* @__PURE__ */ new Map();
|
|
3553
3486
|
for (const result of results) {
|
|
3554
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3555
|
-
continue;
|
|
3487
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3556
3488
|
for (const item of Array.isArray(result.value) ? result.value : result.value.items) {
|
|
3557
3489
|
const { label } = item;
|
|
3558
3490
|
const existingItem = itemsByLabel.get(label);
|
|
@@ -3568,48 +3500,35 @@ var service = {
|
|
|
3568
3500
|
return { items: [...itemsByLabel.values()], isIncomplete: true };
|
|
3569
3501
|
},
|
|
3570
3502
|
async doCompletionResolve(item, cancel) {
|
|
3571
|
-
var _a;
|
|
3572
3503
|
for (const plugin of plugins) {
|
|
3573
3504
|
try {
|
|
3574
|
-
const result = await
|
|
3575
|
-
if (cancel.isCancellationRequested)
|
|
3576
|
-
|
|
3577
|
-
if (result)
|
|
3578
|
-
return result;
|
|
3505
|
+
const result = await plugin.doCompletionResolve?.(item, cancel);
|
|
3506
|
+
if (cancel.isCancellationRequested) return;
|
|
3507
|
+
if (result) return result;
|
|
3579
3508
|
} catch {
|
|
3580
3509
|
}
|
|
3581
3510
|
}
|
|
3582
3511
|
},
|
|
3583
3512
|
async findDefinition(doc, params, cancel) {
|
|
3584
3513
|
const results = await Promise.allSettled(
|
|
3585
|
-
plugins.map((plugin) =>
|
|
3586
|
-
var _a;
|
|
3587
|
-
return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3588
|
-
})
|
|
3514
|
+
plugins.map((plugin) => plugin.findDefinition?.(doc, params, cancel))
|
|
3589
3515
|
);
|
|
3590
|
-
if (cancel.isCancellationRequested)
|
|
3591
|
-
return;
|
|
3516
|
+
if (cancel.isCancellationRequested) return;
|
|
3592
3517
|
let links;
|
|
3593
3518
|
for (const result of results) {
|
|
3594
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3595
|
-
continue;
|
|
3519
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3596
3520
|
links = (links || []).concat(result.value);
|
|
3597
3521
|
}
|
|
3598
3522
|
return links;
|
|
3599
3523
|
},
|
|
3600
3524
|
async findReferences(doc, params, cancel) {
|
|
3601
3525
|
const results = await Promise.allSettled(
|
|
3602
|
-
plugins.map((plugin) =>
|
|
3603
|
-
var _a;
|
|
3604
|
-
return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3605
|
-
})
|
|
3526
|
+
plugins.map((plugin) => plugin.findReferences?.(doc, params, cancel))
|
|
3606
3527
|
);
|
|
3607
|
-
if (cancel.isCancellationRequested)
|
|
3608
|
-
return;
|
|
3528
|
+
if (cancel.isCancellationRequested) return;
|
|
3609
3529
|
let references;
|
|
3610
3530
|
for (const result of results) {
|
|
3611
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3612
|
-
continue;
|
|
3531
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3613
3532
|
references = (references || []).concat(result.value);
|
|
3614
3533
|
}
|
|
3615
3534
|
return references;
|
|
@@ -3617,35 +3536,25 @@ var service = {
|
|
|
3617
3536
|
async findDocumentSymbols(doc, params, cancel) {
|
|
3618
3537
|
const results = await Promise.allSettled(
|
|
3619
3538
|
plugins.map(
|
|
3620
|
-
(plugin) =>
|
|
3621
|
-
var _a;
|
|
3622
|
-
return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3623
|
-
}
|
|
3539
|
+
(plugin) => plugin.findDocumentSymbols?.(doc, params, cancel)
|
|
3624
3540
|
)
|
|
3625
3541
|
);
|
|
3626
|
-
if (cancel.isCancellationRequested)
|
|
3627
|
-
return;
|
|
3542
|
+
if (cancel.isCancellationRequested) return;
|
|
3628
3543
|
let symbols;
|
|
3629
3544
|
for (const result of results) {
|
|
3630
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3631
|
-
continue;
|
|
3545
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3632
3546
|
symbols = (symbols || []).concat(result.value);
|
|
3633
3547
|
}
|
|
3634
3548
|
return symbols;
|
|
3635
3549
|
},
|
|
3636
3550
|
async findDocumentLinks(doc, params, cancel) {
|
|
3637
3551
|
const results = await Promise.allSettled(
|
|
3638
|
-
plugins.map((plugin) =>
|
|
3639
|
-
var _a;
|
|
3640
|
-
return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3641
|
-
})
|
|
3552
|
+
plugins.map((plugin) => plugin.findDocumentLinks?.(doc, params, cancel))
|
|
3642
3553
|
);
|
|
3643
|
-
if (cancel.isCancellationRequested)
|
|
3644
|
-
return;
|
|
3554
|
+
if (cancel.isCancellationRequested) return;
|
|
3645
3555
|
let links;
|
|
3646
3556
|
for (const result of results) {
|
|
3647
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3648
|
-
continue;
|
|
3557
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3649
3558
|
links = (links || []).concat(result.value);
|
|
3650
3559
|
}
|
|
3651
3560
|
return links;
|
|
@@ -3653,35 +3562,25 @@ var service = {
|
|
|
3653
3562
|
async findDocumentHighlights(doc, params, cancel) {
|
|
3654
3563
|
const results = await Promise.allSettled(
|
|
3655
3564
|
plugins.map(
|
|
3656
|
-
(plugin) =>
|
|
3657
|
-
var _a;
|
|
3658
|
-
return (_a = plugin.findDocumentHighlights) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3659
|
-
}
|
|
3565
|
+
(plugin) => plugin.findDocumentHighlights?.(doc, params, cancel)
|
|
3660
3566
|
)
|
|
3661
3567
|
);
|
|
3662
|
-
if (cancel.isCancellationRequested)
|
|
3663
|
-
return;
|
|
3568
|
+
if (cancel.isCancellationRequested) return;
|
|
3664
3569
|
let highlights;
|
|
3665
3570
|
for (const result of results) {
|
|
3666
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3667
|
-
continue;
|
|
3571
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3668
3572
|
highlights = (highlights || []).concat(result.value);
|
|
3669
3573
|
}
|
|
3670
3574
|
return highlights;
|
|
3671
3575
|
},
|
|
3672
3576
|
async findDocumentColors(doc, params, cancel) {
|
|
3673
3577
|
const results = await Promise.allSettled(
|
|
3674
|
-
plugins.map((plugin) =>
|
|
3675
|
-
var _a;
|
|
3676
|
-
return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3677
|
-
})
|
|
3578
|
+
plugins.map((plugin) => plugin.findDocumentColors?.(doc, params, cancel))
|
|
3678
3579
|
);
|
|
3679
|
-
if (cancel.isCancellationRequested)
|
|
3680
|
-
return;
|
|
3580
|
+
if (cancel.isCancellationRequested) return;
|
|
3681
3581
|
let colors;
|
|
3682
3582
|
for (const result of results) {
|
|
3683
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3684
|
-
continue;
|
|
3583
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3685
3584
|
colors = (colors || []).concat(result.value);
|
|
3686
3585
|
}
|
|
3687
3586
|
return colors;
|
|
@@ -3689,35 +3588,25 @@ var service = {
|
|
|
3689
3588
|
async getColorPresentations(doc, params, cancel) {
|
|
3690
3589
|
const results = await Promise.allSettled(
|
|
3691
3590
|
plugins.map(
|
|
3692
|
-
(plugin) =>
|
|
3693
|
-
var _a;
|
|
3694
|
-
return (_a = plugin.getColorPresentations) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3695
|
-
}
|
|
3591
|
+
(plugin) => plugin.getColorPresentations?.(doc, params, cancel)
|
|
3696
3592
|
)
|
|
3697
3593
|
);
|
|
3698
|
-
if (cancel.isCancellationRequested)
|
|
3699
|
-
return;
|
|
3594
|
+
if (cancel.isCancellationRequested) return;
|
|
3700
3595
|
let presentations;
|
|
3701
3596
|
for (const result of results) {
|
|
3702
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3703
|
-
continue;
|
|
3597
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3704
3598
|
presentations = (presentations || []).concat(result.value);
|
|
3705
3599
|
}
|
|
3706
3600
|
return presentations;
|
|
3707
3601
|
},
|
|
3708
3602
|
async doHover(doc, params, cancel) {
|
|
3709
3603
|
const results = await Promise.allSettled(
|
|
3710
|
-
plugins.map((plugin) =>
|
|
3711
|
-
var _a;
|
|
3712
|
-
return (_a = plugin.doHover) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3713
|
-
})
|
|
3604
|
+
plugins.map((plugin) => plugin.doHover?.(doc, params, cancel))
|
|
3714
3605
|
);
|
|
3715
|
-
if (cancel.isCancellationRequested)
|
|
3716
|
-
return;
|
|
3606
|
+
if (cancel.isCancellationRequested) return;
|
|
3717
3607
|
let hovers;
|
|
3718
3608
|
for (const result of results) {
|
|
3719
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3720
|
-
continue;
|
|
3609
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3721
3610
|
if (hovers) {
|
|
3722
3611
|
hovers.range = maxRange(hovers.range, result.value.range);
|
|
3723
3612
|
hovers.contents = mergeHoverContents(
|
|
@@ -3732,19 +3621,14 @@ var service = {
|
|
|
3732
3621
|
},
|
|
3733
3622
|
async doRename(doc, params, cancel) {
|
|
3734
3623
|
const results = await Promise.allSettled(
|
|
3735
|
-
plugins.map((plugin) =>
|
|
3736
|
-
var _a;
|
|
3737
|
-
return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3738
|
-
})
|
|
3624
|
+
plugins.map((plugin) => plugin.doRename?.(doc, params, cancel))
|
|
3739
3625
|
);
|
|
3740
|
-
if (cancel.isCancellationRequested)
|
|
3741
|
-
return;
|
|
3626
|
+
if (cancel.isCancellationRequested) return;
|
|
3742
3627
|
let changes;
|
|
3743
3628
|
let changeAnnotations;
|
|
3744
3629
|
let documentChanges;
|
|
3745
3630
|
for (const result of results) {
|
|
3746
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3747
|
-
continue;
|
|
3631
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3748
3632
|
const { value } = result;
|
|
3749
3633
|
if (value.changes) {
|
|
3750
3634
|
if (changes) {
|
|
@@ -3776,32 +3660,23 @@ var service = {
|
|
|
3776
3660
|
},
|
|
3777
3661
|
async doCodeActions(doc, params, cancel) {
|
|
3778
3662
|
const results = await Promise.allSettled(
|
|
3779
|
-
plugins.map((plugin) =>
|
|
3780
|
-
var _a;
|
|
3781
|
-
return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3782
|
-
})
|
|
3663
|
+
plugins.map((plugin) => plugin.doCodeActions?.(doc, params, cancel))
|
|
3783
3664
|
);
|
|
3784
|
-
if (cancel.isCancellationRequested)
|
|
3785
|
-
return;
|
|
3665
|
+
if (cancel.isCancellationRequested) return;
|
|
3786
3666
|
let actions;
|
|
3787
3667
|
for (const result of results) {
|
|
3788
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3789
|
-
continue;
|
|
3668
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3790
3669
|
actions = (actions || []).concat(result.value);
|
|
3791
3670
|
}
|
|
3792
3671
|
return actions;
|
|
3793
3672
|
},
|
|
3794
3673
|
async doValidate(doc) {
|
|
3795
3674
|
const results = await Promise.allSettled(
|
|
3796
|
-
plugins.map((plugin) =>
|
|
3797
|
-
var _a;
|
|
3798
|
-
return (_a = plugin.doValidate) == null ? void 0 : _a.call(plugin, doc);
|
|
3799
|
-
})
|
|
3675
|
+
plugins.map((plugin) => plugin.doValidate?.(doc))
|
|
3800
3676
|
);
|
|
3801
3677
|
let diagnostics;
|
|
3802
3678
|
for (const result of results) {
|
|
3803
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3804
|
-
continue;
|
|
3679
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3805
3680
|
diagnostics = (diagnostics || []).concat(result.value);
|
|
3806
3681
|
}
|
|
3807
3682
|
return diagnostics;
|
|
@@ -3809,10 +3684,8 @@ var service = {
|
|
|
3809
3684
|
format: marko_default.format
|
|
3810
3685
|
};
|
|
3811
3686
|
function maxRange(a, b) {
|
|
3812
|
-
if (!a)
|
|
3813
|
-
|
|
3814
|
-
if (!b)
|
|
3815
|
-
return a;
|
|
3687
|
+
if (!a) return b;
|
|
3688
|
+
if (!b) return a;
|
|
3816
3689
|
return {
|
|
3817
3690
|
start: {
|
|
3818
3691
|
line: Math.min(a.start.line, b.start.line),
|
|
@@ -3825,10 +3698,8 @@ function maxRange(a, b) {
|
|
|
3825
3698
|
};
|
|
3826
3699
|
}
|
|
3827
3700
|
function mergeHoverContents(a, b) {
|
|
3828
|
-
if (!a)
|
|
3829
|
-
|
|
3830
|
-
if (!b)
|
|
3831
|
-
return a;
|
|
3701
|
+
if (!a) return b;
|
|
3702
|
+
if (!b) return a;
|
|
3832
3703
|
if (!MarkupContent.is(a)) {
|
|
3833
3704
|
a = markedStringToMarkupContent(a);
|
|
3834
3705
|
}
|
|
@@ -4057,8 +3928,7 @@ function queueDiagnostic() {
|
|
|
4057
3928
|
}
|
|
4058
3929
|
const prevDiag = prevDiags.get(doc) || [];
|
|
4059
3930
|
const nextDiag = await service.doValidate(doc) || [];
|
|
4060
|
-
if (isDeepStrictEqual(prevDiag, nextDiag))
|
|
4061
|
-
return;
|
|
3931
|
+
if (isDeepStrictEqual(prevDiag, nextDiag)) return;
|
|
4062
3932
|
return [doc, nextDiag];
|
|
4063
3933
|
})
|
|
4064
3934
|
);
|