@marko/language-server 0.12.13 → 0.12.16

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 CHANGED
@@ -13,7 +13,10 @@ var __copyProps = (to, from, except, desc) => {
13
13
  }
14
14
  return to;
15
15
  };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
17
20
 
18
21
  // src/index.ts
19
22
  var import_node = require("vscode-languageserver/node");
@@ -280,12 +283,14 @@ function parse(source) {
280
283
  }
281
284
  }
282
285
  program.body.length = i + 1;
283
- program.static.push(curParent = {
284
- type: 20 /* Statement */,
285
- parent: program,
286
- start: range.start,
287
- end: UNFINISHED
288
- });
286
+ program.static.push(
287
+ curParent = {
288
+ type: 20 /* Statement */,
289
+ parent: program,
290
+ start: range.start,
291
+ end: UNFINISHED
292
+ }
293
+ );
289
294
  return curBodyType = import_htmljs_parser.TagType.statement;
290
295
  }
291
296
  default:
@@ -412,15 +417,18 @@ function parse(source) {
412
417
  start: range.start,
413
418
  end: range.end
414
419
  };
415
- pushAttr(parent, curAttr = name.parent = {
416
- type: 8 /* AttrNamed */,
420
+ pushAttr(
417
421
  parent,
418
- name,
419
- value: void 0,
420
- args: void 0,
421
- start: range.start,
422
- end: range.end
423
- });
422
+ curAttr = name.parent = {
423
+ type: 8 /* AttrNamed */,
424
+ parent,
425
+ name,
426
+ value: void 0,
427
+ args: void 0,
428
+ start: range.start,
429
+ end: range.end
430
+ }
431
+ );
424
432
  },
425
433
  onAttrArgs(range) {
426
434
  curAttr.args = {
@@ -580,7 +588,11 @@ function loadCompilerInfo(dir) {
580
588
  let compiler = builtinCompiler;
581
589
  if (pkg && /^5\./.test(pkg.version)) {
582
590
  try {
583
- let checkTranslator = [].concat(Object.keys(pkg.dependencies), Object.keys(pkg.peerDependencies), Object.keys(pkg.devDependencies)).find((name) => /^marko$|^(@\/marko\/|marko-)translator-/.test(name));
591
+ let checkTranslator = [].concat(
592
+ Object.keys(pkg.dependencies),
593
+ Object.keys(pkg.peerDependencies),
594
+ Object.keys(pkg.devDependencies)
595
+ ).find((name) => /^marko$|^(@\/marko\/|marko-)translator-/.test(name));
584
596
  if (checkTranslator === "marko" || !checkTranslator) {
585
597
  checkTranslator = require((0, import_resolve_from.default)(dir, "@marko/compiler/config")).translator;
586
598
  }
@@ -661,10 +673,13 @@ ${closingTagStr}`
661
673
  label: closingTagStr,
662
674
  kind: import_vscode_languageserver.CompletionItemKind.Class,
663
675
  insertTextFormat: import_vscode_languageserver.InsertTextFormat.Snippet,
664
- textEdit: import_vscode_languageserver.TextEdit.replace(parsed.locationAt({
665
- start,
666
- end
667
- }), closingTagStr)
676
+ textEdit: import_vscode_languageserver.TextEdit.replace(
677
+ parsed.locationAt({
678
+ start,
679
+ end
680
+ }),
681
+ closingTagStr
682
+ )
668
683
  }
669
684
  ];
670
685
  }
@@ -685,7 +700,9 @@ function getTagNameCompletion({
685
700
  let label = tag.isNestedTag ? `@${tag.name}` : tag.name;
686
701
  const fileForTag = tag.template || tag.renderer || tag.filePath;
687
702
  const fileURIForTag = import_vscode_uri2.URI.file(fileForTag).toString();
688
- const nodeModuleMatch = /\/node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(fileForTag);
703
+ const nodeModuleMatch = /\/node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(
704
+ fileForTag
705
+ );
689
706
  const nodeModuleName = nodeModuleMatch && nodeModuleMatch[1];
690
707
  const isCoreTag = /^@?marko[/-]/.test(tag.taglibId) || nodeModuleName === "marko";
691
708
  const documentation = {
@@ -748,12 +765,14 @@ function OpenTagName({
748
765
  for (const key in nestedTags) {
749
766
  if (key !== "*") {
750
767
  const tag2 = nestedTags[key];
751
- result.push(getTagNameCompletion({
752
- tag: tag2,
753
- range,
754
- importer,
755
- showAutoComplete: true
756
- }));
768
+ result.push(
769
+ getTagNameCompletion({
770
+ tag: tag2,
771
+ range,
772
+ importer,
773
+ showAutoComplete: true
774
+ })
775
+ );
757
776
  }
758
777
  }
759
778
  }
@@ -761,12 +780,14 @@ function OpenTagName({
761
780
  const skipStatements = !(tag.concise && tag.parent.type === 0 /* Program */);
762
781
  for (const tag2 of lookup.getTagsSorted()) {
763
782
  if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements && ((_a = tag2.parseOptions) == null ? void 0 : _a.statement) || tag2.name[0] === "_" && /^@?marko[/-]|[\\/]node_modules[\\/]/.test(tag2.filePath))) {
764
- result.push(getTagNameCompletion({
765
- tag: tag2,
766
- range,
767
- importer,
768
- showAutoComplete: true
769
- }));
783
+ result.push(
784
+ getTagNameCompletion({
785
+ tag: tag2,
786
+ range,
787
+ importer,
788
+ showAutoComplete: true
789
+ })
790
+ );
770
791
  }
771
792
  }
772
793
  }
@@ -805,10 +826,12 @@ function AttrName({
805
826
  }
806
827
  }
807
828
  const completions = [];
808
- const attrNameLoc = parsed.locationAt(hasModifier ? {
809
- start: node.start,
810
- end: node.start + name.length
811
- } : node);
829
+ const attrNameLoc = parsed.locationAt(
830
+ hasModifier ? {
831
+ start: node.start,
832
+ end: node.start + name.length
833
+ } : node
834
+ );
812
835
  const tagName = node.parent.parent.nameText || "";
813
836
  const tagDef = tagName && lookup.getTag(tagName);
814
837
  const nestedTagAttrs = {};
@@ -942,7 +965,11 @@ async function readDirectory(uri) {
942
965
  try {
943
966
  const entries = await import_promises.default.readdir((0, import_url.fileURLToPath)(uri));
944
967
  const base = uri.at(-1) === "/" ? uri : `${uri}/`;
945
- return (await Promise.all(entries.map(async (entry) => [entry, (await stat(new URL(entry, base).toString())).type]))).filter(([, type]) => type !== import_vscode_css_languageservice.FileType.Unknown);
968
+ return (await Promise.all(
969
+ entries.map(
970
+ async (entry) => [entry, (await stat(new URL(entry, base).toString())).type]
971
+ )
972
+ )).filter(([, type]) => type !== import_vscode_css_languageservice.FileType.Unknown);
946
973
  } catch {
947
974
  return [];
948
975
  }
@@ -986,22 +1013,27 @@ async function AttrValue({
986
1013
  if (uri) {
987
1014
  const result = [];
988
1015
  const curFile = req === "." ? import_path3.default.basename(document.uri) : void 0;
989
- const replaceRange = import_vscode_languageserver4.Range.create(document.positionAt(start + segmentStart + 1), document.positionAt(start + rawValue.length));
1016
+ const replaceRange = import_vscode_languageserver4.Range.create(
1017
+ document.positionAt(start + segmentStart + 1),
1018
+ document.positionAt(start + rawValue.length)
1019
+ );
990
1020
  for (const [entry, type] of await file_system_default.readDirectory(uri)) {
991
1021
  if (entry[0] !== "." && entry !== curFile) {
992
- result.push(type === import_vscode_css_languageservice.FileType.Directory ? {
993
- label: `${entry}/`,
994
- kind: import_vscode_languageserver4.CompletionItemKind.Folder,
995
- textEdit: import_vscode_languageserver4.TextEdit.replace(replaceRange, `${entry}/`),
996
- command: {
997
- title: "Suggest",
998
- command: "editor.action.triggerSuggest"
1022
+ result.push(
1023
+ type === import_vscode_css_languageservice.FileType.Directory ? {
1024
+ label: `${entry}/`,
1025
+ kind: import_vscode_languageserver4.CompletionItemKind.Folder,
1026
+ textEdit: import_vscode_languageserver4.TextEdit.replace(replaceRange, `${entry}/`),
1027
+ command: {
1028
+ title: "Suggest",
1029
+ command: "editor.action.triggerSuggest"
1030
+ }
1031
+ } : {
1032
+ label: entry,
1033
+ kind: import_vscode_languageserver4.CompletionItemKind.File,
1034
+ textEdit: import_vscode_languageserver4.TextEdit.replace(replaceRange, entry)
999
1035
  }
1000
- } : {
1001
- label: entry,
1002
- kind: import_vscode_languageserver4.CompletionItemKind.File,
1003
- textEdit: import_vscode_languageserver4.TextEdit.replace(replaceRange, entry)
1004
- });
1036
+ );
1005
1037
  }
1006
1038
  }
1007
1039
  return result;
@@ -1061,20 +1093,23 @@ var doComplete = async (doc, params) => {
1061
1093
  const parsed = parse2(doc);
1062
1094
  const offset = doc.offsetAt(params.position);
1063
1095
  const node = parsed.nodeAt(offset);
1064
- return import_vscode_languageserver6.CompletionList.create(await ((_a = handlers[NodeType[node.type]]) == null ? void 0 : _a.call(handlers, {
1065
- document: doc,
1066
- params,
1067
- parsed,
1068
- offset,
1069
- node,
1070
- code: doc.getText(),
1071
- ...getCompilerInfo(doc)
1072
- })) || [], true);
1096
+ return import_vscode_languageserver6.CompletionList.create(
1097
+ await ((_a = handlers[NodeType[node.type]]) == null ? void 0 : _a.call(handlers, {
1098
+ document: doc,
1099
+ params,
1100
+ parsed,
1101
+ offset,
1102
+ node,
1103
+ code: doc.getText(),
1104
+ ...getCompilerInfo(doc)
1105
+ })) || [],
1106
+ true
1107
+ );
1073
1108
  };
1074
1109
 
1075
1110
  // src/service/marko/validate.ts
1076
1111
  var import_vscode_languageserver7 = require("vscode-languageserver");
1077
- var markoErrorRegExp = /^(.+?)(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
1112
+ var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
1078
1113
  var doValidate = (doc) => {
1079
1114
  const fsPath = getDocFile(doc);
1080
1115
  const diagnostics = [];
@@ -1085,15 +1120,33 @@ var doValidate = (doc) => {
1085
1120
  translator,
1086
1121
  code: false,
1087
1122
  output: "source",
1088
- sourceMaps: false
1123
+ sourceMaps: false,
1124
+ babelConfig: {
1125
+ caller: {
1126
+ name: "@marko/language-server",
1127
+ supportsStaticESM: true,
1128
+ supportsDynamicImport: true,
1129
+ supportsTopLevelAwait: true,
1130
+ supportsExportNamespaceFrom: true
1131
+ }
1132
+ }
1089
1133
  });
1090
1134
  } catch (e) {
1091
1135
  let match;
1092
1136
  while (match = markoErrorRegExp.exec(e.message)) {
1093
- const [, fileName, rawLine, rawCol, msg] = match;
1094
- const line = (parseInt(rawLine, 10) || 1) - 1;
1095
- const col = (parseInt(rawCol, 10) || 1) - 1;
1096
- diagnostics.push(import_vscode_languageserver7.Diagnostic.create(import_vscode_languageserver7.Range.create(line, col, line, col), msg, import_vscode_languageserver7.DiagnosticSeverity.Error, void 0, fileName));
1137
+ const [, , rawLine, rawCol, message] = match;
1138
+ const pos = {
1139
+ line: (parseInt(rawLine, 10) || 1) - 1,
1140
+ character: (parseInt(rawCol, 10) || 1) - 1
1141
+ };
1142
+ diagnostics.push({
1143
+ range: { start: pos, end: pos },
1144
+ source: "marko",
1145
+ code: void 0,
1146
+ tags: void 0,
1147
+ severity: import_vscode_languageserver7.DiagnosticSeverity.Error,
1148
+ message
1149
+ });
1097
1150
  }
1098
1151
  }
1099
1152
  return diagnostics;
@@ -1104,7 +1157,10 @@ var import_fs = __toESM(require("fs"));
1104
1157
  var import_vscode_uri3 = require("vscode-uri");
1105
1158
  var import_vscode_languageserver8 = require("vscode-languageserver");
1106
1159
  var import_vscode_languageserver_textdocument = require("vscode-languageserver-textdocument");
1107
- var START_OF_FILE = import_vscode_languageserver8.Range.create(import_vscode_languageserver8.Position.create(0, 0), import_vscode_languageserver8.Position.create(0, 0));
1160
+ var START_OF_FILE = import_vscode_languageserver8.Range.create(
1161
+ import_vscode_languageserver8.Position.create(0, 0),
1162
+ import_vscode_languageserver8.Position.create(0, 0)
1163
+ );
1108
1164
  function createTextDocument(filename) {
1109
1165
  const uri = import_vscode_uri3.URI.file(filename).toString();
1110
1166
  const content = import_fs.default.readFileSync(filename, "utf-8");
@@ -1210,13 +1266,23 @@ function OpenTagName3({
1210
1266
  }
1211
1267
  if (/\/marko(?:-tag)?\.json$/.test(tagEntryFile)) {
1212
1268
  const tagDefDoc = createTextDocument(tagEntryFile);
1213
- const match = RegExpBuilder`/"(?:<${tag.nameText}>|${tag.nameText})"\s*:\s*[^\r\n,]+/g`.exec(tagDefDoc.getText());
1269
+ const match = RegExpBuilder`/"(?:<${tag.nameText}>|${tag.nameText})"\s*:\s*[^\r\n,]+/g`.exec(
1270
+ tagDefDoc.getText()
1271
+ );
1214
1272
  if (match && match.index) {
1215
- range = import_vscode_languageserver9.Range.create(tagDefDoc.positionAt(match.index), tagDefDoc.positionAt(match.index + match[0].length));
1273
+ range = import_vscode_languageserver9.Range.create(
1274
+ tagDefDoc.positionAt(match.index),
1275
+ tagDefDoc.positionAt(match.index + match[0].length)
1276
+ );
1216
1277
  }
1217
1278
  }
1218
1279
  return [
1219
- import_vscode_languageserver9.LocationLink.create(import_vscode_uri4.URI.file(tagEntryFile).toString(), range, range, parsed.locationAt(node))
1280
+ import_vscode_languageserver9.LocationLink.create(
1281
+ import_vscode_uri4.URI.file(tagEntryFile).toString(),
1282
+ range,
1283
+ range,
1284
+ parsed.locationAt(node)
1285
+ )
1220
1286
  ];
1221
1287
  }
1222
1288
 
@@ -1244,13 +1310,23 @@ function AttrName2({
1244
1310
  }
1245
1311
  if (/\/marko(?:-tag)?\.json$/.test(attrEntryFile)) {
1246
1312
  const tagDefDoc = createTextDocument(attrEntryFile);
1247
- const match = RegExpBuilder`/"@${attrName}"\s*:\s*[^\r\n,]+/g`.exec(tagDefDoc.getText());
1313
+ const match = RegExpBuilder`/"@${attrName}"\s*:\s*[^\r\n,]+/g`.exec(
1314
+ tagDefDoc.getText()
1315
+ );
1248
1316
  if (match && match.index) {
1249
- range = import_vscode_languageserver10.Range.create(tagDefDoc.positionAt(match.index), tagDefDoc.positionAt(match.index + match[0].length));
1317
+ range = import_vscode_languageserver10.Range.create(
1318
+ tagDefDoc.positionAt(match.index),
1319
+ tagDefDoc.positionAt(match.index + match[0].length)
1320
+ );
1250
1321
  }
1251
1322
  }
1252
1323
  return [
1253
- import_vscode_languageserver10.LocationLink.create(import_vscode_uri5.URI.file(attrEntryFile).toString(), range, range, parsed.locationAt(node))
1324
+ import_vscode_languageserver10.LocationLink.create(
1325
+ import_vscode_uri5.URI.file(attrEntryFile).toString(),
1326
+ range,
1327
+ range,
1328
+ parsed.locationAt(node)
1329
+ )
1254
1330
  ];
1255
1331
  }
1256
1332
 
@@ -1275,10 +1351,20 @@ var findDefinition = async (doc, params) => {
1275
1351
  })) || [];
1276
1352
  };
1277
1353
 
1278
- // src/service/marko/document-links/extract.ts
1354
+ // src/service/marko/document-links.ts
1279
1355
  var import_vscode_languageserver11 = require("vscode-languageserver");
1280
1356
  var import_vscode_uri6 = require("vscode-uri");
1281
1357
  var importTagReg2 = /(['"])<((?:[^\1\\>]+|\\.)*)>?\1/g;
1358
+ var cache = /* @__PURE__ */ new WeakMap();
1359
+ var findDocumentLinks = async (doc) => {
1360
+ const parsed = parse2(doc);
1361
+ let result = cache.get(parsed);
1362
+ if (!result) {
1363
+ result = extractDocumentLinks(doc, parsed, getCompilerInfo(doc).lookup);
1364
+ cache.set(parsed, result);
1365
+ }
1366
+ return result;
1367
+ };
1282
1368
  function extractDocumentLinks(doc, parsed, lookup) {
1283
1369
  if (import_vscode_uri6.URI.parse(doc.uri).scheme === "untitled") {
1284
1370
  return [];
@@ -1300,7 +1386,18 @@ function extractDocumentLinks(doc, parsed, lookup) {
1300
1386
  if (node.attrs && node.nameText) {
1301
1387
  for (const attr of node.attrs) {
1302
1388
  if (isDocumentLinkAttr(doc, node, attr)) {
1303
- links.push(import_vscode_languageserver11.DocumentLink.create(parsed.locationAt(attr.value.value), resolveUrl(read(attr.value.value).slice(1, -1), doc.uri)));
1389
+ const resolved = resolveUrl(
1390
+ read(attr.value.value).slice(1, -1),
1391
+ doc.uri
1392
+ );
1393
+ if (resolved) {
1394
+ links.push(
1395
+ import_vscode_languageserver11.DocumentLink.create(
1396
+ parsed.locationAt(attr.value.value),
1397
+ resolveUrl(read(attr.value.value).slice(1, -1), doc.uri)
1398
+ )
1399
+ );
1400
+ }
1304
1401
  }
1305
1402
  }
1306
1403
  }
@@ -1322,10 +1419,15 @@ function extractDocumentLinks(doc, parsed, lookup) {
1322
1419
  const tagDef = lookup.getTag(tagName);
1323
1420
  const fileForTag = tagDef && (tagDef.template || tagDef.renderer);
1324
1421
  if (fileForTag) {
1325
- links.push(import_vscode_languageserver11.DocumentLink.create(parsed.locationAt({
1326
- start: item.start + match.index,
1327
- end: item.start + match.index + length
1328
- }), fileForTag));
1422
+ links.push(
1423
+ import_vscode_languageserver11.DocumentLink.create(
1424
+ parsed.locationAt({
1425
+ start: item.start + match.index,
1426
+ end: item.start + match.index + length
1427
+ }),
1428
+ fileForTag
1429
+ )
1430
+ );
1329
1431
  }
1330
1432
  }
1331
1433
  }
@@ -1336,21 +1438,19 @@ function extractDocumentLinks(doc, parsed, lookup) {
1336
1438
  return links;
1337
1439
  }
1338
1440
 
1339
- // src/service/marko/document-links/index.ts
1340
- var cache = /* @__PURE__ */ new WeakMap();
1341
- var findDocumentLinks = async (doc) => {
1441
+ // src/service/marko/document-symbols.ts
1442
+ var import_vscode_uri7 = require("vscode-uri");
1443
+ var import_vscode_languageserver12 = require("vscode-languageserver");
1444
+ var cache2 = /* @__PURE__ */ new WeakMap();
1445
+ var findDocumentSymbols = async (doc) => {
1342
1446
  const parsed = parse2(doc);
1343
- let result = cache.get(parsed);
1447
+ let result = cache2.get(parsed);
1344
1448
  if (!result) {
1345
- result = extractDocumentLinks(doc, parsed, getCompilerInfo(doc).lookup);
1346
- cache.set(parsed, result);
1449
+ result = extractDocumentSymbols(doc, parsed, getCompilerInfo(doc).lookup);
1450
+ cache2.set(parsed, result);
1347
1451
  }
1348
1452
  return result;
1349
1453
  };
1350
-
1351
- // src/service/marko/document-symbols/extract.ts
1352
- var import_vscode_uri7 = require("vscode-uri");
1353
- var import_vscode_languageserver12 = require("vscode-languageserver");
1354
1454
  function extractDocumentSymbols(doc, parsed, lookup) {
1355
1455
  if (import_vscode_uri7.URI.parse(doc.uri).scheme === "untitled") {
1356
1456
  return [];
@@ -1362,7 +1462,14 @@ function extractDocumentSymbols(doc, parsed, lookup) {
1362
1462
  switch (node.type) {
1363
1463
  case 1 /* Tag */:
1364
1464
  case 14 /* AttrTag */:
1365
- symbols.push(import_vscode_languageserver12.SymbolInformation.create((node.type === 14 /* AttrTag */ ? (_a = node.nameText) == null ? void 0 : _a.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>", node.nameText && ((_b = lookup.getTag(node.nameText)) == null ? void 0 : _b.html) && import_vscode_languageserver12.SymbolKind.Property || import_vscode_languageserver12.SymbolKind.Class, parsed.locationAt(node), doc.uri));
1465
+ symbols.push(
1466
+ import_vscode_languageserver12.SymbolInformation.create(
1467
+ (node.type === 14 /* AttrTag */ ? (_a = node.nameText) == null ? void 0 : _a.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
1468
+ node.nameText && ((_b = lookup.getTag(node.nameText)) == null ? void 0 : _b.html) && import_vscode_languageserver12.SymbolKind.Property || import_vscode_languageserver12.SymbolKind.Class,
1469
+ parsed.locationAt(node),
1470
+ doc.uri
1471
+ )
1472
+ );
1366
1473
  if (node.body) {
1367
1474
  for (const child of node.body) {
1368
1475
  visit(child);
@@ -1377,18 +1484,6 @@ function extractDocumentSymbols(doc, parsed, lookup) {
1377
1484
  return symbols;
1378
1485
  }
1379
1486
 
1380
- // src/service/marko/document-symbols/index.ts
1381
- var cache2 = /* @__PURE__ */ new WeakMap();
1382
- var findDocumentSymbols = async (doc) => {
1383
- const parsed = parse2(doc);
1384
- let result = cache2.get(parsed);
1385
- if (!result) {
1386
- result = extractDocumentSymbols(doc, parsed, getCompilerInfo(doc).lookup);
1387
- cache2.set(parsed, result);
1388
- }
1389
- return result;
1390
- };
1391
-
1392
1487
  // src/service/marko/format.ts
1393
1488
  var import_vscode_languageserver13 = require("vscode-languageserver");
1394
1489
  var import_vscode_uri8 = require("vscode-uri");
@@ -1411,7 +1506,10 @@ var format2 = async (doc, params, cancel) => {
1411
1506
  if (cancel.isCancellationRequested)
1412
1507
  return;
1413
1508
  return [
1414
- import_vscode_languageserver13.TextEdit.replace(import_vscode_languageserver13.Range.create(doc.positionAt(0), doc.positionAt(text.length)), prettier.format(text, options))
1509
+ import_vscode_languageserver13.TextEdit.replace(
1510
+ import_vscode_languageserver13.Range.create(doc.positionAt(0), doc.positionAt(text.length)),
1511
+ prettier.format(text, options)
1512
+ )
1415
1513
  ];
1416
1514
  } catch (e) {
1417
1515
  displayError(e);
@@ -1619,12 +1717,21 @@ var StyleSheetService = {
1619
1717
  if (generatedOffset === void 0)
1620
1718
  continue;
1621
1719
  const { service: service2, virtualDoc } = info;
1622
- const result = await service2.doComplete2(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed, { resolveReference: resolveUrl });
1720
+ const result = await service2.doComplete2(
1721
+ virtualDoc,
1722
+ virtualDoc.positionAt(generatedOffset),
1723
+ info.parsed,
1724
+ { resolveReference: resolveUrl }
1725
+ );
1623
1726
  if (result.itemDefaults) {
1624
1727
  const { editRange } = result.itemDefaults;
1625
1728
  if (editRange) {
1626
1729
  if ("start" in editRange) {
1627
- result.itemDefaults.editRange = getSourceRange(doc, info, editRange);
1730
+ result.itemDefaults.editRange = getSourceRange(
1731
+ doc,
1732
+ info,
1733
+ editRange
1734
+ );
1628
1735
  } else {
1629
1736
  editRange.insert = getSourceRange(doc, info, editRange.insert);
1630
1737
  editRange.replace = getSourceRange(doc, info, editRange.replace);
@@ -1636,7 +1743,11 @@ var StyleSheetService = {
1636
1743
  item.textEdit = getSourceInsertReplaceEdit(doc, info, item.textEdit);
1637
1744
  }
1638
1745
  if (item.additionalTextEdits) {
1639
- item.additionalTextEdits = getSourceEdits(doc, info, item.additionalTextEdits);
1746
+ item.additionalTextEdits = getSourceEdits(
1747
+ doc,
1748
+ info,
1749
+ item.additionalTextEdits
1750
+ );
1640
1751
  }
1641
1752
  }
1642
1753
  return result;
@@ -1652,7 +1763,11 @@ var StyleSheetService = {
1652
1763
  if (generatedOffset === void 0)
1653
1764
  continue;
1654
1765
  const { service: service2, virtualDoc } = info;
1655
- const result = service2.findDefinition(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed);
1766
+ const result = service2.findDefinition(
1767
+ virtualDoc,
1768
+ virtualDoc.positionAt(generatedOffset),
1769
+ info.parsed
1770
+ );
1656
1771
  if (result) {
1657
1772
  const range = getSourceRange(doc, info, result.range);
1658
1773
  if (range) {
@@ -1675,7 +1790,11 @@ var StyleSheetService = {
1675
1790
  continue;
1676
1791
  const { service: service2, virtualDoc } = info;
1677
1792
  const result = [];
1678
- for (const location of service2.findReferences(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed)) {
1793
+ for (const location of service2.findReferences(
1794
+ virtualDoc,
1795
+ virtualDoc.positionAt(generatedOffset),
1796
+ info.parsed
1797
+ )) {
1679
1798
  const range = getSourceRange(doc, info, location.range);
1680
1799
  if (range) {
1681
1800
  result.push({
@@ -1693,7 +1812,10 @@ var StyleSheetService = {
1693
1812
  for (const ext in infoByExt) {
1694
1813
  const info = infoByExt[ext];
1695
1814
  const { service: service2, virtualDoc } = info;
1696
- for (const symbol of service2.findDocumentSymbols(virtualDoc, info.parsed)) {
1815
+ for (const symbol of service2.findDocumentSymbols(
1816
+ virtualDoc,
1817
+ info.parsed
1818
+ )) {
1697
1819
  if (symbol.location.uri === doc.uri) {
1698
1820
  const range = getSourceRange(doc, info, symbol.location.range);
1699
1821
  if (range) {
@@ -1719,7 +1841,11 @@ var StyleSheetService = {
1719
1841
  for (const ext in infoByExt) {
1720
1842
  const info = infoByExt[ext];
1721
1843
  const { service: service2, virtualDoc } = info;
1722
- for (const link of await service2.findDocumentLinks2(virtualDoc, info.parsed, { resolveReference: resolveUrl })) {
1844
+ for (const link of await service2.findDocumentLinks2(
1845
+ virtualDoc,
1846
+ info.parsed,
1847
+ { resolveReference: resolveUrl }
1848
+ )) {
1723
1849
  const range = getSourceRange(doc, info, link.range);
1724
1850
  if (range) {
1725
1851
  result.push({
@@ -1743,7 +1869,11 @@ var StyleSheetService = {
1743
1869
  continue;
1744
1870
  const { service: service2, virtualDoc } = info;
1745
1871
  const result = [];
1746
- for (const highlight of service2.findDocumentHighlights(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed)) {
1872
+ for (const highlight of service2.findDocumentHighlights(
1873
+ virtualDoc,
1874
+ virtualDoc.positionAt(generatedOffset),
1875
+ info.parsed
1876
+ )) {
1747
1877
  const range = getSourceRange(doc, info, highlight.range);
1748
1878
  if (range) {
1749
1879
  result.push({
@@ -1761,7 +1891,10 @@ var StyleSheetService = {
1761
1891
  for (const ext in infoByExt) {
1762
1892
  const info = infoByExt[ext];
1763
1893
  const { service: service2, virtualDoc } = info;
1764
- for (const colorInfo of service2.findDocumentColors(virtualDoc, info.parsed)) {
1894
+ for (const colorInfo of service2.findDocumentColors(
1895
+ virtualDoc,
1896
+ info.parsed
1897
+ )) {
1765
1898
  const range = getSourceRange(doc, info, colorInfo.range);
1766
1899
  if (range) {
1767
1900
  result.push({
@@ -1781,12 +1914,22 @@ var StyleSheetService = {
1781
1914
  const generatedOffsetStart = info.generatedOffsetAt(sourceOffset);
1782
1915
  if (generatedOffsetStart === void 0)
1783
1916
  continue;
1784
- const generatedOffsetEnd = info.generatedOffsetAt(doc.offsetAt(params.range.end));
1917
+ const generatedOffsetEnd = info.generatedOffsetAt(
1918
+ doc.offsetAt(params.range.end)
1919
+ );
1785
1920
  if (generatedOffsetEnd === void 0)
1786
1921
  continue;
1787
1922
  const { service: service2, virtualDoc } = info;
1788
1923
  const result = [];
1789
- for (const colorPresentation of service2.getColorPresentations(virtualDoc, info.parsed, params.color, import_vscode_languageserver14.Range.create(virtualDoc.positionAt(generatedOffsetStart), virtualDoc.positionAt(generatedOffsetEnd)))) {
1924
+ for (const colorPresentation of service2.getColorPresentations(
1925
+ virtualDoc,
1926
+ info.parsed,
1927
+ params.color,
1928
+ import_vscode_languageserver14.Range.create(
1929
+ virtualDoc.positionAt(generatedOffsetStart),
1930
+ virtualDoc.positionAt(generatedOffsetEnd)
1931
+ )
1932
+ )) {
1790
1933
  const textEdit = colorPresentation.textEdit && getSourceEdit(doc, info, colorPresentation.textEdit);
1791
1934
  const additionalTextEdits = colorPresentation.additionalTextEdits && getSourceEdits(doc, info, colorPresentation.additionalTextEdits);
1792
1935
  if (textEdit || additionalTextEdits) {
@@ -1809,7 +1952,11 @@ var StyleSheetService = {
1809
1952
  if (generatedOffset === void 0)
1810
1953
  continue;
1811
1954
  const { service: service2, virtualDoc } = info;
1812
- const result = service2.doHover(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed);
1955
+ const result = service2.doHover(
1956
+ virtualDoc,
1957
+ virtualDoc.positionAt(generatedOffset),
1958
+ info.parsed
1959
+ );
1813
1960
  if (result) {
1814
1961
  if (result.range) {
1815
1962
  const range = getSourceRange(doc, info, result.range);
@@ -1834,7 +1981,12 @@ var StyleSheetService = {
1834
1981
  if (generatedOffset === void 0)
1835
1982
  continue;
1836
1983
  const { service: service2, virtualDoc } = info;
1837
- const result = service2.doRename(virtualDoc, virtualDoc.positionAt(generatedOffset), params.newName, info.parsed);
1984
+ const result = service2.doRename(
1985
+ virtualDoc,
1986
+ virtualDoc.positionAt(generatedOffset),
1987
+ params.newName,
1988
+ info.parsed
1989
+ );
1838
1990
  if (result.changes) {
1839
1991
  for (const uri in result.changes) {
1840
1992
  if (uri === doc.uri) {
@@ -1863,11 +2015,21 @@ var StyleSheetService = {
1863
2015
  const generatedOffsetStart = info.generatedOffsetAt(sourceOffset);
1864
2016
  if (generatedOffsetStart === void 0)
1865
2017
  continue;
1866
- const generatedOffsetEnd = info.generatedOffsetAt(doc.offsetAt(params.range.end));
2018
+ const generatedOffsetEnd = info.generatedOffsetAt(
2019
+ doc.offsetAt(params.range.end)
2020
+ );
1867
2021
  if (generatedOffsetEnd === void 0)
1868
2022
  continue;
1869
2023
  const { service: service2, virtualDoc } = info;
1870
- const result = service2.doCodeActions(virtualDoc, import_vscode_languageserver14.Range.create(virtualDoc.positionAt(generatedOffsetStart), virtualDoc.positionAt(generatedOffsetEnd)), params.context, info.parsed);
2024
+ const result = service2.doCodeActions(
2025
+ virtualDoc,
2026
+ import_vscode_languageserver14.Range.create(
2027
+ virtualDoc.positionAt(generatedOffsetStart),
2028
+ virtualDoc.positionAt(generatedOffsetEnd)
2029
+ ),
2030
+ params.context,
2031
+ info.parsed
2032
+ );
1871
2033
  for (const command of result) {
1872
2034
  const edits = (_a = command.arguments) == null ? void 0 : _a[2];
1873
2035
  if (edits && Array.isArray(edits) && isTextEdit(edits[0])) {
@@ -1882,7 +2044,10 @@ var StyleSheetService = {
1882
2044
  const result = [];
1883
2045
  for (const ext in infoByExt) {
1884
2046
  const info = infoByExt[ext];
1885
- for (const diag of info.service.doValidation(info.virtualDoc, info.parsed)) {
2047
+ for (const diag of info.service.doValidation(
2048
+ info.virtualDoc,
2049
+ info.parsed
2050
+ )) {
1886
2051
  const range = getSourceRange(doc, info, diag.range);
1887
2052
  if (range) {
1888
2053
  diag.range = range;
@@ -1954,7 +2119,11 @@ function getStyleSheetInfo(doc) {
1954
2119
  const parsed = parse2(doc);
1955
2120
  let cached = cache3.get(parsed);
1956
2121
  if (!cached) {
1957
- const results = extractStyleSheets(doc.getText(), parsed.program, getCompilerInfo(doc).lookup);
2122
+ const results = extractStyleSheets(
2123
+ doc.getText(),
2124
+ parsed.program,
2125
+ getCompilerInfo(doc).lookup
2126
+ );
1958
2127
  cached = {};
1959
2128
  for (const ext in results) {
1960
2129
  const service2 = (_a = services[ext]) == null ? void 0 : _a.call(services, {
@@ -1964,7 +2133,12 @@ function getStyleSheetInfo(doc) {
1964
2133
  if (!service2)
1965
2134
  continue;
1966
2135
  const { generated, sourceOffsetAt, generatedOffsetAt } = results[ext];
1967
- const virtualDoc = import_vscode_languageserver_textdocument2.TextDocument.create(doc.uri, "css", doc.version, generated);
2136
+ const virtualDoc = import_vscode_languageserver_textdocument2.TextDocument.create(
2137
+ doc.uri,
2138
+ "css",
2139
+ doc.version,
2140
+ generated
2141
+ );
1968
2142
  cached[ext] = {
1969
2143
  service: service2,
1970
2144
  virtualDoc,
@@ -1994,10 +2168,12 @@ var service = {
1994
2168
  let items;
1995
2169
  let isIncomplete = false;
1996
2170
  try {
1997
- for (const pending of plugins.map((plugin) => {
1998
- var _a;
1999
- return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2000
- })) {
2171
+ for (const pending of plugins.map(
2172
+ (plugin) => {
2173
+ var _a;
2174
+ return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2175
+ }
2176
+ )) {
2001
2177
  const cur = await pending;
2002
2178
  if (cancel.isCancellationRequested)
2003
2179
  return;
@@ -2023,10 +2199,12 @@ var service = {
2023
2199
  async findDefinition(doc, params, cancel) {
2024
2200
  let result;
2025
2201
  try {
2026
- for (const pending of plugins.map((plugin) => {
2027
- var _a;
2028
- return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2029
- })) {
2202
+ for (const pending of plugins.map(
2203
+ (plugin) => {
2204
+ var _a;
2205
+ return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2206
+ }
2207
+ )) {
2030
2208
  const cur = await pending;
2031
2209
  if (cancel.isCancellationRequested)
2032
2210
  return;
@@ -2041,10 +2219,12 @@ var service = {
2041
2219
  async findReferences(doc, params, cancel) {
2042
2220
  let result;
2043
2221
  try {
2044
- for (const pending of plugins.map((plugin) => {
2045
- var _a;
2046
- return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2047
- })) {
2222
+ for (const pending of plugins.map(
2223
+ (plugin) => {
2224
+ var _a;
2225
+ return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2226
+ }
2227
+ )) {
2048
2228
  const cur = await pending;
2049
2229
  if (cancel.isCancellationRequested)
2050
2230
  return;
@@ -2059,10 +2239,12 @@ var service = {
2059
2239
  async findDocumentSymbols(doc, params, cancel) {
2060
2240
  let result;
2061
2241
  try {
2062
- for (const pending of plugins.map((plugin) => {
2063
- var _a;
2064
- return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2065
- })) {
2242
+ for (const pending of plugins.map(
2243
+ (plugin) => {
2244
+ var _a;
2245
+ return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2246
+ }
2247
+ )) {
2066
2248
  const cur = await pending;
2067
2249
  if (cancel.isCancellationRequested)
2068
2250
  return;
@@ -2077,10 +2259,12 @@ var service = {
2077
2259
  async findDocumentLinks(doc, params, cancel) {
2078
2260
  let result;
2079
2261
  try {
2080
- for (const pending of plugins.map((plugin) => {
2081
- var _a;
2082
- return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2083
- })) {
2262
+ for (const pending of plugins.map(
2263
+ (plugin) => {
2264
+ var _a;
2265
+ return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2266
+ }
2267
+ )) {
2084
2268
  const cur = await pending;
2085
2269
  if (cancel.isCancellationRequested)
2086
2270
  return;
@@ -2095,10 +2279,12 @@ var service = {
2095
2279
  async findDocumentHighlights(doc, params, cancel) {
2096
2280
  let result;
2097
2281
  try {
2098
- for (const pending of plugins.map((plugin) => {
2099
- var _a;
2100
- return (_a = plugin.findDocumentHighlights) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2101
- })) {
2282
+ for (const pending of plugins.map(
2283
+ (plugin) => {
2284
+ var _a;
2285
+ return (_a = plugin.findDocumentHighlights) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2286
+ }
2287
+ )) {
2102
2288
  const cur = await pending;
2103
2289
  if (cancel.isCancellationRequested)
2104
2290
  return;
@@ -2113,10 +2299,12 @@ var service = {
2113
2299
  async findDocumentColors(doc, params, cancel) {
2114
2300
  let result;
2115
2301
  try {
2116
- for (const pending of plugins.map((plugin) => {
2117
- var _a;
2118
- return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2119
- })) {
2302
+ for (const pending of plugins.map(
2303
+ (plugin) => {
2304
+ var _a;
2305
+ return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2306
+ }
2307
+ )) {
2120
2308
  const cur = await pending;
2121
2309
  if (cancel.isCancellationRequested)
2122
2310
  return;
@@ -2131,10 +2319,12 @@ var service = {
2131
2319
  async getColorPresentations(doc, params, cancel) {
2132
2320
  let result;
2133
2321
  try {
2134
- for (const pending of plugins.map((plugin) => {
2135
- var _a;
2136
- return (_a = plugin.getColorPresentations) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2137
- })) {
2322
+ for (const pending of plugins.map(
2323
+ (plugin) => {
2324
+ var _a;
2325
+ return (_a = plugin.getColorPresentations) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2326
+ }
2327
+ )) {
2138
2328
  const cur = await pending;
2139
2329
  if (cancel.isCancellationRequested)
2140
2330
  return;
@@ -2165,10 +2355,12 @@ var service = {
2165
2355
  let changeAnnotations;
2166
2356
  let documentChanges;
2167
2357
  try {
2168
- for (const pending of plugins.map((plugin) => {
2169
- var _a;
2170
- return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2171
- })) {
2358
+ for (const pending of plugins.map(
2359
+ (plugin) => {
2360
+ var _a;
2361
+ return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2362
+ }
2363
+ )) {
2172
2364
  const cur = await pending;
2173
2365
  if (cancel.isCancellationRequested)
2174
2366
  return;
@@ -2208,10 +2400,12 @@ var service = {
2208
2400
  async doCodeActions(doc, params, cancel) {
2209
2401
  let result;
2210
2402
  try {
2211
- for (const pending of plugins.map((plugin) => {
2212
- var _a;
2213
- return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2214
- })) {
2403
+ for (const pending of plugins.map(
2404
+ (plugin) => {
2405
+ var _a;
2406
+ return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2407
+ }
2408
+ )) {
2215
2409
  const cur = await pending;
2216
2410
  if (cancel.isCancellationRequested)
2217
2411
  return;
@@ -2309,40 +2503,88 @@ documents.onDidChangeContent(({ document }) => {
2309
2503
  clearCompilerCache(document);
2310
2504
  });
2311
2505
  connection2.onCompletion(async (params, cancel) => {
2312
- return await service.doComplete(documents.get(params.textDocument.uri), params, cancel) || null;
2506
+ return await service.doComplete(
2507
+ documents.get(params.textDocument.uri),
2508
+ params,
2509
+ cancel
2510
+ ) || null;
2313
2511
  });
2314
2512
  connection2.onDefinition(async (params, cancel) => {
2315
- return await service.findDefinition(documents.get(params.textDocument.uri), params, cancel) || null;
2513
+ return await service.findDefinition(
2514
+ documents.get(params.textDocument.uri),
2515
+ params,
2516
+ cancel
2517
+ ) || null;
2316
2518
  });
2317
2519
  connection2.onReferences(async (params, cancel) => {
2318
- return await service.findReferences(documents.get(params.textDocument.uri), params, cancel) || null;
2520
+ return await service.findReferences(
2521
+ documents.get(params.textDocument.uri),
2522
+ params,
2523
+ cancel
2524
+ ) || null;
2319
2525
  });
2320
2526
  connection2.onDocumentLinks(async (params, cancel) => {
2321
- return await service.findDocumentLinks(documents.get(params.textDocument.uri), params, cancel) || null;
2527
+ return await service.findDocumentLinks(
2528
+ documents.get(params.textDocument.uri),
2529
+ params,
2530
+ cancel
2531
+ ) || null;
2322
2532
  });
2323
2533
  connection2.onDocumentSymbol(async (params, cancel) => {
2324
- return await service.findDocumentSymbols(documents.get(params.textDocument.uri), params, cancel) || null;
2534
+ return await service.findDocumentSymbols(
2535
+ documents.get(params.textDocument.uri),
2536
+ params,
2537
+ cancel
2538
+ ) || null;
2325
2539
  });
2326
2540
  connection2.onDocumentHighlight(async (params, cancel) => {
2327
- return await service.findDocumentHighlights(documents.get(params.textDocument.uri), params, cancel) || null;
2541
+ return await service.findDocumentHighlights(
2542
+ documents.get(params.textDocument.uri),
2543
+ params,
2544
+ cancel
2545
+ ) || null;
2328
2546
  });
2329
2547
  connection2.onDocumentColor(async (params, cancel) => {
2330
- return await service.findDocumentColors(documents.get(params.textDocument.uri), params, cancel) || null;
2548
+ return await service.findDocumentColors(
2549
+ documents.get(params.textDocument.uri),
2550
+ params,
2551
+ cancel
2552
+ ) || null;
2331
2553
  });
2332
2554
  connection2.onColorPresentation(async (params, cancel) => {
2333
- return await service.getColorPresentations(documents.get(params.textDocument.uri), params, cancel) || null;
2555
+ return await service.getColorPresentations(
2556
+ documents.get(params.textDocument.uri),
2557
+ params,
2558
+ cancel
2559
+ ) || null;
2334
2560
  });
2335
2561
  connection2.onHover(async (params, cancel) => {
2336
- return await service.doHover(documents.get(params.textDocument.uri), params, cancel) || null;
2562
+ return await service.doHover(
2563
+ documents.get(params.textDocument.uri),
2564
+ params,
2565
+ cancel
2566
+ ) || null;
2337
2567
  });
2338
2568
  connection2.onRenameRequest(async (params, cancel) => {
2339
- return await service.doRename(documents.get(params.textDocument.uri), params, cancel) || null;
2569
+ return await service.doRename(
2570
+ documents.get(params.textDocument.uri),
2571
+ params,
2572
+ cancel
2573
+ ) || null;
2340
2574
  });
2341
2575
  connection2.onCodeAction(async (params, cancel) => {
2342
- return await service.doCodeActions(documents.get(params.textDocument.uri), params, cancel) || null;
2576
+ return await service.doCodeActions(
2577
+ documents.get(params.textDocument.uri),
2578
+ params,
2579
+ cancel
2580
+ ) || null;
2343
2581
  });
2344
2582
  connection2.onDocumentFormatting(async (params, cancel) => {
2345
- return await service.format(documents.get(params.textDocument.uri), params, cancel) || null;
2583
+ return await service.format(
2584
+ documents.get(params.textDocument.uri),
2585
+ params,
2586
+ cancel
2587
+ ) || null;
2346
2588
  });
2347
2589
  function validateDocs() {
2348
2590
  queueDiagnostic();
@@ -2354,15 +2596,17 @@ function validateDocs() {
2354
2596
  function queueDiagnostic() {
2355
2597
  clearTimeout(diagnosticTimeout);
2356
2598
  const id = diagnosticTimeout = setTimeout(async () => {
2357
- const results = await Promise.all(documents.all().map(async (doc) => {
2358
- if (!pendingDiags.delete(doc))
2359
- return;
2360
- const prevDiag = prevDiags.get(doc) || [];
2361
- const nextDiag = await service.doValidate(doc) || [];
2362
- if ((0, import_util2.isDeepStrictEqual)(prevDiag, nextDiag))
2363
- return;
2364
- return [doc, nextDiag];
2365
- }));
2599
+ const results = await Promise.all(
2600
+ documents.all().map(async (doc) => {
2601
+ if (!pendingDiags.delete(doc))
2602
+ return;
2603
+ const prevDiag = prevDiags.get(doc) || [];
2604
+ const nextDiag = await service.doValidate(doc) || [];
2605
+ if ((0, import_util2.isDeepStrictEqual)(prevDiag, nextDiag))
2606
+ return;
2607
+ return [doc, nextDiag];
2608
+ })
2609
+ );
2366
2610
  if (id === diagnosticTimeout) {
2367
2611
  for (const result of results) {
2368
2612
  if (result) {