@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.js
CHANGED
|
@@ -121,12 +121,10 @@ function getAllOpen() {
|
|
|
121
121
|
}
|
|
122
122
|
function get(uri) {
|
|
123
123
|
const doc = docs.get(uri);
|
|
124
|
-
if (doc)
|
|
125
|
-
return doc;
|
|
124
|
+
if (doc) return doc;
|
|
126
125
|
const { fsPath, scheme } = import_vscode_uri2.URI.parse(uri);
|
|
127
126
|
if (scheme === "file") {
|
|
128
|
-
if (fileExists.get(uri) === false)
|
|
129
|
-
return void 0;
|
|
127
|
+
if (fileExists.get(uri) === false) return void 0;
|
|
130
128
|
try {
|
|
131
129
|
const newDoc = import_vscode_languageserver_textdocument.TextDocument.create(
|
|
132
130
|
uri,
|
|
@@ -144,8 +142,7 @@ function get(uri) {
|
|
|
144
142
|
}
|
|
145
143
|
function exists(uri) {
|
|
146
144
|
const cached = fileExists.get(uri);
|
|
147
|
-
if (cached !== void 0)
|
|
148
|
-
return cached;
|
|
145
|
+
if (cached !== void 0) return cached;
|
|
149
146
|
const { fsPath, scheme } = import_vscode_uri2.URI.parse(uri);
|
|
150
147
|
if (scheme === "file") {
|
|
151
148
|
try {
|
|
@@ -294,8 +291,7 @@ function display(type, data) {
|
|
|
294
291
|
const msg = typeof data === "string" ? data : (0, import_util.inspect)(data, { colors: false });
|
|
295
292
|
const previousMessages = previousMessagesByType.get(type);
|
|
296
293
|
if (previousMessages) {
|
|
297
|
-
if (previousMessages.includes(msg))
|
|
298
|
-
return;
|
|
294
|
+
if (previousMessages.includes(msg)) return;
|
|
299
295
|
previousMessages.push(msg);
|
|
300
296
|
if (previousMessages.length > 3) {
|
|
301
297
|
previousMessages.unshift();
|
|
@@ -317,505 +313,530 @@ var import_jsdom = require("jsdom");
|
|
|
317
313
|
// src/service/html/axe-rules/axe-rules.ts
|
|
318
314
|
var keyboard = {
|
|
319
315
|
/**
|
|
320
|
-
* -
|
|
321
|
-
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
316
|
+
* - Ensure every accesskey attribute value is unique
|
|
317
|
+
* - accesskey attribute value should be unique ([url](https://dequeuniversity.com/rules/axe/4.10/accesskeys?application=axeAPI))
|
|
322
318
|
*/
|
|
323
319
|
accesskeys: "accesskeys",
|
|
324
320
|
/**
|
|
325
|
-
* -
|
|
326
|
-
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
321
|
+
* - Ensure each page has at least one mechanism for a user to bypass navigation and jump straight to the content
|
|
322
|
+
* - Page must have means to bypass repeated blocks ([url](https://dequeuniversity.com/rules/axe/4.10/bypass?application=axeAPI))
|
|
327
323
|
*/
|
|
328
324
|
bypass: "bypass",
|
|
329
325
|
/**
|
|
330
|
-
* -
|
|
331
|
-
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
326
|
+
* - Ensure elements in the focus order have a role appropriate for interactive content
|
|
327
|
+
* - Elements in the focus order should have an appropriate role ([url](https://dequeuniversity.com/rules/axe/4.10/focus-order-semantics?application=axeAPI))
|
|
332
328
|
*/
|
|
333
329
|
focusOrderSemantics: "focus-order-semantics",
|
|
334
330
|
/**
|
|
335
|
-
* -
|
|
336
|
-
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.
|
|
331
|
+
* - Ensure `<frame>` and `<iframe>` elements with focusable content do not have tabindex=-1
|
|
332
|
+
* - Frames with focusable content must not have tabindex=-1 ([url](https://dequeuniversity.com/rules/axe/4.10/frame-focusable-content?application=axeAPI))
|
|
337
333
|
*/
|
|
338
334
|
frameFocusableContent: "frame-focusable-content",
|
|
339
335
|
/**
|
|
340
|
-
* -
|
|
341
|
-
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.
|
|
336
|
+
* - Ensure interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies
|
|
337
|
+
* - Interactive controls must not be nested ([url](https://dequeuniversity.com/rules/axe/4.10/nested-interactive?application=axeAPI))
|
|
342
338
|
*/
|
|
343
339
|
nestedInteractive: "nested-interactive",
|
|
344
340
|
/**
|
|
345
|
-
* -
|
|
346
|
-
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.
|
|
341
|
+
* - Ensure all page content is contained by landmarks
|
|
342
|
+
* - All page content should be contained by landmarks ([url](https://dequeuniversity.com/rules/axe/4.10/region?application=axeAPI))
|
|
347
343
|
*/
|
|
348
344
|
region: "region",
|
|
349
345
|
/**
|
|
350
346
|
* - Ensure elements that have scrollable content are accessible by keyboard
|
|
351
|
-
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.
|
|
347
|
+
* - Scrollable region must have keyboard access ([url](https://dequeuniversity.com/rules/axe/4.10/scrollable-region-focusable?application=axeAPI))
|
|
352
348
|
*/
|
|
353
349
|
scrollableRegionFocusable: "scrollable-region-focusable",
|
|
354
350
|
/**
|
|
355
351
|
* - Ensure all skip links have a focusable target
|
|
356
|
-
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.
|
|
352
|
+
* - The skip-link target should exist and be focusable ([url](https://dequeuniversity.com/rules/axe/4.10/skip-link?application=axeAPI))
|
|
357
353
|
*/
|
|
358
354
|
skipLink: "skip-link",
|
|
359
355
|
/**
|
|
360
|
-
* -
|
|
361
|
-
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.
|
|
356
|
+
* - Ensure tabindex attribute values are not greater than 0
|
|
357
|
+
* - Elements should not have tabindex greater than zero ([url](https://dequeuniversity.com/rules/axe/4.10/tabindex?application=axeAPI))
|
|
362
358
|
*/
|
|
363
359
|
tabindex: "tabindex"
|
|
364
360
|
};
|
|
365
361
|
var textAlternatives = {
|
|
366
362
|
/**
|
|
367
|
-
* -
|
|
368
|
-
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
363
|
+
* - Ensure `<area>` elements of image maps have alternate text
|
|
364
|
+
* - Active `<area>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/area-alt?application=axeAPI))
|
|
369
365
|
*/
|
|
370
366
|
areaAlt: "area-alt",
|
|
371
367
|
/**
|
|
372
|
-
* -
|
|
373
|
-
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
368
|
+
* - Ensure each HTML document contains a non-empty `<title>` element
|
|
369
|
+
* - Documents must have `<title>` element to aid in navigation ([url](https://dequeuniversity.com/rules/axe/4.10/document-title?application=axeAPI))
|
|
374
370
|
*/
|
|
375
371
|
documentTitle: "document-title",
|
|
376
372
|
/**
|
|
377
|
-
* -
|
|
378
|
-
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
373
|
+
* - Ensure `<iframe>` and `<frame>` elements contain a unique title attribute
|
|
374
|
+
* - Frames must have a unique title attribute ([url](https://dequeuniversity.com/rules/axe/4.10/frame-title-unique?application=axeAPI))
|
|
379
375
|
*/
|
|
380
376
|
frameTitleUnique: "frame-title-unique",
|
|
381
377
|
/**
|
|
382
|
-
* -
|
|
383
|
-
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
378
|
+
* - Ensure `<iframe>` and `<frame>` elements have an accessible name
|
|
379
|
+
* - Frames must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/frame-title?application=axeAPI))
|
|
384
380
|
*/
|
|
385
381
|
frameTitle: "frame-title",
|
|
386
382
|
/**
|
|
387
|
-
* -
|
|
388
|
-
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
383
|
+
* - Ensure `<img>` elements have alternate text or a role of none or presentation
|
|
384
|
+
* - Images must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/image-alt?application=axeAPI))
|
|
389
385
|
*/
|
|
390
386
|
imageAlt: "image-alt",
|
|
391
387
|
/**
|
|
392
388
|
* - Ensure image alternative is not repeated as text
|
|
393
|
-
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
389
|
+
* - Alternative text of images should not be repeated as text ([url](https://dequeuniversity.com/rules/axe/4.10/image-redundant-alt?application=axeAPI))
|
|
394
390
|
*/
|
|
395
391
|
imageRedundantAlt: "image-redundant-alt",
|
|
396
392
|
/**
|
|
397
|
-
* -
|
|
398
|
-
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
393
|
+
* - Ensure `<input type="image">` elements have alternate text
|
|
394
|
+
* - Image buttons must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/input-image-alt?application=axeAPI))
|
|
399
395
|
*/
|
|
400
396
|
inputImageAlt: "input-image-alt",
|
|
401
397
|
/**
|
|
402
|
-
* -
|
|
403
|
-
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
398
|
+
* - Ensure `<object>` elements have alternate text
|
|
399
|
+
* - `<object>` elements must have alternate text ([url](https://dequeuniversity.com/rules/axe/4.10/object-alt?application=axeAPI))
|
|
404
400
|
*/
|
|
405
401
|
objectAlt: "object-alt",
|
|
406
402
|
/**
|
|
407
|
-
* -
|
|
408
|
-
* - [role=
|
|
403
|
+
* - Ensure [role="img"] elements have alternate text
|
|
404
|
+
* - [role="img"] elements must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.10/role-img-alt?application=axeAPI))
|
|
409
405
|
*/
|
|
410
406
|
roleImgAlt: "role-img-alt",
|
|
411
407
|
/**
|
|
412
|
-
* -
|
|
413
|
-
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
408
|
+
* - Ensure that server-side image maps are not used
|
|
409
|
+
* - Server-side image maps must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/server-side-image-map?application=axeAPI))
|
|
414
410
|
*/
|
|
415
411
|
serverSideImageMap: "server-side-image-map",
|
|
416
412
|
/**
|
|
417
|
-
* -
|
|
418
|
-
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
413
|
+
* - Ensure `<svg>` elements with an img, graphics-document or graphics-symbol role have an accessible text
|
|
414
|
+
* - `<svg>` elements with an img role must have an alternative text ([url](https://dequeuniversity.com/rules/axe/4.10/svg-img-alt?application=axeAPI))
|
|
419
415
|
*/
|
|
420
416
|
svgImgAlt: "svg-img-alt",
|
|
421
417
|
/**
|
|
422
|
-
* -
|
|
423
|
-
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.
|
|
418
|
+
* - Ensure `<video>` elements have captions
|
|
419
|
+
* - `<video>` elements must have captions ([url](https://dequeuniversity.com/rules/axe/4.10/video-caption?application=axeAPI))
|
|
424
420
|
*/
|
|
425
421
|
videoCaption: "video-caption"
|
|
426
422
|
};
|
|
427
423
|
var aria = {
|
|
428
424
|
/**
|
|
429
|
-
* -
|
|
430
|
-
* - Elements must only use
|
|
425
|
+
* - Ensure an element's role supports its ARIA attributes
|
|
426
|
+
* - Elements must only use supported ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.10/aria-allowed-attr?application=axeAPI))
|
|
431
427
|
*/
|
|
432
428
|
ariaAllowedAttr: "aria-allowed-attr",
|
|
433
429
|
/**
|
|
434
|
-
* -
|
|
435
|
-
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.
|
|
430
|
+
* - Ensure role attribute has an appropriate value for the element
|
|
431
|
+
* - ARIA role should be appropriate for the element ([url](https://dequeuniversity.com/rules/axe/4.10/aria-allowed-role?application=axeAPI))
|
|
436
432
|
*/
|
|
437
433
|
ariaAllowedRole: "aria-allowed-role",
|
|
438
434
|
/**
|
|
439
|
-
* -
|
|
440
|
-
* -
|
|
435
|
+
* - Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent
|
|
436
|
+
* - aria-braille attributes must have a non-braille equivalent ([url](https://dequeuniversity.com/rules/axe/4.10/aria-braille-equivalent?application=axeAPI))
|
|
437
|
+
*/
|
|
438
|
+
ariaBrailleEquivalent: "aria-braille-equivalent",
|
|
439
|
+
/**
|
|
440
|
+
* - Ensure every ARIA button, link and menuitem has an accessible name
|
|
441
|
+
* - ARIA commands must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-command-name?application=axeAPI))
|
|
441
442
|
*/
|
|
442
443
|
ariaCommandName: "aria-command-name",
|
|
443
444
|
/**
|
|
444
|
-
* -
|
|
445
|
-
* - ARIA
|
|
445
|
+
* - Ensure ARIA attributes are used as described in the specification of the element's role
|
|
446
|
+
* - 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))
|
|
447
|
+
*/
|
|
448
|
+
ariaConditionalAttr: "aria-conditional-attr",
|
|
449
|
+
/**
|
|
450
|
+
* - Ensure elements do not use deprecated roles
|
|
451
|
+
* - Deprecated ARIA roles must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/aria-deprecated-role?application=axeAPI))
|
|
452
|
+
*/
|
|
453
|
+
ariaDeprecatedRole: "aria-deprecated-role",
|
|
454
|
+
/**
|
|
455
|
+
* - Ensure every ARIA dialog and alertdialog node has an accessible name
|
|
456
|
+
* - ARIA dialog and alertdialog nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-dialog-name?application=axeAPI))
|
|
446
457
|
*/
|
|
447
458
|
ariaDialogName: "aria-dialog-name",
|
|
448
459
|
/**
|
|
449
|
-
* -
|
|
450
|
-
* - aria-hidden=
|
|
460
|
+
* - Ensure aria-hidden="true" is not present on the document body.
|
|
461
|
+
* - aria-hidden="true" must not be present on the document body ([url](https://dequeuniversity.com/rules/axe/4.10/aria-hidden-body?application=axeAPI))
|
|
451
462
|
*/
|
|
452
463
|
ariaHiddenBody: "aria-hidden-body",
|
|
453
464
|
/**
|
|
454
|
-
* -
|
|
455
|
-
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
465
|
+
* - Ensure every ARIA input field has an accessible name
|
|
466
|
+
* - ARIA input fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-input-field-name?application=axeAPI))
|
|
456
467
|
*/
|
|
457
468
|
ariaInputFieldName: "aria-input-field-name",
|
|
458
469
|
/**
|
|
459
|
-
* -
|
|
460
|
-
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
470
|
+
* - Ensure every ARIA meter node has an accessible name
|
|
471
|
+
* - ARIA meter nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-meter-name?application=axeAPI))
|
|
461
472
|
*/
|
|
462
473
|
ariaMeterName: "aria-meter-name",
|
|
463
474
|
/**
|
|
464
|
-
* -
|
|
465
|
-
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
475
|
+
* - Ensure every ARIA progressbar node has an accessible name
|
|
476
|
+
* - ARIA progressbar nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-progressbar-name?application=axeAPI))
|
|
466
477
|
*/
|
|
467
478
|
ariaProgressbarName: "aria-progressbar-name",
|
|
468
479
|
/**
|
|
469
|
-
* -
|
|
470
|
-
* -
|
|
480
|
+
* - Ensure ARIA attributes are not prohibited for an element's role
|
|
481
|
+
* - Elements must only use permitted ARIA attributes ([url](https://dequeuniversity.com/rules/axe/4.10/aria-prohibited-attr?application=axeAPI))
|
|
482
|
+
*/
|
|
483
|
+
ariaProhibitedAttr: "aria-prohibited-attr",
|
|
484
|
+
/**
|
|
485
|
+
* - Ensure elements with ARIA roles have all required ARIA attributes
|
|
486
|
+
* - Required ARIA attributes must be provided ([url](https://dequeuniversity.com/rules/axe/4.10/aria-required-attr?application=axeAPI))
|
|
471
487
|
*/
|
|
472
488
|
ariaRequiredAttr: "aria-required-attr",
|
|
473
489
|
/**
|
|
474
|
-
* -
|
|
475
|
-
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.
|
|
490
|
+
* - Ensure elements with an ARIA role that require child roles contain them
|
|
491
|
+
* - Certain ARIA roles must contain particular children ([url](https://dequeuniversity.com/rules/axe/4.10/aria-required-children?application=axeAPI))
|
|
476
492
|
*/
|
|
477
493
|
ariaRequiredChildren: "aria-required-children",
|
|
478
494
|
/**
|
|
479
|
-
* -
|
|
480
|
-
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.
|
|
495
|
+
* - Ensure elements with an ARIA role that require parent roles are contained by them
|
|
496
|
+
* - Certain ARIA roles must be contained by particular parents ([url](https://dequeuniversity.com/rules/axe/4.10/aria-required-parent?application=axeAPI))
|
|
481
497
|
*/
|
|
482
498
|
ariaRequiredParent: "aria-required-parent",
|
|
483
499
|
/**
|
|
484
500
|
* - Ensure aria-roledescription is only used on elements with an implicit or explicit role
|
|
485
|
-
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.
|
|
501
|
+
* - aria-roledescription must be on elements with a semantic role ([url](https://dequeuniversity.com/rules/axe/4.10/aria-roledescription?application=axeAPI))
|
|
486
502
|
*/
|
|
487
503
|
ariaRoledescription: "aria-roledescription",
|
|
488
504
|
/**
|
|
489
|
-
* -
|
|
490
|
-
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
505
|
+
* - Ensure all elements with a role attribute use a valid value
|
|
506
|
+
* - ARIA roles used must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.10/aria-roles?application=axeAPI))
|
|
491
507
|
*/
|
|
492
508
|
ariaRoles: "aria-roles",
|
|
493
509
|
/**
|
|
494
|
-
* -
|
|
495
|
-
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.
|
|
510
|
+
* - Ensure role="text" is used on elements with no focusable descendants
|
|
511
|
+
* - "role=text" should have no focusable descendants ([url](https://dequeuniversity.com/rules/axe/4.10/aria-text?application=axeAPI))
|
|
496
512
|
*/
|
|
497
513
|
ariaText: "aria-text",
|
|
498
514
|
/**
|
|
499
|
-
* -
|
|
500
|
-
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
515
|
+
* - Ensure every ARIA toggle field has an accessible name
|
|
516
|
+
* - ARIA toggle fields must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-toggle-field-name?application=axeAPI))
|
|
501
517
|
*/
|
|
502
518
|
ariaToggleFieldName: "aria-toggle-field-name",
|
|
503
519
|
/**
|
|
504
|
-
* -
|
|
505
|
-
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
520
|
+
* - Ensure every ARIA tooltip node has an accessible name
|
|
521
|
+
* - ARIA tooltip nodes must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-tooltip-name?application=axeAPI))
|
|
506
522
|
*/
|
|
507
523
|
ariaTooltipName: "aria-tooltip-name",
|
|
508
524
|
/**
|
|
509
|
-
* -
|
|
510
|
-
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
525
|
+
* - Ensure every ARIA treeitem node has an accessible name
|
|
526
|
+
* - ARIA treeitem nodes should have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/aria-treeitem-name?application=axeAPI))
|
|
511
527
|
*/
|
|
512
528
|
ariaTreeitemName: "aria-treeitem-name",
|
|
513
529
|
/**
|
|
514
|
-
* -
|
|
515
|
-
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.
|
|
530
|
+
* - Ensure all ARIA attributes have valid values
|
|
531
|
+
* - ARIA attributes must conform to valid values ([url](https://dequeuniversity.com/rules/axe/4.10/aria-valid-attr-value?application=axeAPI))
|
|
516
532
|
*/
|
|
517
533
|
ariaValidAttrValue: "aria-valid-attr-value",
|
|
518
534
|
/**
|
|
519
|
-
* -
|
|
520
|
-
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.
|
|
535
|
+
* - Ensure attributes that begin with aria- are valid ARIA attributes
|
|
536
|
+
* - ARIA attributes must conform to valid names ([url](https://dequeuniversity.com/rules/axe/4.10/aria-valid-attr?application=axeAPI))
|
|
521
537
|
*/
|
|
522
538
|
ariaValidAttr: "aria-valid-attr",
|
|
523
539
|
/**
|
|
524
540
|
* - Elements marked as presentational should not have global ARIA or tabindex to ensure all screen readers ignore them
|
|
525
|
-
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.
|
|
541
|
+
* - Ensure elements marked as presentational are consistently ignored ([url](https://dequeuniversity.com/rules/axe/4.10/presentation-role-conflict?application=axeAPI))
|
|
526
542
|
*/
|
|
527
543
|
presentationRoleConflict: "presentation-role-conflict"
|
|
528
544
|
};
|
|
529
545
|
var nameRoleValue = {
|
|
530
546
|
/**
|
|
531
|
-
* -
|
|
532
|
-
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
547
|
+
* - Ensure aria-hidden elements are not focusable nor contain focusable elements
|
|
548
|
+
* - ARIA hidden element must not be focusable or contain focusable elements ([url](https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI))
|
|
533
549
|
*/
|
|
534
550
|
ariaHiddenFocus: "aria-hidden-focus",
|
|
535
551
|
/**
|
|
536
|
-
* -
|
|
537
|
-
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
552
|
+
* - Ensure buttons have discernible text
|
|
553
|
+
* - Buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/button-name?application=axeAPI))
|
|
538
554
|
*/
|
|
539
555
|
buttonName: "button-name",
|
|
540
556
|
/**
|
|
541
|
-
* -
|
|
542
|
-
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
557
|
+
* - Ensure headings have discernible text
|
|
558
|
+
* - Headings should not be empty ([url](https://dequeuniversity.com/rules/axe/4.10/empty-heading?application=axeAPI))
|
|
543
559
|
*/
|
|
544
560
|
emptyHeading: "empty-heading",
|
|
545
561
|
/**
|
|
546
|
-
* -
|
|
547
|
-
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.
|
|
562
|
+
* - Ensure table headers have discernible text
|
|
563
|
+
* - Table header text should not be empty ([url](https://dequeuniversity.com/rules/axe/4.10/empty-table-header?application=axeAPI))
|
|
548
564
|
*/
|
|
549
565
|
emptyTableHeader: "empty-table-header",
|
|
550
566
|
/**
|
|
551
|
-
* -
|
|
552
|
-
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
567
|
+
* - Ensure input buttons have discernible text
|
|
568
|
+
* - Input buttons must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/input-button-name?application=axeAPI))
|
|
553
569
|
*/
|
|
554
570
|
inputButtonName: "input-button-name",
|
|
555
571
|
/**
|
|
556
|
-
* -
|
|
557
|
-
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.
|
|
572
|
+
* - Ensure links have discernible text
|
|
573
|
+
* - Links must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/link-name?application=axeAPI))
|
|
574
|
+
*/
|
|
575
|
+
linkName: "link-name",
|
|
576
|
+
/**
|
|
577
|
+
* - Ensure summary elements have discernible text
|
|
578
|
+
* - Summary elements must have discernible text ([url](https://dequeuniversity.com/rules/axe/4.10/summary-name?application=axeAPI))
|
|
558
579
|
*/
|
|
559
|
-
|
|
580
|
+
summaryName: "summary-name"
|
|
560
581
|
};
|
|
561
582
|
var timeAndMedia = {
|
|
562
583
|
/**
|
|
563
|
-
* -
|
|
564
|
-
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.
|
|
584
|
+
* - Ensure `<audio>` elements have captions
|
|
585
|
+
* - `<audio>` elements must have a captions track ([url](https://dequeuniversity.com/rules/axe/4.10/audio-caption?application=axeAPI))
|
|
565
586
|
*/
|
|
566
587
|
audioCaption: "audio-caption",
|
|
567
588
|
/**
|
|
568
|
-
* -
|
|
569
|
-
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
589
|
+
* - Ensure `<blink>` elements are not used
|
|
590
|
+
* - `<blink>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/blink?application=axeAPI))
|
|
570
591
|
*/
|
|
571
592
|
blink: "blink",
|
|
572
593
|
/**
|
|
573
|
-
* -
|
|
574
|
-
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
594
|
+
* - Ensure `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
595
|
+
* - Delayed refresh must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/meta-refresh-no-exceptions?application=axeAPI))
|
|
575
596
|
*/
|
|
576
597
|
metaRefreshNoExceptions: "meta-refresh-no-exceptions",
|
|
577
598
|
/**
|
|
578
|
-
* -
|
|
579
|
-
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
599
|
+
* - Ensure `<meta http-equiv="refresh">` is not used for delayed refresh
|
|
600
|
+
* - Delayed refresh under 20 hours must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/meta-refresh?application=axeAPI))
|
|
580
601
|
*/
|
|
581
602
|
metaRefresh: "meta-refresh",
|
|
582
603
|
/**
|
|
583
|
-
* -
|
|
584
|
-
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.
|
|
604
|
+
* - Ensure `<video>` or `<audio>` elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio
|
|
605
|
+
* - `<video>` or `<audio>` elements must not play automatically ([url](https://dequeuniversity.com/rules/axe/4.10/no-autoplay-audio?application=axeAPI))
|
|
585
606
|
*/
|
|
586
607
|
noAutoplayAudio: "no-autoplay-audio"
|
|
587
608
|
};
|
|
588
609
|
var forms = {
|
|
589
610
|
/**
|
|
590
611
|
* - Ensure the autocomplete attribute is correct and suitable for the form field
|
|
591
|
-
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
612
|
+
* - autocomplete attribute must be used correctly ([url](https://dequeuniversity.com/rules/axe/4.10/autocomplete-valid?application=axeAPI))
|
|
592
613
|
*/
|
|
593
614
|
autocompleteValid: "autocomplete-valid",
|
|
594
615
|
/**
|
|
595
|
-
* -
|
|
596
|
-
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
616
|
+
* - Ensure form field does not have multiple label elements
|
|
617
|
+
* - Form field must not have multiple label elements ([url](https://dequeuniversity.com/rules/axe/4.10/form-field-multiple-labels?application=axeAPI))
|
|
597
618
|
*/
|
|
598
619
|
formFieldMultipleLabels: "form-field-multiple-labels",
|
|
599
620
|
/**
|
|
600
|
-
* -
|
|
601
|
-
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.
|
|
621
|
+
* - Ensure that every form element has a visible label and is not solely labeled using hidden labels, or the title or aria-describedby attributes
|
|
622
|
+
* - Form elements should have a visible label ([url](https://dequeuniversity.com/rules/axe/4.10/label-title-only?application=axeAPI))
|
|
602
623
|
*/
|
|
603
624
|
labelTitleOnly: "label-title-only",
|
|
604
625
|
/**
|
|
605
|
-
* -
|
|
606
|
-
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.
|
|
626
|
+
* - Ensure every form element has a label
|
|
627
|
+
* - Form elements must have labels ([url](https://dequeuniversity.com/rules/axe/4.10/label?application=axeAPI))
|
|
607
628
|
*/
|
|
608
629
|
label: "label",
|
|
609
630
|
/**
|
|
610
|
-
* -
|
|
611
|
-
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
631
|
+
* - Ensure select element has an accessible name
|
|
632
|
+
* - Select element must have an accessible name ([url](https://dequeuniversity.com/rules/axe/4.10/select-name?application=axeAPI))
|
|
612
633
|
*/
|
|
613
634
|
selectName: "select-name"
|
|
614
635
|
};
|
|
615
636
|
var structure = {
|
|
616
637
|
/**
|
|
617
638
|
* - Ensure that text spacing set through style attributes can be adjusted with custom stylesheets
|
|
618
|
-
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.
|
|
639
|
+
* - Inline text spacing must be adjustable with custom stylesheets ([url](https://dequeuniversity.com/rules/axe/4.10/avoid-inline-spacing?application=axeAPI))
|
|
619
640
|
*/
|
|
620
641
|
avoidInlineSpacing: "avoid-inline-spacing",
|
|
621
642
|
/**
|
|
622
|
-
* -
|
|
623
|
-
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.
|
|
643
|
+
* - Ensure content is not locked to any specific display orientation, and the content is operable in all display orientations
|
|
644
|
+
* - CSS Media queries must not lock display orientation ([url](https://dequeuniversity.com/rules/axe/4.10/css-orientation-lock?application=axeAPI))
|
|
624
645
|
*/
|
|
625
646
|
cssOrientationLock: "css-orientation-lock",
|
|
626
647
|
/**
|
|
627
|
-
* -
|
|
628
|
-
* - `<dl>` elements must only directly contain properly-ordered `<dt>` and `<dd>` groups, `<script>`, `<template>` or `<div>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
648
|
+
* - Ensure `<dl>` elements are structured correctly
|
|
649
|
+
* - `<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))
|
|
629
650
|
*/
|
|
630
651
|
definitionList: "definition-list",
|
|
631
652
|
/**
|
|
632
|
-
* -
|
|
633
|
-
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
653
|
+
* - Ensure `<dt>` and `<dd>` elements are contained by a `<dl>`
|
|
654
|
+
* - `<dt>` and `<dd>` elements must be contained by a `<dl>` ([url](https://dequeuniversity.com/rules/axe/4.10/dlitem?application=axeAPI))
|
|
634
655
|
*/
|
|
635
656
|
dlitem: "dlitem",
|
|
636
657
|
/**
|
|
637
|
-
* -
|
|
638
|
-
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.
|
|
658
|
+
* - Ensure `<iframe>` and `<frame>` elements contain the axe-core script
|
|
659
|
+
* - Frames should be tested with axe-core ([url](https://dequeuniversity.com/rules/axe/4.10/frame-tested?application=axeAPI))
|
|
639
660
|
*/
|
|
640
661
|
frameTested: "frame-tested",
|
|
641
662
|
/**
|
|
642
663
|
* - Informs users about hidden content.
|
|
643
|
-
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.
|
|
664
|
+
* - Hidden content on the page should be analyzed ([url](https://dequeuniversity.com/rules/axe/4.10/hidden-content?application=axeAPI))
|
|
644
665
|
*/
|
|
645
666
|
hiddenContent: "hidden-content",
|
|
646
667
|
/**
|
|
647
|
-
* -
|
|
648
|
-
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.
|
|
668
|
+
* - Ensure that lists are structured correctly
|
|
669
|
+
* - `<ul>` and `<ol>` must only directly contain `<li>`, `<script>` or `<template>` elements ([url](https://dequeuniversity.com/rules/axe/4.10/list?application=axeAPI))
|
|
649
670
|
*/
|
|
650
671
|
list: "list",
|
|
651
672
|
/**
|
|
652
|
-
* -
|
|
653
|
-
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.
|
|
673
|
+
* - Ensure `<li>` elements are used semantically
|
|
674
|
+
* - `<li>` elements must be contained in a `<ul>` or `<ol>` ([url](https://dequeuniversity.com/rules/axe/4.10/listitem?application=axeAPI))
|
|
654
675
|
*/
|
|
655
676
|
listitem: "listitem"
|
|
656
677
|
};
|
|
657
678
|
var parsing = {
|
|
658
679
|
/**
|
|
659
|
-
* -
|
|
660
|
-
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
680
|
+
* - Ensure every id attribute value of active elements is unique
|
|
681
|
+
* - IDs of active elements must be unique ([url](https://dequeuniversity.com/rules/axe/4.10/duplicate-id-active?application=axeAPI))
|
|
661
682
|
*/
|
|
662
683
|
duplicateIdActive: "duplicate-id-active",
|
|
663
684
|
/**
|
|
664
|
-
* -
|
|
665
|
-
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
685
|
+
* - Ensure every id attribute value used in ARIA and in labels is unique
|
|
686
|
+
* - IDs used in ARIA and labels must be unique ([url](https://dequeuniversity.com/rules/axe/4.10/duplicate-id-aria?application=axeAPI))
|
|
666
687
|
*/
|
|
667
688
|
duplicateIdAria: "duplicate-id-aria",
|
|
668
689
|
/**
|
|
669
|
-
* -
|
|
670
|
-
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.
|
|
690
|
+
* - Ensure every id attribute value is unique
|
|
691
|
+
* - id attribute value must be unique ([url](https://dequeuniversity.com/rules/axe/4.10/duplicate-id?application=axeAPI))
|
|
671
692
|
*/
|
|
672
693
|
duplicateId: "duplicate-id",
|
|
673
694
|
/**
|
|
674
|
-
* -
|
|
675
|
-
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.
|
|
695
|
+
* - Ensure `<marquee>` elements are not used
|
|
696
|
+
* - `<marquee>` elements are deprecated and must not be used ([url](https://dequeuniversity.com/rules/axe/4.10/marquee?application=axeAPI))
|
|
676
697
|
*/
|
|
677
698
|
marquee: "marquee"
|
|
678
699
|
};
|
|
679
700
|
var semantics = {
|
|
680
701
|
/**
|
|
681
|
-
* -
|
|
682
|
-
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.
|
|
702
|
+
* - Ensure the order of headings is semantically correct
|
|
703
|
+
* - Heading levels should only increase by one ([url](https://dequeuniversity.com/rules/axe/4.10/heading-order?application=axeAPI))
|
|
683
704
|
*/
|
|
684
705
|
headingOrder: "heading-order",
|
|
685
706
|
/**
|
|
686
707
|
* - Ensure that links with the same accessible name serve a similar purpose
|
|
687
|
-
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.
|
|
708
|
+
* - Links with the same name must have a similar purpose ([url](https://dequeuniversity.com/rules/axe/4.10/identical-links-same-purpose?application=axeAPI))
|
|
688
709
|
*/
|
|
689
710
|
identicalLinksSamePurpose: "identical-links-same-purpose",
|
|
690
711
|
/**
|
|
691
|
-
* -
|
|
692
|
-
* - Elements must have their visible text as part of their accessible name ([url](https://dequeuniversity.com/rules/axe/4.
|
|
712
|
+
* - Ensure that elements labelled through their content must have their visible text as part of their accessible name
|
|
713
|
+
* - 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))
|
|
693
714
|
*/
|
|
694
715
|
labelContentNameMismatch: "label-content-name-mismatch",
|
|
695
716
|
/**
|
|
696
|
-
* -
|
|
697
|
-
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
717
|
+
* - Ensure the banner landmark is at top level
|
|
718
|
+
* - Banner landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-banner-is-top-level?application=axeAPI))
|
|
698
719
|
*/
|
|
699
720
|
landmarkBannerIsTopLevel: "landmark-banner-is-top-level",
|
|
700
721
|
/**
|
|
701
|
-
* -
|
|
702
|
-
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
722
|
+
* - Ensure the complementary landmark or aside is at top level
|
|
723
|
+
* - Aside should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-complementary-is-top-level?application=axeAPI))
|
|
703
724
|
*/
|
|
704
725
|
landmarkComplementaryIsTopLevel: "landmark-complementary-is-top-level",
|
|
705
726
|
/**
|
|
706
|
-
* -
|
|
707
|
-
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
727
|
+
* - Ensure the contentinfo landmark is at top level
|
|
728
|
+
* - Contentinfo landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-contentinfo-is-top-level?application=axeAPI))
|
|
708
729
|
*/
|
|
709
730
|
landmarkContentinfoIsTopLevel: "landmark-contentinfo-is-top-level",
|
|
710
731
|
/**
|
|
711
|
-
* -
|
|
712
|
-
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
732
|
+
* - Ensure the main landmark is at top level
|
|
733
|
+
* - Main landmark should not be contained in another landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-main-is-top-level?application=axeAPI))
|
|
713
734
|
*/
|
|
714
735
|
landmarkMainIsTopLevel: "landmark-main-is-top-level",
|
|
715
736
|
/**
|
|
716
|
-
* -
|
|
717
|
-
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
737
|
+
* - Ensure the document has at most one banner landmark
|
|
738
|
+
* - Document should not have more than one banner landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-no-duplicate-banner?application=axeAPI))
|
|
718
739
|
*/
|
|
719
740
|
landmarkNoDuplicateBanner: "landmark-no-duplicate-banner",
|
|
720
741
|
/**
|
|
721
|
-
* -
|
|
722
|
-
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
742
|
+
* - Ensure the document has at most one contentinfo landmark
|
|
743
|
+
* - Document should not have more than one contentinfo landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-no-duplicate-contentinfo?application=axeAPI))
|
|
723
744
|
*/
|
|
724
745
|
landmarkNoDuplicateContentinfo: "landmark-no-duplicate-contentinfo",
|
|
725
746
|
/**
|
|
726
|
-
* -
|
|
727
|
-
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
747
|
+
* - Ensure the document has at most one main landmark
|
|
748
|
+
* - Document should not have more than one main landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-no-duplicate-main?application=axeAPI))
|
|
728
749
|
*/
|
|
729
750
|
landmarkNoDuplicateMain: "landmark-no-duplicate-main",
|
|
730
751
|
/**
|
|
731
|
-
* -
|
|
732
|
-
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.
|
|
752
|
+
* - Ensure the document has a main landmark
|
|
753
|
+
* - Document should have one main landmark ([url](https://dequeuniversity.com/rules/axe/4.10/landmark-one-main?application=axeAPI))
|
|
733
754
|
*/
|
|
734
755
|
landmarkOneMain: "landmark-one-main",
|
|
735
756
|
/**
|
|
736
|
-
* -
|
|
737
|
-
* -
|
|
757
|
+
* - Ensure landmarks are unique
|
|
758
|
+
* - 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))
|
|
738
759
|
*/
|
|
739
760
|
landmarkUnique: "landmark-unique",
|
|
740
761
|
/**
|
|
741
762
|
* - Ensure bold, italic text and font-size is not used to style `<p>` elements as a heading
|
|
742
|
-
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.
|
|
763
|
+
* - Styled `<p>` elements must not be used as headings ([url](https://dequeuniversity.com/rules/axe/4.10/p-as-heading?application=axeAPI))
|
|
743
764
|
*/
|
|
744
765
|
pAsHeading: "p-as-heading",
|
|
745
766
|
/**
|
|
746
767
|
* - Ensure that the page, or at least one of its frames contains a level-one heading
|
|
747
|
-
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.
|
|
768
|
+
* - Page should contain a level-one heading ([url](https://dequeuniversity.com/rules/axe/4.10/page-has-heading-one?application=axeAPI))
|
|
748
769
|
*/
|
|
749
770
|
pageHasHeadingOne: "page-has-heading-one"
|
|
750
771
|
};
|
|
751
772
|
var language = {
|
|
752
773
|
/**
|
|
753
|
-
* -
|
|
754
|
-
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
774
|
+
* - Ensure every HTML document has a lang attribute
|
|
775
|
+
* - `<html>` element must have a lang attribute ([url](https://dequeuniversity.com/rules/axe/4.10/html-has-lang?application=axeAPI))
|
|
755
776
|
*/
|
|
756
777
|
htmlHasLang: "html-has-lang",
|
|
757
778
|
/**
|
|
758
|
-
* -
|
|
759
|
-
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.
|
|
779
|
+
* - Ensure the lang attribute of the `<html>` element has a valid value
|
|
780
|
+
* - `<html>` element must have a valid value for the lang attribute ([url](https://dequeuniversity.com/rules/axe/4.10/html-lang-valid?application=axeAPI))
|
|
760
781
|
*/
|
|
761
782
|
htmlLangValid: "html-lang-valid",
|
|
762
783
|
/**
|
|
763
784
|
* - Ensure that HTML elements with both valid lang and xml:lang attributes agree on the base language of the page
|
|
764
|
-
* - HTML elements with lang and xml:lang must have the same base language ([url](https://dequeuniversity.com/rules/axe/4.
|
|
785
|
+
* - 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))
|
|
765
786
|
*/
|
|
766
787
|
htmlXmlLangMismatch: "html-xml-lang-mismatch",
|
|
767
788
|
/**
|
|
768
|
-
* -
|
|
769
|
-
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.
|
|
789
|
+
* - Ensure lang attributes have valid values
|
|
790
|
+
* - lang attribute must have a valid value ([url](https://dequeuniversity.com/rules/axe/4.10/valid-lang?application=axeAPI))
|
|
770
791
|
*/
|
|
771
792
|
validLang: "valid-lang"
|
|
772
793
|
};
|
|
773
794
|
var sensoryAndVisualCues = {
|
|
774
795
|
/**
|
|
775
|
-
* -
|
|
776
|
-
* - Users should be able to zoom and scale the text up to 500% ([url](https://dequeuniversity.com/rules/axe/4.
|
|
796
|
+
* - Ensure `<meta name="viewport">` can scale a significant amount
|
|
797
|
+
* - 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))
|
|
777
798
|
*/
|
|
778
799
|
metaViewportLarge: "meta-viewport-large",
|
|
779
800
|
/**
|
|
780
|
-
* -
|
|
781
|
-
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.
|
|
801
|
+
* - Ensure `<meta name="viewport">` does not disable text scaling and zooming
|
|
802
|
+
* - Zooming and scaling must not be disabled ([url](https://dequeuniversity.com/rules/axe/4.10/meta-viewport?application=axeAPI))
|
|
782
803
|
*/
|
|
783
804
|
metaViewport: "meta-viewport",
|
|
784
805
|
/**
|
|
785
|
-
* - Ensure touch
|
|
786
|
-
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.
|
|
806
|
+
* - Ensure touch targets have sufficient size and space
|
|
807
|
+
* - All touch targets must be 24px large, or leave sufficient space ([url](https://dequeuniversity.com/rules/axe/4.10/target-size?application=axeAPI))
|
|
787
808
|
*/
|
|
788
809
|
targetSize: "target-size"
|
|
789
810
|
};
|
|
790
811
|
var tables = {
|
|
791
812
|
/**
|
|
792
|
-
* -
|
|
793
|
-
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.
|
|
813
|
+
* - Ensure the scope attribute is used correctly on tables
|
|
814
|
+
* - scope attribute should be used correctly ([url](https://dequeuniversity.com/rules/axe/4.10/scope-attr-valid?application=axeAPI))
|
|
794
815
|
*/
|
|
795
816
|
scopeAttrValid: "scope-attr-valid",
|
|
796
817
|
/**
|
|
797
818
|
* - Ensure the `<caption>` element does not contain the same text as the summary attribute
|
|
798
|
-
* -
|
|
819
|
+
* - Tables should not have the same summary and caption ([url](https://dequeuniversity.com/rules/axe/4.10/table-duplicate-name?application=axeAPI))
|
|
799
820
|
*/
|
|
800
821
|
tableDuplicateName: "table-duplicate-name",
|
|
801
822
|
/**
|
|
802
823
|
* - Ensure that tables with a caption use the `<caption>` element.
|
|
803
|
-
* - Data or header cells must not be used to give caption to a data table. ([url](https://dequeuniversity.com/rules/axe/4.
|
|
824
|
+
* - 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))
|
|
804
825
|
*/
|
|
805
826
|
tableFakeCaption: "table-fake-caption",
|
|
806
827
|
/**
|
|
807
828
|
* - Ensure that each non-empty data cell in a `<table>` larger than 3 by 3 has one or more table headers
|
|
808
|
-
* - Non-empty `<td>` elements in larger `<table>` must have an associated table header ([url](https://dequeuniversity.com/rules/axe/4.
|
|
829
|
+
* - 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))
|
|
809
830
|
*/
|
|
810
831
|
tdHasHeader: "td-has-header",
|
|
811
832
|
/**
|
|
812
833
|
* - Ensure that each cell in a table that uses the headers attribute refers only to other cells in that table
|
|
813
|
-
* - Table cells that use the headers attribute must only refer to cells in the same table ([url](https://dequeuniversity.com/rules/axe/4.
|
|
834
|
+
* - 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))
|
|
814
835
|
*/
|
|
815
836
|
tdHeadersAttr: "td-headers-attr",
|
|
816
837
|
/**
|
|
817
838
|
* - Ensure that `<th>` elements and elements with role=columnheader/rowheader have data cells they describe
|
|
818
|
-
* - Table headers in a data table must refer to data cells ([url](https://dequeuniversity.com/rules/axe/4.
|
|
839
|
+
* - 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))
|
|
819
840
|
*/
|
|
820
841
|
thHasDataCells: "th-has-data-cells"
|
|
821
842
|
};
|
|
@@ -823,12 +844,16 @@ var tables = {
|
|
|
823
844
|
// src/service/html/axe-rules/rule-exceptions.ts
|
|
824
845
|
var ruleExceptions = {
|
|
825
846
|
[aria.ariaAllowedRole]: { dynamicAttrs: ["role"] },
|
|
847
|
+
[aria.ariaBrailleEquivalent]: { attrSpread: true },
|
|
826
848
|
[aria.ariaCommandName]: { unknownBody: true, attrSpread: true },
|
|
849
|
+
[aria.ariaConditionalAttr]: { unknownBody: true, attrSpread: true },
|
|
850
|
+
[aria.ariaDeprecatedRole]: { dynamicAttrs: ["role"] },
|
|
827
851
|
[aria.ariaDialogName]: { unknownBody: true, attrSpread: true },
|
|
828
852
|
[aria.ariaHiddenBody]: {},
|
|
829
853
|
[aria.ariaInputFieldName]: { unknownBody: true, attrSpread: true },
|
|
830
854
|
[aria.ariaMeterName]: { unknownBody: true, attrSpread: true },
|
|
831
855
|
[aria.ariaProgressbarName]: { unknownBody: true, attrSpread: true },
|
|
856
|
+
[aria.ariaProhibitedAttr]: {},
|
|
832
857
|
[aria.ariaRequiredAttr]: { attrSpread: true },
|
|
833
858
|
[aria.ariaRequiredChildren]: { unknownBody: true },
|
|
834
859
|
[aria.ariaRoles]: { dynamicAttrs: ["role"] },
|
|
@@ -840,7 +865,6 @@ var ruleExceptions = {
|
|
|
840
865
|
[forms.autocompleteValid]: {},
|
|
841
866
|
[forms.formFieldMultipleLabels]: {},
|
|
842
867
|
[keyboard.accesskeys]: {},
|
|
843
|
-
[keyboard.focusOrderSemantics]: {},
|
|
844
868
|
[keyboard.frameFocusableContent]: { unknownBody: true },
|
|
845
869
|
[keyboard.skipLink]: { unknownBody: true },
|
|
846
870
|
[keyboard.tabindex]: {},
|
|
@@ -857,9 +881,9 @@ var ruleExceptions = {
|
|
|
857
881
|
attrSpread: true
|
|
858
882
|
},
|
|
859
883
|
[nameRoleValue.linkName]: { unknownBody: true, attrSpread: true },
|
|
884
|
+
[nameRoleValue.summaryName]: { unknownBody: true, attrSpread: true },
|
|
860
885
|
[parsing.marquee]: {},
|
|
861
886
|
[semantics.identicalLinksSamePurpose]: {},
|
|
862
|
-
[semantics.labelContentNameMismatch]: { unknownBody: true },
|
|
863
887
|
[semantics.landmarkNoDuplicateBanner]: {},
|
|
864
888
|
[semantics.landmarkNoDuplicateContentinfo]: {},
|
|
865
889
|
[semantics.landmarkNoDuplicateMain]: {},
|
|
@@ -870,7 +894,6 @@ var ruleExceptions = {
|
|
|
870
894
|
[structure.list]: { unknownBody: true },
|
|
871
895
|
[tables.scopeAttrValid]: {},
|
|
872
896
|
[tables.tableDuplicateName]: { unknownBody: true },
|
|
873
|
-
[tables.tableFakeCaption]: { unknownBody: true },
|
|
874
897
|
[tables.thHasDataCells]: { unknownBody: true },
|
|
875
898
|
[textAlternatives.areaAlt]: { attrSpread: true },
|
|
876
899
|
[textAlternatives.documentTitle]: { unknownBody: true },
|
|
@@ -897,8 +920,7 @@ var HTMLService = {
|
|
|
897
920
|
commands: {
|
|
898
921
|
"$/showHtmlOutput": async (uri) => {
|
|
899
922
|
const doc = get(uri);
|
|
900
|
-
if (!doc)
|
|
901
|
-
return;
|
|
923
|
+
if (!doc) return;
|
|
902
924
|
const { extracted } = extract(doc);
|
|
903
925
|
return {
|
|
904
926
|
language: "html",
|
|
@@ -926,28 +948,24 @@ var HTMLService = {
|
|
|
926
948
|
const violations = await getViolationNodes(Object.keys(ruleExceptions));
|
|
927
949
|
release();
|
|
928
950
|
return violations.flatMap((result) => {
|
|
929
|
-
var _a;
|
|
930
951
|
const { element } = result;
|
|
931
|
-
if (!element)
|
|
932
|
-
return [];
|
|
952
|
+
if (!element) return [];
|
|
933
953
|
const ruleId = result.ruleId;
|
|
934
954
|
if (element.dataset.markoNodeId) {
|
|
935
955
|
const details = nodeDetails[element.dataset.markoNodeId];
|
|
936
|
-
if (ruleExceptions[ruleId].attrSpread && details.hasDynamicAttrs || ruleExceptions[ruleId].unknownBody && details.hasDynamicBody ||
|
|
956
|
+
if (ruleExceptions[ruleId].attrSpread && details.hasDynamicAttrs || ruleExceptions[ruleId].unknownBody && details.hasDynamicBody || ruleExceptions[ruleId].dynamicAttrs?.some(
|
|
937
957
|
(attr) => element.getAttribute(attr) === "dynamic"
|
|
938
|
-
))
|
|
958
|
+
)) {
|
|
939
959
|
return [];
|
|
940
960
|
}
|
|
941
961
|
}
|
|
942
962
|
const generatedLoc = jsdom.nodeLocation(element);
|
|
943
|
-
if (!generatedLoc)
|
|
944
|
-
return [];
|
|
963
|
+
if (!generatedLoc) return [];
|
|
945
964
|
const sourceRange = extracted.sourceLocationAt(
|
|
946
965
|
generatedLoc.startOffset + 1,
|
|
947
966
|
generatedLoc.startOffset + 1 + element.tagName.length
|
|
948
967
|
);
|
|
949
|
-
if (!sourceRange)
|
|
950
|
-
return [];
|
|
968
|
+
if (!sourceRange) return [];
|
|
951
969
|
return [
|
|
952
970
|
{
|
|
953
971
|
range: sourceRange,
|
|
@@ -1111,8 +1129,7 @@ var linkedAttrs = /* @__PURE__ */ new Map([
|
|
|
1111
1129
|
["poster", /* @__PURE__ */ new Set(["video"])]
|
|
1112
1130
|
]);
|
|
1113
1131
|
function isDocumentLinkAttr(code, tag, attr) {
|
|
1114
|
-
|
|
1115
|
-
return tag.nameText && attr.type === import_language_tools4.NodeType.AttrNamed && ((_a = attr.value) == null ? void 0 : _a.type) === import_language_tools4.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;
|
|
1132
|
+
return tag.nameText && attr.type === import_language_tools4.NodeType.AttrNamed && attr.value?.type === import_language_tools4.NodeType.AttrValue && /^['"]$/.test(code[attr.value.value.start]) && linkedAttrs.get(code.slice(attr.name.start, attr.name.end))?.has(tag.nameText) || false;
|
|
1116
1133
|
}
|
|
1117
1134
|
|
|
1118
1135
|
// src/utils/file-system.ts
|
|
@@ -1130,10 +1147,8 @@ async function stat(uri) {
|
|
|
1130
1147
|
let size = -1;
|
|
1131
1148
|
try {
|
|
1132
1149
|
const stat2 = await import_promises.default.stat((0, import_url.fileURLToPath)(uri));
|
|
1133
|
-
if (stat2.isDirectory())
|
|
1134
|
-
|
|
1135
|
-
else if (stat2.isFile())
|
|
1136
|
-
type = import_vscode_css_languageservice.FileType.File;
|
|
1150
|
+
if (stat2.isDirectory()) type = import_vscode_css_languageservice.FileType.Directory;
|
|
1151
|
+
else if (stat2.isFile()) type = import_vscode_css_languageservice.FileType.File;
|
|
1137
1152
|
ctime = stat2.ctimeMs;
|
|
1138
1153
|
mtime = stat2.mtimeMs;
|
|
1139
1154
|
size = stat2.size;
|
|
@@ -1165,8 +1180,7 @@ async function readDirectory(uri) {
|
|
|
1165
1180
|
function resolveUrl(to, base) {
|
|
1166
1181
|
try {
|
|
1167
1182
|
const url = new URL(to, base);
|
|
1168
|
-
if (url.protocol === "file:")
|
|
1169
|
-
return url.toString();
|
|
1183
|
+
if (url.protocol === "file:") return url.toString();
|
|
1170
1184
|
} catch {
|
|
1171
1185
|
return void 0;
|
|
1172
1186
|
}
|
|
@@ -1181,8 +1195,7 @@ async function AttrValue({
|
|
|
1181
1195
|
const attr = node.parent;
|
|
1182
1196
|
if (isDocumentLinkAttr(code, attr.parent, attr)) {
|
|
1183
1197
|
const start = node.value.start + 1;
|
|
1184
|
-
if (code[start] !== ".")
|
|
1185
|
-
return;
|
|
1198
|
+
if (code[start] !== ".") return;
|
|
1186
1199
|
const end = node.value.end - 1;
|
|
1187
1200
|
const relativeOffset = offset - start;
|
|
1188
1201
|
const rawValue = parsed.read({
|
|
@@ -1190,8 +1203,7 @@ async function AttrValue({
|
|
|
1190
1203
|
end
|
|
1191
1204
|
});
|
|
1192
1205
|
const segmentStart = rawValue.lastIndexOf("/", relativeOffset);
|
|
1193
|
-
if (segmentStart === -1)
|
|
1194
|
-
return;
|
|
1206
|
+
if (segmentStart === -1) return;
|
|
1195
1207
|
const req = rawValue.slice(0, segmentStart);
|
|
1196
1208
|
const resolved = resolveUrl(req, uri);
|
|
1197
1209
|
if (resolved) {
|
|
@@ -1239,7 +1251,6 @@ function getTagNameCompletion({
|
|
|
1239
1251
|
showAutoComplete,
|
|
1240
1252
|
importer
|
|
1241
1253
|
}) {
|
|
1242
|
-
var _a;
|
|
1243
1254
|
let label = tag.isNestedTag ? `@${tag.name}` : tag.name;
|
|
1244
1255
|
const fileForTag = tag.template || tag.renderer || tag.filePath;
|
|
1245
1256
|
const fileURIForTag = import_vscode_uri3.URI.file(fileForTag).toString();
|
|
@@ -1259,7 +1270,7 @@ function getTagNameCompletion({
|
|
|
1259
1270
|
|
|
1260
1271
|
${tag.description}`;
|
|
1261
1272
|
}
|
|
1262
|
-
const autocomplete = showAutoComplete ?
|
|
1273
|
+
const autocomplete = showAutoComplete ? tag.autocomplete?.[0] : void 0;
|
|
1263
1274
|
if (autocomplete) {
|
|
1264
1275
|
if (autocomplete.displayText) {
|
|
1265
1276
|
label = autocomplete.displayText;
|
|
@@ -1281,17 +1292,16 @@ ${autocomplete.description}`;
|
|
|
1281
1292
|
tags: tag.deprecated ? deprecated : void 0,
|
|
1282
1293
|
insertTextFormat: autocomplete ? import_vscode_languageserver4.InsertTextFormat.Snippet : void 0,
|
|
1283
1294
|
kind: tag.html ? import_vscode_languageserver4.CompletionItemKind.Property : import_vscode_languageserver4.CompletionItemKind.Class,
|
|
1284
|
-
textEdit: range && import_vscode_languageserver4.TextEdit.replace(range,
|
|
1295
|
+
textEdit: range && import_vscode_languageserver4.TextEdit.replace(range, autocomplete?.snippet || label)
|
|
1285
1296
|
};
|
|
1286
1297
|
}
|
|
1287
1298
|
|
|
1288
1299
|
// src/service/marko/complete/Import.ts
|
|
1289
|
-
var importTagReg = /(['"])<((?:[
|
|
1300
|
+
var importTagReg = /(['"])<((?:[^'"\\>]+|\\.)*)>?\1/;
|
|
1290
1301
|
function Import({
|
|
1291
1302
|
node,
|
|
1292
1303
|
file: { parsed, filename, lookup }
|
|
1293
1304
|
}) {
|
|
1294
|
-
var _a;
|
|
1295
1305
|
const value = parsed.read(node);
|
|
1296
1306
|
const match = importTagReg.exec(value);
|
|
1297
1307
|
if (match) {
|
|
@@ -1303,7 +1313,7 @@ function Import({
|
|
|
1303
1313
|
});
|
|
1304
1314
|
const result = [];
|
|
1305
1315
|
for (const tag of lookup.getTagsSorted()) {
|
|
1306
|
-
if ((tag.template || tag.renderer) && !(tag.html || tag.parser || tag.translator || tag.isNestedTag || tag.name === "*" ||
|
|
1316
|
+
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))) {
|
|
1307
1317
|
const completion = getTagNameCompletion({
|
|
1308
1318
|
tag,
|
|
1309
1319
|
importer: filename
|
|
@@ -1323,15 +1333,13 @@ function OpenTagName({
|
|
|
1323
1333
|
node,
|
|
1324
1334
|
file: { parsed, filename, lookup }
|
|
1325
1335
|
}) {
|
|
1326
|
-
var _a;
|
|
1327
1336
|
const tag = node.parent;
|
|
1328
1337
|
const range = parsed.locationAt(node);
|
|
1329
1338
|
const isAttrTag = tag.type === import_language_tools5.NodeType.AttrTag;
|
|
1330
1339
|
const result = [];
|
|
1331
1340
|
if (isAttrTag) {
|
|
1332
1341
|
let parentTag = tag.owner;
|
|
1333
|
-
while (
|
|
1334
|
-
parentTag = parentTag.owner;
|
|
1342
|
+
while (parentTag?.type === import_language_tools5.NodeType.AttrTag) parentTag = parentTag.owner;
|
|
1335
1343
|
const parentTagDef = parentTag && parentTag.nameText && lookup.getTag(parentTag.nameText);
|
|
1336
1344
|
if (parentTagDef) {
|
|
1337
1345
|
const { nestedTags } = parentTagDef;
|
|
@@ -1352,7 +1360,7 @@ function OpenTagName({
|
|
|
1352
1360
|
} else {
|
|
1353
1361
|
const skipStatements = !(tag.concise && tag.parent.type === import_language_tools5.NodeType.Program);
|
|
1354
1362
|
for (const tag2 of lookup.getTagsSorted()) {
|
|
1355
|
-
if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements &&
|
|
1363
|
+
if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements && tag2.parseOptions?.statement || tag2.name[0] === "_" && /^@?marko[/-]|[\\/]node_modules[\\/]/.test(tag2.filePath))) {
|
|
1356
1364
|
const completion = getTagNameCompletion({
|
|
1357
1365
|
tag: tag2,
|
|
1358
1366
|
range,
|
|
@@ -1377,8 +1385,7 @@ function Tag({
|
|
|
1377
1385
|
file: { parsed, code }
|
|
1378
1386
|
}) {
|
|
1379
1387
|
const isClosed = node.end !== import_language_tools6.UNFINISHED;
|
|
1380
|
-
if (isClosed || node.concise)
|
|
1381
|
-
return;
|
|
1388
|
+
if (isClosed || node.concise) return;
|
|
1382
1389
|
const closingTagStr = `</${node.nameText || ""}>`;
|
|
1383
1390
|
if (offset === node.open.end) {
|
|
1384
1391
|
return [
|
|
@@ -1422,17 +1429,16 @@ var handlers = {
|
|
|
1422
1429
|
Import
|
|
1423
1430
|
};
|
|
1424
1431
|
var doComplete = async (doc, params) => {
|
|
1425
|
-
var _a;
|
|
1426
1432
|
const file = getMarkoFile(doc);
|
|
1427
1433
|
const offset = doc.offsetAt(params.position);
|
|
1428
1434
|
const node = file.parsed.nodeAt(offset);
|
|
1429
1435
|
return {
|
|
1430
|
-
items: await
|
|
1436
|
+
items: await handlers[import_language_tools7.NodeType[node.type]]?.({
|
|
1431
1437
|
file,
|
|
1432
1438
|
params,
|
|
1433
1439
|
offset,
|
|
1434
1440
|
node
|
|
1435
|
-
})
|
|
1441
|
+
}) || [],
|
|
1436
1442
|
isIncomplete: true
|
|
1437
1443
|
};
|
|
1438
1444
|
};
|
|
@@ -1492,7 +1498,7 @@ function AttrName2({
|
|
|
1492
1498
|
if (!attrDef) {
|
|
1493
1499
|
return;
|
|
1494
1500
|
}
|
|
1495
|
-
const attrEntryFile = attrDef.filePath ||
|
|
1501
|
+
const attrEntryFile = attrDef.filePath || tagDef?.filePath;
|
|
1496
1502
|
if (!attrEntryFile) {
|
|
1497
1503
|
return;
|
|
1498
1504
|
}
|
|
@@ -1533,8 +1539,7 @@ function OpenTagName2({
|
|
|
1533
1539
|
let range = START_LOCATION;
|
|
1534
1540
|
if (tag.type === import_language_tools9.NodeType.AttrTag) {
|
|
1535
1541
|
let parentTag = tag.owner;
|
|
1536
|
-
while (
|
|
1537
|
-
parentTag = parentTag.owner;
|
|
1542
|
+
while (parentTag?.type === import_language_tools9.NodeType.AttrTag) parentTag = parentTag.owner;
|
|
1538
1543
|
tagDef = parentTag && parentTag.nameText ? lookup.getTag(parentTag.nameText) : void 0;
|
|
1539
1544
|
} else {
|
|
1540
1545
|
tagDef = tag.nameText ? lookup.getTag(tag.nameText) : void 0;
|
|
@@ -1575,21 +1580,20 @@ var handlers2 = {
|
|
|
1575
1580
|
AttrName: AttrName2
|
|
1576
1581
|
};
|
|
1577
1582
|
var findDefinition = async (doc, params) => {
|
|
1578
|
-
var _a;
|
|
1579
1583
|
const file = getMarkoFile(doc);
|
|
1580
1584
|
const offset = doc.offsetAt(params.position);
|
|
1581
1585
|
const node = file.parsed.nodeAt(offset);
|
|
1582
|
-
return await
|
|
1586
|
+
return await handlers2[import_language_tools10.NodeType[node.type]]?.({
|
|
1583
1587
|
file,
|
|
1584
1588
|
params,
|
|
1585
1589
|
offset,
|
|
1586
1590
|
node
|
|
1587
|
-
})
|
|
1591
|
+
}) || [];
|
|
1588
1592
|
};
|
|
1589
1593
|
|
|
1590
1594
|
// src/service/marko/document-links.ts
|
|
1591
1595
|
var import_language_tools11 = require("@marko/language-tools");
|
|
1592
|
-
var importTagReg2 = /(['"])<((?:[
|
|
1596
|
+
var importTagReg2 = /(['"])<((?:[^'"\\>]+|\\.)*)>?\1/g;
|
|
1593
1597
|
var findDocumentLinks = async (doc) => {
|
|
1594
1598
|
return processDoc(doc, extractDocumentLinks);
|
|
1595
1599
|
};
|
|
@@ -1682,13 +1686,12 @@ function extractDocumentSymbols({
|
|
|
1682
1686
|
const symbols = [];
|
|
1683
1687
|
const { program } = parsed;
|
|
1684
1688
|
const visit = (node) => {
|
|
1685
|
-
var _a, _b;
|
|
1686
1689
|
switch (node.type) {
|
|
1687
1690
|
case import_language_tools12.NodeType.Tag:
|
|
1688
1691
|
case import_language_tools12.NodeType.AttrTag:
|
|
1689
1692
|
symbols.push({
|
|
1690
|
-
name: (node.type === import_language_tools12.NodeType.AttrTag ?
|
|
1691
|
-
kind: node.nameText &&
|
|
1693
|
+
name: (node.type === import_language_tools12.NodeType.AttrTag ? node.nameText?.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
|
|
1694
|
+
kind: node.nameText && lookup.getTag(node.nameText)?.html && import_vscode_languageserver7.SymbolKind.Property || import_vscode_languageserver7.SymbolKind.Class,
|
|
1692
1695
|
location: {
|
|
1693
1696
|
uri,
|
|
1694
1697
|
range: parsed.locationAt(node)
|
|
@@ -1730,8 +1733,7 @@ async function formatDocument(doc, formatOptions, cancel) {
|
|
|
1730
1733
|
}).catch(() => null) : null
|
|
1731
1734
|
};
|
|
1732
1735
|
markoPrettier.setCompiler(import_language_tools13.Project.getCompiler(dir), import_language_tools13.Project.getConfig(dir));
|
|
1733
|
-
if (cancel
|
|
1734
|
-
return;
|
|
1736
|
+
if (cancel?.isCancellationRequested) return;
|
|
1735
1737
|
return [
|
|
1736
1738
|
import_vscode_languageserver8.TextEdit.replace(
|
|
1737
1739
|
{
|
|
@@ -1780,16 +1782,15 @@ var handlers3 = {
|
|
|
1780
1782
|
OpenTagName: OpenTagName3
|
|
1781
1783
|
};
|
|
1782
1784
|
var doHover = async (doc, params) => {
|
|
1783
|
-
var _a;
|
|
1784
1785
|
const file = getMarkoFile(doc);
|
|
1785
1786
|
const offset = doc.offsetAt(params.position);
|
|
1786
1787
|
const node = file.parsed.nodeAt(offset);
|
|
1787
|
-
return await
|
|
1788
|
+
return await handlers3[import_language_tools14.NodeType[node.type]]?.({
|
|
1788
1789
|
file,
|
|
1789
1790
|
params,
|
|
1790
1791
|
offset,
|
|
1791
1792
|
node
|
|
1792
|
-
})
|
|
1793
|
+
});
|
|
1793
1794
|
};
|
|
1794
1795
|
|
|
1795
1796
|
// src/service/marko/validate.ts
|
|
@@ -1885,8 +1886,7 @@ function addDiagnosticsForError(err, diagnostics) {
|
|
|
1885
1886
|
}
|
|
1886
1887
|
} else if (isErrorWithLoc(err)) {
|
|
1887
1888
|
const message = err.label || err.message || err.stack;
|
|
1888
|
-
if (!message)
|
|
1889
|
-
return;
|
|
1889
|
+
if (!message) return;
|
|
1890
1890
|
const { loc } = err;
|
|
1891
1891
|
diagnostics.push({
|
|
1892
1892
|
range: {
|
|
@@ -1928,12 +1928,11 @@ function isError(err) {
|
|
|
1928
1928
|
return err != null && typeof err === "object" && typeof err.message === "string";
|
|
1929
1929
|
}
|
|
1930
1930
|
function isAggregateError(err) {
|
|
1931
|
-
return Array.isArray(err
|
|
1931
|
+
return Array.isArray(err?.errors);
|
|
1932
1932
|
}
|
|
1933
1933
|
function isErrorWithLoc(err) {
|
|
1934
|
-
const loc = err
|
|
1935
|
-
if (typeof loc !== "object")
|
|
1936
|
-
return false;
|
|
1934
|
+
const loc = err?.loc;
|
|
1935
|
+
if (typeof loc !== "object") return false;
|
|
1937
1936
|
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";
|
|
1938
1937
|
}
|
|
1939
1938
|
|
|
@@ -1973,16 +1972,12 @@ var import_language_tools16 = require("@marko/language-tools");
|
|
|
1973
1972
|
var fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
|
|
1974
1973
|
var modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
|
|
1975
1974
|
function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
1976
|
-
var _a, _b, _c;
|
|
1977
1975
|
const processors = import_language_tools16.Processors.create({
|
|
1978
1976
|
ts: ts2,
|
|
1979
1977
|
host,
|
|
1980
1978
|
configFile
|
|
1981
1979
|
});
|
|
1982
|
-
const rootNames = Object.values(processors).map((processor) =>
|
|
1983
|
-
var _a2;
|
|
1984
|
-
return (_a2 = processor.getRootNames) == null ? void 0 : _a2.call(processor);
|
|
1985
|
-
}).flat().filter(Boolean);
|
|
1980
|
+
const rootNames = Object.values(processors).map((processor) => processor.getRootNames?.()).flat().filter(Boolean);
|
|
1986
1981
|
const trackFile = ps ? (fileName) => {
|
|
1987
1982
|
ps.getOrCreateScriptInfoForNormalizedPath(
|
|
1988
1983
|
fileName,
|
|
@@ -1998,12 +1993,11 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
1998
1993
|
host.getScriptFileNames = () => [
|
|
1999
1994
|
...new Set(rootNames.concat(getScriptFileNames()))
|
|
2000
1995
|
];
|
|
2001
|
-
const getScriptKind =
|
|
1996
|
+
const getScriptKind = host.getScriptKind?.bind(host);
|
|
2002
1997
|
if (getScriptKind) {
|
|
2003
1998
|
host.getScriptKind = (fileName) => {
|
|
2004
1999
|
const processor = getProcessor(fileName);
|
|
2005
|
-
if (processor)
|
|
2006
|
-
return processor.getScriptKind(fileName);
|
|
2000
|
+
if (processor) return processor.getScriptKind(fileName);
|
|
2007
2001
|
return getScriptKind(fileName);
|
|
2008
2002
|
};
|
|
2009
2003
|
}
|
|
@@ -2031,24 +2025,23 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2031
2025
|
const getScriptVersion = host.getScriptVersion.bind(host);
|
|
2032
2026
|
host.getScriptVersion = (fileName) => {
|
|
2033
2027
|
const processor = getProcessor(fileName);
|
|
2034
|
-
if (processor)
|
|
2035
|
-
return host.getProjectVersion();
|
|
2028
|
+
if (processor) return host.getProjectVersion();
|
|
2036
2029
|
return getScriptVersion(fileName);
|
|
2037
2030
|
};
|
|
2038
2031
|
}
|
|
2039
|
-
const readDirectory2 =
|
|
2032
|
+
const readDirectory2 = host.readDirectory?.bind(host);
|
|
2040
2033
|
if (readDirectory2) {
|
|
2041
2034
|
host.readDirectory = (path9, extensions, exclude, include, depth) => {
|
|
2042
2035
|
return readDirectory2(
|
|
2043
2036
|
path9,
|
|
2044
|
-
extensions
|
|
2037
|
+
extensions?.concat(import_language_tools16.Processors.extensions),
|
|
2045
2038
|
exclude,
|
|
2046
2039
|
include,
|
|
2047
2040
|
depth
|
|
2048
2041
|
);
|
|
2049
2042
|
};
|
|
2050
2043
|
}
|
|
2051
|
-
const resolveModuleNameLiterals =
|
|
2044
|
+
const resolveModuleNameLiterals = host.resolveModuleNameLiterals?.bind(host);
|
|
2052
2045
|
if (resolveModuleNameLiterals) {
|
|
2053
2046
|
host.resolveModuleNameLiterals = (moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) => {
|
|
2054
2047
|
let normalModuleLiterals = moduleLiterals;
|
|
@@ -2152,14 +2145,13 @@ var REG_LINE = /\r\n|\n/;
|
|
|
2152
2145
|
var REG_CODE_BLOCK = /^\s*[~`]{3}/m;
|
|
2153
2146
|
var REG_CAPTION = /^<caption>(.*?)<\/caption>\s*(\r\n|\n)/;
|
|
2154
2147
|
function printJSDocTag(tag) {
|
|
2155
|
-
var _a;
|
|
2156
2148
|
switch (tag.name) {
|
|
2157
2149
|
case "augments":
|
|
2158
2150
|
case "extends":
|
|
2159
2151
|
case "param":
|
|
2160
2152
|
case "template": {
|
|
2161
2153
|
const body = getTagBodyParts(tag);
|
|
2162
|
-
if (
|
|
2154
|
+
if (body?.length === 3) {
|
|
2163
2155
|
const [, param, text] = body;
|
|
2164
2156
|
return `${printTagName(tag.name)} \`${param}\`${printTagBody(
|
|
2165
2157
|
replaceLinks(text)
|
|
@@ -2169,8 +2161,7 @@ function printJSDocTag(tag) {
|
|
|
2169
2161
|
}
|
|
2170
2162
|
case "return":
|
|
2171
2163
|
case "returns": {
|
|
2172
|
-
if (!
|
|
2173
|
-
return void 0;
|
|
2164
|
+
if (!tag.text?.length) return void 0;
|
|
2174
2165
|
break;
|
|
2175
2166
|
}
|
|
2176
2167
|
}
|
|
@@ -2188,8 +2179,7 @@ function getTagBodyParts(tag) {
|
|
|
2188
2179
|
return convertLinkTags(tag.text).split(/^(\S+)\s*-?\s*/);
|
|
2189
2180
|
}
|
|
2190
2181
|
function getTagBodyText(tag) {
|
|
2191
|
-
if (!tag.text)
|
|
2192
|
-
return "";
|
|
2182
|
+
if (!tag.text) return "";
|
|
2193
2183
|
const text = convertLinkTags(tag.text);
|
|
2194
2184
|
switch (tag.name) {
|
|
2195
2185
|
case "example": {
|
|
@@ -2217,10 +2207,8 @@ ${ensureCodeblock(
|
|
|
2217
2207
|
return replaceLinks(text);
|
|
2218
2208
|
}
|
|
2219
2209
|
function convertLinkTags(parts) {
|
|
2220
|
-
if (!parts)
|
|
2221
|
-
|
|
2222
|
-
if (typeof parts === "string")
|
|
2223
|
-
return parts;
|
|
2210
|
+
if (!parts) return "";
|
|
2211
|
+
if (typeof parts === "string") return parts;
|
|
2224
2212
|
let result = "";
|
|
2225
2213
|
let currentLink;
|
|
2226
2214
|
for (const part of parts) {
|
|
@@ -2340,11 +2328,9 @@ var ScriptService = {
|
|
|
2340
2328
|
commands: {
|
|
2341
2329
|
"$/showScriptOutput": async (uri) => {
|
|
2342
2330
|
const doc = get(uri);
|
|
2343
|
-
if (
|
|
2344
|
-
return;
|
|
2331
|
+
if (doc?.languageId !== "marko") return;
|
|
2345
2332
|
const filename = getFSPath(doc);
|
|
2346
|
-
if (!filename)
|
|
2347
|
-
return;
|
|
2333
|
+
if (!filename) return;
|
|
2348
2334
|
const tsProject = getTSProject(filename);
|
|
2349
2335
|
const extracted = processScript(doc, tsProject);
|
|
2350
2336
|
const lang = import_language_tools17.Project.getScriptLang(
|
|
@@ -2379,32 +2365,27 @@ var ScriptService = {
|
|
|
2379
2365
|
});
|
|
2380
2366
|
},
|
|
2381
2367
|
async doComplete(doc, params) {
|
|
2382
|
-
var _a;
|
|
2383
2368
|
const fileName = getFSPath(doc);
|
|
2384
|
-
if (!fileName)
|
|
2385
|
-
return;
|
|
2369
|
+
if (!fileName) return;
|
|
2386
2370
|
const project = getTSProject(fileName);
|
|
2387
2371
|
const extracted = processScript(doc, project);
|
|
2388
2372
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2389
2373
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2390
|
-
if (generatedOffset === void 0)
|
|
2391
|
-
return;
|
|
2374
|
+
if (generatedOffset === void 0) return;
|
|
2392
2375
|
const completions = project.service.getCompletionsAtPosition(
|
|
2393
2376
|
fileName,
|
|
2394
2377
|
generatedOffset,
|
|
2395
2378
|
{
|
|
2396
2379
|
...await getPreferences(project.markoScriptLang),
|
|
2397
2380
|
...params.context,
|
|
2398
|
-
triggerCharacter: getTSTriggerChar(
|
|
2381
|
+
triggerCharacter: getTSTriggerChar(params.context?.triggerCharacter)
|
|
2399
2382
|
}
|
|
2400
2383
|
);
|
|
2401
|
-
if (!
|
|
2402
|
-
return;
|
|
2384
|
+
if (!completions?.entries.length) return;
|
|
2403
2385
|
const result = [];
|
|
2404
2386
|
for (const completion of completions.entries) {
|
|
2405
2387
|
let { name: label, insertText, sortText } = completion;
|
|
2406
|
-
if (label.startsWith(localInternalsPrefix))
|
|
2407
|
-
continue;
|
|
2388
|
+
if (label.startsWith(localInternalsPrefix)) continue;
|
|
2408
2389
|
const { replacementSpan } = completion;
|
|
2409
2390
|
let textEdit;
|
|
2410
2391
|
let detail;
|
|
@@ -2478,14 +2459,11 @@ var ScriptService = {
|
|
|
2478
2459
|
},
|
|
2479
2460
|
async doCompletionResolve(item) {
|
|
2480
2461
|
const { data } = item;
|
|
2481
|
-
if (!data)
|
|
2482
|
-
return;
|
|
2462
|
+
if (!data) return;
|
|
2483
2463
|
const { fileName } = data;
|
|
2484
|
-
if (!fileName)
|
|
2485
|
-
return;
|
|
2464
|
+
if (!fileName) return;
|
|
2486
2465
|
const doc = get(filenameToURI(fileName));
|
|
2487
|
-
if (!doc)
|
|
2488
|
-
return;
|
|
2466
|
+
if (!doc) return;
|
|
2489
2467
|
const project = getTSProject(fileName);
|
|
2490
2468
|
const detail = project.service.getCompletionEntryDetails(
|
|
2491
2469
|
fileName,
|
|
@@ -2496,14 +2474,12 @@ var ScriptService = {
|
|
|
2496
2474
|
await getPreferences(project.markoScriptLang),
|
|
2497
2475
|
data.originalData
|
|
2498
2476
|
);
|
|
2499
|
-
if (!
|
|
2500
|
-
return;
|
|
2477
|
+
if (!detail?.codeActions) return;
|
|
2501
2478
|
const extracted = processScript(doc, project);
|
|
2502
2479
|
const textEdits = item.additionalTextEdits = item.additionalTextEdits || [];
|
|
2503
2480
|
for (const action of detail.codeActions) {
|
|
2504
2481
|
for (const change of action.changes) {
|
|
2505
|
-
if (change.fileName !== fileName)
|
|
2506
|
-
continue;
|
|
2482
|
+
if (change.fileName !== fileName) continue;
|
|
2507
2483
|
for (const { span, newText: rawText } of change.textChanges) {
|
|
2508
2484
|
let range;
|
|
2509
2485
|
let newText = rawText;
|
|
@@ -2535,20 +2511,17 @@ var ScriptService = {
|
|
|
2535
2511
|
},
|
|
2536
2512
|
findDefinition(doc, params) {
|
|
2537
2513
|
const fileName = getFSPath(doc);
|
|
2538
|
-
if (!fileName)
|
|
2539
|
-
return;
|
|
2514
|
+
if (!fileName) return;
|
|
2540
2515
|
const project = getTSProject(fileName);
|
|
2541
2516
|
const extracted = processScript(doc, project);
|
|
2542
2517
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2543
2518
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2544
|
-
if (generatedOffset === void 0)
|
|
2545
|
-
return;
|
|
2519
|
+
if (generatedOffset === void 0) return;
|
|
2546
2520
|
const boundary = project.service.getDefinitionAndBoundSpan(
|
|
2547
2521
|
fileName,
|
|
2548
2522
|
generatedOffset
|
|
2549
2523
|
);
|
|
2550
|
-
if (!
|
|
2551
|
-
return;
|
|
2524
|
+
if (!boundary?.definitions) return;
|
|
2552
2525
|
const originSelectionRange = sourceLocationAtTextSpan(
|
|
2553
2526
|
extracted,
|
|
2554
2527
|
boundary.textSpan
|
|
@@ -2557,8 +2530,7 @@ var ScriptService = {
|
|
|
2557
2530
|
for (const def of boundary.definitions) {
|
|
2558
2531
|
const targetUri = filenameToURI(def.fileName);
|
|
2559
2532
|
const defDoc = get(targetUri);
|
|
2560
|
-
if (!defDoc)
|
|
2561
|
-
continue;
|
|
2533
|
+
if (!defDoc) continue;
|
|
2562
2534
|
let link;
|
|
2563
2535
|
if (markoFileReg.test(targetUri)) {
|
|
2564
2536
|
const extracted2 = processScript(defDoc, project);
|
|
@@ -2594,23 +2566,19 @@ var ScriptService = {
|
|
|
2594
2566
|
},
|
|
2595
2567
|
doHover(doc, params) {
|
|
2596
2568
|
const fileName = getFSPath(doc);
|
|
2597
|
-
if (!fileName)
|
|
2598
|
-
return;
|
|
2569
|
+
if (!fileName) return;
|
|
2599
2570
|
const project = getTSProject(fileName);
|
|
2600
2571
|
const extracted = processScript(doc, project);
|
|
2601
2572
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2602
2573
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2603
|
-
if (generatedOffset === void 0)
|
|
2604
|
-
return;
|
|
2574
|
+
if (generatedOffset === void 0) return;
|
|
2605
2575
|
const quickInfo = project.service.getQuickInfoAtPosition(
|
|
2606
2576
|
fileName,
|
|
2607
2577
|
generatedOffset
|
|
2608
2578
|
);
|
|
2609
|
-
if (!quickInfo)
|
|
2610
|
-
return;
|
|
2579
|
+
if (!quickInfo) return;
|
|
2611
2580
|
const sourceRange = sourceLocationAtTextSpan(extracted, quickInfo.textSpan);
|
|
2612
|
-
if (!sourceRange)
|
|
2613
|
-
return;
|
|
2581
|
+
if (!sourceRange) return;
|
|
2614
2582
|
let contents = "";
|
|
2615
2583
|
const displayParts = import_tsserverlibrary.default.displayPartsToString(quickInfo.displayParts);
|
|
2616
2584
|
if (displayParts) {
|
|
@@ -2634,14 +2602,12 @@ ${documentation}`;
|
|
|
2634
2602
|
},
|
|
2635
2603
|
doRename(doc, params) {
|
|
2636
2604
|
const fileName = getFSPath(doc);
|
|
2637
|
-
if (!fileName)
|
|
2638
|
-
return;
|
|
2605
|
+
if (!fileName) return;
|
|
2639
2606
|
const project = getTSProject(fileName);
|
|
2640
2607
|
const extracted = processScript(doc, project);
|
|
2641
2608
|
const sourceOffset = doc.offsetAt(params.position);
|
|
2642
2609
|
const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
|
|
2643
|
-
if (generatedOffset === void 0)
|
|
2644
|
-
return;
|
|
2610
|
+
if (generatedOffset === void 0) return;
|
|
2645
2611
|
const renameLocations = project.service.findRenameLocations(
|
|
2646
2612
|
fileName,
|
|
2647
2613
|
generatedOffset,
|
|
@@ -2649,15 +2615,13 @@ ${documentation}`;
|
|
|
2649
2615
|
false,
|
|
2650
2616
|
false
|
|
2651
2617
|
);
|
|
2652
|
-
if (!renameLocations)
|
|
2653
|
-
return;
|
|
2618
|
+
if (!renameLocations) return;
|
|
2654
2619
|
const changes = {};
|
|
2655
2620
|
for (const rename of renameLocations) {
|
|
2656
2621
|
const renameURI = filenameToURI(rename.fileName);
|
|
2657
2622
|
const renameDoc = get(renameURI);
|
|
2658
2623
|
let edit;
|
|
2659
|
-
if (!renameDoc)
|
|
2660
|
-
continue;
|
|
2624
|
+
if (!renameDoc) continue;
|
|
2661
2625
|
if (markoFileReg.test(renameURI)) {
|
|
2662
2626
|
const extracted2 = processScript(renameDoc, project);
|
|
2663
2627
|
const sourceRange = sourceLocationAtTextSpan(
|
|
@@ -2690,8 +2654,7 @@ ${documentation}`;
|
|
|
2690
2654
|
},
|
|
2691
2655
|
doValidate(doc) {
|
|
2692
2656
|
const fileName = getFSPath(doc);
|
|
2693
|
-
if (!fileName)
|
|
2694
|
-
return;
|
|
2657
|
+
if (!fileName) return;
|
|
2695
2658
|
const project = getTSProject(fileName);
|
|
2696
2659
|
const extracted = processScript(doc, project);
|
|
2697
2660
|
let results;
|
|
@@ -2719,14 +2682,13 @@ ${documentation}`;
|
|
|
2719
2682
|
};
|
|
2720
2683
|
function processScript(doc, tsProject) {
|
|
2721
2684
|
return processDoc(doc, ({ filename, parsed, lookup }) => {
|
|
2722
|
-
var _a;
|
|
2723
2685
|
const { host, markoScriptLang } = tsProject;
|
|
2724
2686
|
return (0, import_language_tools17.extractScript)({
|
|
2725
2687
|
ts: import_tsserverlibrary.default,
|
|
2726
2688
|
parsed,
|
|
2727
2689
|
lookup,
|
|
2728
2690
|
scriptLang: filename ? import_language_tools17.Project.getScriptLang(filename, markoScriptLang, import_tsserverlibrary.default, host) : markoScriptLang,
|
|
2729
|
-
runtimeTypesCode:
|
|
2691
|
+
runtimeTypesCode: import_language_tools17.Project.getTypeLibs(tsProject.rootDir, import_tsserverlibrary.default, host)?.markoTypesCode
|
|
2730
2692
|
});
|
|
2731
2693
|
});
|
|
2732
2694
|
}
|
|
@@ -2767,8 +2729,7 @@ function getOffsetAfterComments(node) {
|
|
|
2767
2729
|
return Math.max(0, node.start - 1);
|
|
2768
2730
|
}
|
|
2769
2731
|
function sourceLocationAtTextSpan(extracted, { start, length }) {
|
|
2770
|
-
if (start === 0 && length === 0)
|
|
2771
|
-
return START_LOCATION;
|
|
2732
|
+
if (start === 0 && length === 0) return START_LOCATION;
|
|
2772
2733
|
return extracted.sourceLocationAt(start, start + length);
|
|
2773
2734
|
}
|
|
2774
2735
|
function docLocationAtTextSpan(doc, { start, length }) {
|
|
@@ -2795,12 +2756,11 @@ function getTSConfigFile(fileName) {
|
|
|
2795
2756
|
return configFile;
|
|
2796
2757
|
}
|
|
2797
2758
|
function getTSProject(docFsPath) {
|
|
2798
|
-
var _a;
|
|
2799
2759
|
let configFile;
|
|
2800
2760
|
let markoScriptLang = import_language_tools17.ScriptLang.js;
|
|
2801
2761
|
if (docFsPath) {
|
|
2802
2762
|
configFile = getTSConfigFile(docFsPath);
|
|
2803
|
-
if (configFile
|
|
2763
|
+
if (configFile?.endsWith("tsconfig.json")) {
|
|
2804
2764
|
markoScriptLang = import_language_tools17.ScriptLang.ts;
|
|
2805
2765
|
}
|
|
2806
2766
|
}
|
|
@@ -2810,8 +2770,7 @@ function getTSProject(docFsPath) {
|
|
|
2810
2770
|
let cached;
|
|
2811
2771
|
if (projectCache) {
|
|
2812
2772
|
cached = projectCache.get(basePath);
|
|
2813
|
-
if (cached)
|
|
2814
|
-
return cached;
|
|
2773
|
+
if (cached) return cached;
|
|
2815
2774
|
} else {
|
|
2816
2775
|
projectCache = /* @__PURE__ */ new Map();
|
|
2817
2776
|
cache.set(getTSProject, projectCache);
|
|
@@ -2829,7 +2788,7 @@ function getTSProject(docFsPath) {
|
|
|
2829
2788
|
const potentialGlobalFiles = new Set(
|
|
2830
2789
|
fileNames.filter((file) => /\.[cm]?ts$/.test(file))
|
|
2831
2790
|
);
|
|
2832
|
-
const tsPkgFile = configFile &&
|
|
2791
|
+
const tsPkgFile = configFile && import_tsserverlibrary.default.resolveModuleName("typescript/package.json", configFile, options, import_tsserverlibrary.default.sys).resolvedModule?.resolvedFileName;
|
|
2833
2792
|
const defaultLibFile = import_path8.default.join(
|
|
2834
2793
|
tsPkgFile ? import_path8.default.join(tsPkgFile, "../lib") : __dirname,
|
|
2835
2794
|
import_tsserverlibrary.default.getDefaultLibFileName(options)
|
|
@@ -2879,10 +2838,7 @@ function getTSProject(docFsPath) {
|
|
|
2879
2838
|
});
|
|
2880
2839
|
},
|
|
2881
2840
|
readDirectory: import_tsserverlibrary.default.sys.readDirectory,
|
|
2882
|
-
readFile: (filename) =>
|
|
2883
|
-
var _a2;
|
|
2884
|
-
return (_a2 = get(filenameToURI(filename))) == null ? void 0 : _a2.getText();
|
|
2885
|
-
},
|
|
2841
|
+
readFile: (filename) => get(filenameToURI(filename))?.getText(),
|
|
2886
2842
|
fileExists: (filename) => exists(filenameToURI(filename)),
|
|
2887
2843
|
getScriptFileNames() {
|
|
2888
2844
|
const result = new Set(potentialGlobalFiles);
|
|
@@ -2898,8 +2854,7 @@ function getTSProject(docFsPath) {
|
|
|
2898
2854
|
return [...result];
|
|
2899
2855
|
},
|
|
2900
2856
|
getScriptVersion(filename) {
|
|
2901
|
-
|
|
2902
|
-
return `${((_a2 = get(filenameToURI(filename))) == null ? void 0 : _a2.version) ?? -1}`;
|
|
2857
|
+
return `${get(filenameToURI(filename))?.version ?? -1}`;
|
|
2903
2858
|
},
|
|
2904
2859
|
getScriptKind(filename) {
|
|
2905
2860
|
switch (import_path8.default.extname(filename)) {
|
|
@@ -2925,8 +2880,7 @@ function getTSProject(docFsPath) {
|
|
|
2925
2880
|
let snapshot = snapshotCache.get(filename);
|
|
2926
2881
|
if (!snapshot) {
|
|
2927
2882
|
const doc = get(filenameToURI(filename));
|
|
2928
|
-
if (!doc)
|
|
2929
|
-
return;
|
|
2883
|
+
if (!doc) return;
|
|
2930
2884
|
snapshot = import_tsserverlibrary.default.ScriptSnapshot.fromString(doc.getText());
|
|
2931
2885
|
snapshotCache.set(filename, snapshot);
|
|
2932
2886
|
}
|
|
@@ -2947,7 +2901,6 @@ function filenameToURI(filename) {
|
|
|
2947
2901
|
return import_vscode_uri6.URI.file(filename).toString();
|
|
2948
2902
|
}
|
|
2949
2903
|
async function getPreferences(scriptLang) {
|
|
2950
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2951
2904
|
const configName = scriptLang === import_language_tools17.ScriptLang.js ? "javascript" : "typescript";
|
|
2952
2905
|
const [preferencesConfig, suggestConfig, inlayHintsConfig] = await Promise.all([
|
|
2953
2906
|
getConfig(`${configName}.preferences`),
|
|
@@ -2962,8 +2915,8 @@ async function getPreferences(scriptLang) {
|
|
|
2962
2915
|
includeCompletionsWithSnippetText: suggestConfig.includeCompletionsWithSnippetText ?? true,
|
|
2963
2916
|
includeAutomaticOptionalChainCompletions: suggestConfig.includeAutomaticOptionalChainCompletions ?? true,
|
|
2964
2917
|
includeCompletionsWithInsertText: true,
|
|
2965
|
-
includeCompletionsWithClassMemberSnippets:
|
|
2966
|
-
includeCompletionsWithObjectLiteralMethodSnippets:
|
|
2918
|
+
includeCompletionsWithClassMemberSnippets: suggestConfig.classMemberSnippets?.enabled ?? true,
|
|
2919
|
+
includeCompletionsWithObjectLiteralMethodSnippets: suggestConfig.objectLiteralMethodSnippets?.enabled ?? true,
|
|
2967
2920
|
useLabelDetailsInCompletionEntries: true,
|
|
2968
2921
|
allowIncompleteCompletions: true,
|
|
2969
2922
|
importModuleSpecifierPreference: preferencesConfig.importModuleSpecifierPreference,
|
|
@@ -2973,13 +2926,13 @@ async function getPreferences(scriptLang) {
|
|
|
2973
2926
|
includePackageJsonAutoImports: preferencesConfig.includePackageJsonAutoImports ?? true,
|
|
2974
2927
|
provideRefactorNotApplicableReason: true,
|
|
2975
2928
|
jsxAttributeCompletionStyle: preferencesConfig.jsxAttributeCompletionStyle ?? "auto",
|
|
2976
|
-
includeInlayParameterNameHints:
|
|
2977
|
-
includeInlayParameterNameHintsWhenArgumentMatchesName: !
|
|
2978
|
-
includeInlayFunctionParameterTypeHints:
|
|
2979
|
-
includeInlayVariableTypeHints:
|
|
2980
|
-
includeInlayPropertyDeclarationTypeHints:
|
|
2981
|
-
includeInlayFunctionLikeReturnTypeHints:
|
|
2982
|
-
includeInlayEnumMemberValueHints:
|
|
2929
|
+
includeInlayParameterNameHints: inlayHintsConfig.parameterNames?.enabled ?? "none",
|
|
2930
|
+
includeInlayParameterNameHintsWhenArgumentMatchesName: !inlayHintsConfig.parameterNames?.suppressWhenArgumentMatchesName,
|
|
2931
|
+
includeInlayFunctionParameterTypeHints: inlayHintsConfig.parameterTypes?.enabled ?? true,
|
|
2932
|
+
includeInlayVariableTypeHints: inlayHintsConfig.variableTypes?.enabled ?? true,
|
|
2933
|
+
includeInlayPropertyDeclarationTypeHints: inlayHintsConfig.propertyDeclarationTypes?.enabled ?? true,
|
|
2934
|
+
includeInlayFunctionLikeReturnTypeHints: inlayHintsConfig.functionLikeReturnTypes?.enabled ?? true,
|
|
2935
|
+
includeInlayEnumMemberValueHints: inlayHintsConfig.enumMemberValues?.enabled ?? true
|
|
2983
2936
|
};
|
|
2984
2937
|
}
|
|
2985
2938
|
function printDocumentation(docs2, tags) {
|
|
@@ -3028,10 +2981,8 @@ function convertDiagTags(tsDiag) {
|
|
|
3028
2981
|
tags = [import_vscode_languageserver10.DiagnosticTag.Deprecated];
|
|
3029
2982
|
}
|
|
3030
2983
|
if (tsDiag.reportsUnnecessary) {
|
|
3031
|
-
if (tags)
|
|
3032
|
-
|
|
3033
|
-
else
|
|
3034
|
-
tags = [import_vscode_languageserver10.DiagnosticTag.Unnecessary];
|
|
2984
|
+
if (tags) tags.push(import_vscode_languageserver10.DiagnosticTag.Unnecessary);
|
|
2985
|
+
else tags = [import_vscode_languageserver10.DiagnosticTag.Unnecessary];
|
|
3035
2986
|
}
|
|
3036
2987
|
return tags;
|
|
3037
2988
|
}
|
|
@@ -3120,8 +3071,7 @@ var StyleSheetService = {
|
|
|
3120
3071
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3121
3072
|
for (const style of processStyle(doc)) {
|
|
3122
3073
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3123
|
-
if (generatedPos === void 0)
|
|
3124
|
-
continue;
|
|
3074
|
+
if (generatedPos === void 0) continue;
|
|
3125
3075
|
const result = await style.service.doComplete2(
|
|
3126
3076
|
style.virtualDoc,
|
|
3127
3077
|
generatedPos,
|
|
@@ -3157,8 +3107,7 @@ var StyleSheetService = {
|
|
|
3157
3107
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3158
3108
|
for (const style of processStyle(doc)) {
|
|
3159
3109
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3160
|
-
if (generatedPos === void 0)
|
|
3161
|
-
continue;
|
|
3110
|
+
if (generatedPos === void 0) continue;
|
|
3162
3111
|
const result = style.service.findDefinition(
|
|
3163
3112
|
style.virtualDoc,
|
|
3164
3113
|
generatedPos,
|
|
@@ -3180,8 +3129,7 @@ var StyleSheetService = {
|
|
|
3180
3129
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3181
3130
|
for (const style of processStyle(doc)) {
|
|
3182
3131
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3183
|
-
if (generatedPos === void 0)
|
|
3184
|
-
continue;
|
|
3132
|
+
if (generatedPos === void 0) continue;
|
|
3185
3133
|
const result = [];
|
|
3186
3134
|
for (const location of style.service.findReferences(
|
|
3187
3135
|
style.virtualDoc,
|
|
@@ -3250,8 +3198,7 @@ var StyleSheetService = {
|
|
|
3250
3198
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3251
3199
|
for (const style of processStyle(doc)) {
|
|
3252
3200
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3253
|
-
if (generatedPos === void 0)
|
|
3254
|
-
continue;
|
|
3201
|
+
if (generatedPos === void 0) continue;
|
|
3255
3202
|
const result = [];
|
|
3256
3203
|
for (const highlight of style.service.findDocumentHighlights(
|
|
3257
3204
|
style.virtualDoc,
|
|
@@ -3290,8 +3237,7 @@ var StyleSheetService = {
|
|
|
3290
3237
|
getColorPresentations(doc, params) {
|
|
3291
3238
|
for (const extracted of processStyle(doc)) {
|
|
3292
3239
|
const generatedRange = getGeneratedRange(doc, extracted, params.range);
|
|
3293
|
-
if (generatedRange === void 0)
|
|
3294
|
-
continue;
|
|
3240
|
+
if (generatedRange === void 0) continue;
|
|
3295
3241
|
const result = [];
|
|
3296
3242
|
for (const colorPresentation of extracted.service.getColorPresentations(
|
|
3297
3243
|
extracted.virtualDoc,
|
|
@@ -3316,8 +3262,7 @@ var StyleSheetService = {
|
|
|
3316
3262
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3317
3263
|
for (const style of processStyle(doc)) {
|
|
3318
3264
|
const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
|
|
3319
|
-
if (generatedPos === void 0)
|
|
3320
|
-
continue;
|
|
3265
|
+
if (generatedPos === void 0) continue;
|
|
3321
3266
|
const result = style.service.doHover(
|
|
3322
3267
|
style.virtualDoc,
|
|
3323
3268
|
generatedPos,
|
|
@@ -3342,8 +3287,7 @@ var StyleSheetService = {
|
|
|
3342
3287
|
const sourceOffset = doc.offsetAt(params.position);
|
|
3343
3288
|
for (const style of processStyle(doc)) {
|
|
3344
3289
|
const generatedOffset = style.extracted.generatedOffsetAt(sourceOffset);
|
|
3345
|
-
if (generatedOffset === void 0)
|
|
3346
|
-
continue;
|
|
3290
|
+
if (generatedOffset === void 0) continue;
|
|
3347
3291
|
const result = style.service.doRename(
|
|
3348
3292
|
style.virtualDoc,
|
|
3349
3293
|
style.virtualDoc.positionAt(generatedOffset),
|
|
@@ -3370,11 +3314,9 @@ var StyleSheetService = {
|
|
|
3370
3314
|
}
|
|
3371
3315
|
},
|
|
3372
3316
|
doCodeActions(doc, params) {
|
|
3373
|
-
var _a;
|
|
3374
3317
|
for (const extracted of processStyle(doc)) {
|
|
3375
3318
|
const generatedRange = getGeneratedRange(doc, extracted, params.range);
|
|
3376
|
-
if (generatedRange === void 0)
|
|
3377
|
-
continue;
|
|
3319
|
+
if (generatedRange === void 0) continue;
|
|
3378
3320
|
const result = extracted.service.doCodeActions(
|
|
3379
3321
|
extracted.virtualDoc,
|
|
3380
3322
|
generatedRange,
|
|
@@ -3382,7 +3324,7 @@ var StyleSheetService = {
|
|
|
3382
3324
|
extracted.parsed
|
|
3383
3325
|
);
|
|
3384
3326
|
for (const command of result) {
|
|
3385
|
-
const edits =
|
|
3327
|
+
const edits = command.arguments?.[2];
|
|
3386
3328
|
if (edits && Array.isArray(edits) && isTextEdit(edits[0])) {
|
|
3387
3329
|
command.arguments[2] = getSourceEdits(extracted, edits);
|
|
3388
3330
|
}
|
|
@@ -3410,13 +3352,12 @@ var StyleSheetService = {
|
|
|
3410
3352
|
};
|
|
3411
3353
|
function processStyle(doc) {
|
|
3412
3354
|
return processDoc(doc, ({ uri, version, parsed, lookup }) => {
|
|
3413
|
-
var _a;
|
|
3414
3355
|
const result = [];
|
|
3415
3356
|
for (const [ext, extracted] of (0, import_language_tools18.extractStyle)({
|
|
3416
3357
|
parsed,
|
|
3417
3358
|
lookup
|
|
3418
3359
|
})) {
|
|
3419
|
-
const service2 =
|
|
3360
|
+
const service2 = services[ext]?.({
|
|
3420
3361
|
fileSystemProvider: file_system_default,
|
|
3421
3362
|
clientCapabilities
|
|
3422
3363
|
});
|
|
@@ -3501,25 +3442,17 @@ var service = {
|
|
|
3501
3442
|
commands: Object.assign({}, ...plugins.map(({ commands }) => commands)),
|
|
3502
3443
|
async initialize(params) {
|
|
3503
3444
|
await Promise.allSettled(
|
|
3504
|
-
plugins.map((plugin) =>
|
|
3505
|
-
var _a;
|
|
3506
|
-
return (_a = plugin.initialize) == null ? void 0 : _a.call(plugin, params);
|
|
3507
|
-
})
|
|
3445
|
+
plugins.map((plugin) => plugin.initialize?.(params))
|
|
3508
3446
|
);
|
|
3509
3447
|
},
|
|
3510
3448
|
async doComplete(doc, params, cancel) {
|
|
3511
3449
|
const results = await Promise.allSettled(
|
|
3512
|
-
plugins.map((plugin) =>
|
|
3513
|
-
var _a;
|
|
3514
|
-
return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3515
|
-
})
|
|
3450
|
+
plugins.map((plugin) => plugin.doComplete?.(doc, params, cancel))
|
|
3516
3451
|
);
|
|
3517
|
-
if (cancel.isCancellationRequested)
|
|
3518
|
-
return;
|
|
3452
|
+
if (cancel.isCancellationRequested) return;
|
|
3519
3453
|
const itemsByLabel = /* @__PURE__ */ new Map();
|
|
3520
3454
|
for (const result of results) {
|
|
3521
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3522
|
-
continue;
|
|
3455
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3523
3456
|
for (const item of Array.isArray(result.value) ? result.value : result.value.items) {
|
|
3524
3457
|
const { label } = item;
|
|
3525
3458
|
const existingItem = itemsByLabel.get(label);
|
|
@@ -3535,48 +3468,35 @@ var service = {
|
|
|
3535
3468
|
return { items: [...itemsByLabel.values()], isIncomplete: true };
|
|
3536
3469
|
},
|
|
3537
3470
|
async doCompletionResolve(item, cancel) {
|
|
3538
|
-
var _a;
|
|
3539
3471
|
for (const plugin of plugins) {
|
|
3540
3472
|
try {
|
|
3541
|
-
const result = await
|
|
3542
|
-
if (cancel.isCancellationRequested)
|
|
3543
|
-
|
|
3544
|
-
if (result)
|
|
3545
|
-
return result;
|
|
3473
|
+
const result = await plugin.doCompletionResolve?.(item, cancel);
|
|
3474
|
+
if (cancel.isCancellationRequested) return;
|
|
3475
|
+
if (result) return result;
|
|
3546
3476
|
} catch {
|
|
3547
3477
|
}
|
|
3548
3478
|
}
|
|
3549
3479
|
},
|
|
3550
3480
|
async findDefinition(doc, params, cancel) {
|
|
3551
3481
|
const results = await Promise.allSettled(
|
|
3552
|
-
plugins.map((plugin) =>
|
|
3553
|
-
var _a;
|
|
3554
|
-
return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3555
|
-
})
|
|
3482
|
+
plugins.map((plugin) => plugin.findDefinition?.(doc, params, cancel))
|
|
3556
3483
|
);
|
|
3557
|
-
if (cancel.isCancellationRequested)
|
|
3558
|
-
return;
|
|
3484
|
+
if (cancel.isCancellationRequested) return;
|
|
3559
3485
|
let links;
|
|
3560
3486
|
for (const result of results) {
|
|
3561
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3562
|
-
continue;
|
|
3487
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3563
3488
|
links = (links || []).concat(result.value);
|
|
3564
3489
|
}
|
|
3565
3490
|
return links;
|
|
3566
3491
|
},
|
|
3567
3492
|
async findReferences(doc, params, cancel) {
|
|
3568
3493
|
const results = await Promise.allSettled(
|
|
3569
|
-
plugins.map((plugin) =>
|
|
3570
|
-
var _a;
|
|
3571
|
-
return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3572
|
-
})
|
|
3494
|
+
plugins.map((plugin) => plugin.findReferences?.(doc, params, cancel))
|
|
3573
3495
|
);
|
|
3574
|
-
if (cancel.isCancellationRequested)
|
|
3575
|
-
return;
|
|
3496
|
+
if (cancel.isCancellationRequested) return;
|
|
3576
3497
|
let references;
|
|
3577
3498
|
for (const result of results) {
|
|
3578
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3579
|
-
continue;
|
|
3499
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3580
3500
|
references = (references || []).concat(result.value);
|
|
3581
3501
|
}
|
|
3582
3502
|
return references;
|
|
@@ -3584,35 +3504,25 @@ var service = {
|
|
|
3584
3504
|
async findDocumentSymbols(doc, params, cancel) {
|
|
3585
3505
|
const results = await Promise.allSettled(
|
|
3586
3506
|
plugins.map(
|
|
3587
|
-
(plugin) =>
|
|
3588
|
-
var _a;
|
|
3589
|
-
return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3590
|
-
}
|
|
3507
|
+
(plugin) => plugin.findDocumentSymbols?.(doc, params, cancel)
|
|
3591
3508
|
)
|
|
3592
3509
|
);
|
|
3593
|
-
if (cancel.isCancellationRequested)
|
|
3594
|
-
return;
|
|
3510
|
+
if (cancel.isCancellationRequested) return;
|
|
3595
3511
|
let symbols;
|
|
3596
3512
|
for (const result of results) {
|
|
3597
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3598
|
-
continue;
|
|
3513
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3599
3514
|
symbols = (symbols || []).concat(result.value);
|
|
3600
3515
|
}
|
|
3601
3516
|
return symbols;
|
|
3602
3517
|
},
|
|
3603
3518
|
async findDocumentLinks(doc, params, cancel) {
|
|
3604
3519
|
const results = await Promise.allSettled(
|
|
3605
|
-
plugins.map((plugin) =>
|
|
3606
|
-
var _a;
|
|
3607
|
-
return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3608
|
-
})
|
|
3520
|
+
plugins.map((plugin) => plugin.findDocumentLinks?.(doc, params, cancel))
|
|
3609
3521
|
);
|
|
3610
|
-
if (cancel.isCancellationRequested)
|
|
3611
|
-
return;
|
|
3522
|
+
if (cancel.isCancellationRequested) return;
|
|
3612
3523
|
let links;
|
|
3613
3524
|
for (const result of results) {
|
|
3614
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3615
|
-
continue;
|
|
3525
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3616
3526
|
links = (links || []).concat(result.value);
|
|
3617
3527
|
}
|
|
3618
3528
|
return links;
|
|
@@ -3620,35 +3530,25 @@ var service = {
|
|
|
3620
3530
|
async findDocumentHighlights(doc, params, cancel) {
|
|
3621
3531
|
const results = await Promise.allSettled(
|
|
3622
3532
|
plugins.map(
|
|
3623
|
-
(plugin) =>
|
|
3624
|
-
var _a;
|
|
3625
|
-
return (_a = plugin.findDocumentHighlights) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3626
|
-
}
|
|
3533
|
+
(plugin) => plugin.findDocumentHighlights?.(doc, params, cancel)
|
|
3627
3534
|
)
|
|
3628
3535
|
);
|
|
3629
|
-
if (cancel.isCancellationRequested)
|
|
3630
|
-
return;
|
|
3536
|
+
if (cancel.isCancellationRequested) return;
|
|
3631
3537
|
let highlights;
|
|
3632
3538
|
for (const result of results) {
|
|
3633
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3634
|
-
continue;
|
|
3539
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3635
3540
|
highlights = (highlights || []).concat(result.value);
|
|
3636
3541
|
}
|
|
3637
3542
|
return highlights;
|
|
3638
3543
|
},
|
|
3639
3544
|
async findDocumentColors(doc, params, cancel) {
|
|
3640
3545
|
const results = await Promise.allSettled(
|
|
3641
|
-
plugins.map((plugin) =>
|
|
3642
|
-
var _a;
|
|
3643
|
-
return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3644
|
-
})
|
|
3546
|
+
plugins.map((plugin) => plugin.findDocumentColors?.(doc, params, cancel))
|
|
3645
3547
|
);
|
|
3646
|
-
if (cancel.isCancellationRequested)
|
|
3647
|
-
return;
|
|
3548
|
+
if (cancel.isCancellationRequested) return;
|
|
3648
3549
|
let colors;
|
|
3649
3550
|
for (const result of results) {
|
|
3650
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3651
|
-
continue;
|
|
3551
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3652
3552
|
colors = (colors || []).concat(result.value);
|
|
3653
3553
|
}
|
|
3654
3554
|
return colors;
|
|
@@ -3656,35 +3556,25 @@ var service = {
|
|
|
3656
3556
|
async getColorPresentations(doc, params, cancel) {
|
|
3657
3557
|
const results = await Promise.allSettled(
|
|
3658
3558
|
plugins.map(
|
|
3659
|
-
(plugin) =>
|
|
3660
|
-
var _a;
|
|
3661
|
-
return (_a = plugin.getColorPresentations) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3662
|
-
}
|
|
3559
|
+
(plugin) => plugin.getColorPresentations?.(doc, params, cancel)
|
|
3663
3560
|
)
|
|
3664
3561
|
);
|
|
3665
|
-
if (cancel.isCancellationRequested)
|
|
3666
|
-
return;
|
|
3562
|
+
if (cancel.isCancellationRequested) return;
|
|
3667
3563
|
let presentations;
|
|
3668
3564
|
for (const result of results) {
|
|
3669
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3670
|
-
continue;
|
|
3565
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3671
3566
|
presentations = (presentations || []).concat(result.value);
|
|
3672
3567
|
}
|
|
3673
3568
|
return presentations;
|
|
3674
3569
|
},
|
|
3675
3570
|
async doHover(doc, params, cancel) {
|
|
3676
3571
|
const results = await Promise.allSettled(
|
|
3677
|
-
plugins.map((plugin) =>
|
|
3678
|
-
var _a;
|
|
3679
|
-
return (_a = plugin.doHover) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3680
|
-
})
|
|
3572
|
+
plugins.map((plugin) => plugin.doHover?.(doc, params, cancel))
|
|
3681
3573
|
);
|
|
3682
|
-
if (cancel.isCancellationRequested)
|
|
3683
|
-
return;
|
|
3574
|
+
if (cancel.isCancellationRequested) return;
|
|
3684
3575
|
let hovers;
|
|
3685
3576
|
for (const result of results) {
|
|
3686
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3687
|
-
continue;
|
|
3577
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3688
3578
|
if (hovers) {
|
|
3689
3579
|
hovers.range = maxRange(hovers.range, result.value.range);
|
|
3690
3580
|
hovers.contents = mergeHoverContents(
|
|
@@ -3699,19 +3589,14 @@ var service = {
|
|
|
3699
3589
|
},
|
|
3700
3590
|
async doRename(doc, params, cancel) {
|
|
3701
3591
|
const results = await Promise.allSettled(
|
|
3702
|
-
plugins.map((plugin) =>
|
|
3703
|
-
var _a;
|
|
3704
|
-
return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3705
|
-
})
|
|
3592
|
+
plugins.map((plugin) => plugin.doRename?.(doc, params, cancel))
|
|
3706
3593
|
);
|
|
3707
|
-
if (cancel.isCancellationRequested)
|
|
3708
|
-
return;
|
|
3594
|
+
if (cancel.isCancellationRequested) return;
|
|
3709
3595
|
let changes;
|
|
3710
3596
|
let changeAnnotations;
|
|
3711
3597
|
let documentChanges;
|
|
3712
3598
|
for (const result of results) {
|
|
3713
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3714
|
-
continue;
|
|
3599
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3715
3600
|
const { value } = result;
|
|
3716
3601
|
if (value.changes) {
|
|
3717
3602
|
if (changes) {
|
|
@@ -3743,32 +3628,23 @@ var service = {
|
|
|
3743
3628
|
},
|
|
3744
3629
|
async doCodeActions(doc, params, cancel) {
|
|
3745
3630
|
const results = await Promise.allSettled(
|
|
3746
|
-
plugins.map((plugin) =>
|
|
3747
|
-
var _a;
|
|
3748
|
-
return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
|
|
3749
|
-
})
|
|
3631
|
+
plugins.map((plugin) => plugin.doCodeActions?.(doc, params, cancel))
|
|
3750
3632
|
);
|
|
3751
|
-
if (cancel.isCancellationRequested)
|
|
3752
|
-
return;
|
|
3633
|
+
if (cancel.isCancellationRequested) return;
|
|
3753
3634
|
let actions;
|
|
3754
3635
|
for (const result of results) {
|
|
3755
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3756
|
-
continue;
|
|
3636
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3757
3637
|
actions = (actions || []).concat(result.value);
|
|
3758
3638
|
}
|
|
3759
3639
|
return actions;
|
|
3760
3640
|
},
|
|
3761
3641
|
async doValidate(doc) {
|
|
3762
3642
|
const results = await Promise.allSettled(
|
|
3763
|
-
plugins.map((plugin) =>
|
|
3764
|
-
var _a;
|
|
3765
|
-
return (_a = plugin.doValidate) == null ? void 0 : _a.call(plugin, doc);
|
|
3766
|
-
})
|
|
3643
|
+
plugins.map((plugin) => plugin.doValidate?.(doc))
|
|
3767
3644
|
);
|
|
3768
3645
|
let diagnostics;
|
|
3769
3646
|
for (const result of results) {
|
|
3770
|
-
if (result.status !== "fulfilled" || !result.value)
|
|
3771
|
-
continue;
|
|
3647
|
+
if (result.status !== "fulfilled" || !result.value) continue;
|
|
3772
3648
|
diagnostics = (diagnostics || []).concat(result.value);
|
|
3773
3649
|
}
|
|
3774
3650
|
return diagnostics;
|
|
@@ -3776,10 +3652,8 @@ var service = {
|
|
|
3776
3652
|
format: marko_default.format
|
|
3777
3653
|
};
|
|
3778
3654
|
function maxRange(a, b) {
|
|
3779
|
-
if (!a)
|
|
3780
|
-
|
|
3781
|
-
if (!b)
|
|
3782
|
-
return a;
|
|
3655
|
+
if (!a) return b;
|
|
3656
|
+
if (!b) return a;
|
|
3783
3657
|
return {
|
|
3784
3658
|
start: {
|
|
3785
3659
|
line: Math.min(a.start.line, b.start.line),
|
|
@@ -3792,10 +3666,8 @@ function maxRange(a, b) {
|
|
|
3792
3666
|
};
|
|
3793
3667
|
}
|
|
3794
3668
|
function mergeHoverContents(a, b) {
|
|
3795
|
-
if (!a)
|
|
3796
|
-
|
|
3797
|
-
if (!b)
|
|
3798
|
-
return a;
|
|
3669
|
+
if (!a) return b;
|
|
3670
|
+
if (!b) return a;
|
|
3799
3671
|
if (!import_vscode_languageserver12.MarkupContent.is(a)) {
|
|
3800
3672
|
a = markedStringToMarkupContent(a);
|
|
3801
3673
|
}
|
|
@@ -4024,8 +3896,7 @@ function queueDiagnostic() {
|
|
|
4024
3896
|
}
|
|
4025
3897
|
const prevDiag = prevDiags.get(doc) || [];
|
|
4026
3898
|
const nextDiag = await service.doValidate(doc) || [];
|
|
4027
|
-
if ((0, import_util2.isDeepStrictEqual)(prevDiag, nextDiag))
|
|
4028
|
-
return;
|
|
3899
|
+
if ((0, import_util2.isDeepStrictEqual)(prevDiag, nextDiag)) return;
|
|
4029
3900
|
return [doc, nextDiag];
|
|
4030
3901
|
})
|
|
4031
3902
|
);
|