@marko/language-server 0.12.14 → 0.12.17

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.mjs CHANGED
@@ -276,12 +276,14 @@ function parse(source) {
276
276
  }
277
277
  }
278
278
  program.body.length = i + 1;
279
- program.static.push(curParent = {
280
- type: 20 /* Statement */,
281
- parent: program,
282
- start: range.start,
283
- end: UNFINISHED
284
- });
279
+ program.static.push(
280
+ curParent = {
281
+ type: 20 /* Statement */,
282
+ parent: program,
283
+ start: range.start,
284
+ end: UNFINISHED
285
+ }
286
+ );
285
287
  return curBodyType = TagType.statement;
286
288
  }
287
289
  default:
@@ -408,15 +410,18 @@ function parse(source) {
408
410
  start: range.start,
409
411
  end: range.end
410
412
  };
411
- pushAttr(parent, curAttr = name.parent = {
412
- type: 8 /* AttrNamed */,
413
+ pushAttr(
413
414
  parent,
414
- name,
415
- value: void 0,
416
- args: void 0,
417
- start: range.start,
418
- end: range.end
419
- });
415
+ curAttr = name.parent = {
416
+ type: 8 /* AttrNamed */,
417
+ parent,
418
+ name,
419
+ value: void 0,
420
+ args: void 0,
421
+ start: range.start,
422
+ end: range.end
423
+ }
424
+ );
420
425
  },
421
426
  onAttrArgs(range) {
422
427
  curAttr.args = {
@@ -576,7 +581,11 @@ function loadCompilerInfo(dir) {
576
581
  let compiler = builtinCompiler;
577
582
  if (pkg && /^5\./.test(pkg.version)) {
578
583
  try {
579
- let checkTranslator = [].concat(Object.keys(pkg.dependencies), Object.keys(pkg.peerDependencies), Object.keys(pkg.devDependencies)).find((name) => /^marko$|^(@\/marko\/|marko-)translator-/.test(name));
584
+ let checkTranslator = [].concat(
585
+ Object.keys(pkg.dependencies),
586
+ Object.keys(pkg.peerDependencies),
587
+ Object.keys(pkg.devDependencies)
588
+ ).find((name) => /^marko$|^(@\/marko\/|marko-)translator-/.test(name));
580
589
  if (checkTranslator === "marko" || !checkTranslator) {
581
590
  checkTranslator = __require(resolveFrom(dir, "@marko/compiler/config")).translator;
582
591
  }
@@ -665,10 +674,13 @@ ${closingTagStr}`
665
674
  label: closingTagStr,
666
675
  kind: CompletionItemKind.Class,
667
676
  insertTextFormat: InsertTextFormat.Snippet,
668
- textEdit: TextEdit.replace(parsed.locationAt({
669
- start,
670
- end
671
- }), closingTagStr)
677
+ textEdit: TextEdit.replace(
678
+ parsed.locationAt({
679
+ start,
680
+ end
681
+ }),
682
+ closingTagStr
683
+ )
672
684
  }
673
685
  ];
674
686
  }
@@ -695,7 +707,9 @@ function getTagNameCompletion({
695
707
  let label = tag.isNestedTag ? `@${tag.name}` : tag.name;
696
708
  const fileForTag = tag.template || tag.renderer || tag.filePath;
697
709
  const fileURIForTag = URI2.file(fileForTag).toString();
698
- const nodeModuleMatch = /\/node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(fileForTag);
710
+ const nodeModuleMatch = /\/node_modules\/((?:@[^/]+\/)?[^/]+)/.exec(
711
+ fileForTag
712
+ );
699
713
  const nodeModuleName = nodeModuleMatch && nodeModuleMatch[1];
700
714
  const isCoreTag = /^@?marko[/-]/.test(tag.taglibId) || nodeModuleName === "marko";
701
715
  const documentation = {
@@ -758,12 +772,14 @@ function OpenTagName({
758
772
  for (const key in nestedTags) {
759
773
  if (key !== "*") {
760
774
  const tag2 = nestedTags[key];
761
- result.push(getTagNameCompletion({
762
- tag: tag2,
763
- range,
764
- importer,
765
- showAutoComplete: true
766
- }));
775
+ result.push(
776
+ getTagNameCompletion({
777
+ tag: tag2,
778
+ range,
779
+ importer,
780
+ showAutoComplete: true
781
+ })
782
+ );
767
783
  }
768
784
  }
769
785
  }
@@ -771,12 +787,14 @@ function OpenTagName({
771
787
  const skipStatements = !(tag.concise && tag.parent.type === 0 /* Program */);
772
788
  for (const tag2 of lookup.getTagsSorted()) {
773
789
  if (!(tag2.name === "*" || tag2.isNestedTag || skipStatements && ((_a = tag2.parseOptions) == null ? void 0 : _a.statement) || tag2.name[0] === "_" && /^@?marko[/-]|[\\/]node_modules[\\/]/.test(tag2.filePath))) {
774
- result.push(getTagNameCompletion({
775
- tag: tag2,
776
- range,
777
- importer,
778
- showAutoComplete: true
779
- }));
790
+ result.push(
791
+ getTagNameCompletion({
792
+ tag: tag2,
793
+ range,
794
+ importer,
795
+ showAutoComplete: true
796
+ })
797
+ );
780
798
  }
781
799
  }
782
800
  }
@@ -820,10 +838,12 @@ function AttrName({
820
838
  }
821
839
  }
822
840
  const completions = [];
823
- const attrNameLoc = parsed.locationAt(hasModifier ? {
824
- start: node.start,
825
- end: node.start + name.length
826
- } : node);
841
+ const attrNameLoc = parsed.locationAt(
842
+ hasModifier ? {
843
+ start: node.start,
844
+ end: node.start + name.length
845
+ } : node
846
+ );
827
847
  const tagName = node.parent.parent.nameText || "";
828
848
  const tagDef = tagName && lookup.getTag(tagName);
829
849
  const nestedTagAttrs = {};
@@ -961,7 +981,11 @@ async function readDirectory(uri) {
961
981
  try {
962
982
  const entries = await fs.readdir(fileURLToPath(uri));
963
983
  const base = uri.at(-1) === "/" ? uri : `${uri}/`;
964
- return (await Promise.all(entries.map(async (entry) => [entry, (await stat(new URL(entry, base).toString())).type]))).filter(([, type]) => type !== FileType.Unknown);
984
+ return (await Promise.all(
985
+ entries.map(
986
+ async (entry) => [entry, (await stat(new URL(entry, base).toString())).type]
987
+ )
988
+ )).filter(([, type]) => type !== FileType.Unknown);
965
989
  } catch {
966
990
  return [];
967
991
  }
@@ -1005,22 +1029,27 @@ async function AttrValue({
1005
1029
  if (uri) {
1006
1030
  const result = [];
1007
1031
  const curFile = req === "." ? path3.basename(document.uri) : void 0;
1008
- const replaceRange = Range2.create(document.positionAt(start + segmentStart + 1), document.positionAt(start + rawValue.length));
1032
+ const replaceRange = Range2.create(
1033
+ document.positionAt(start + segmentStart + 1),
1034
+ document.positionAt(start + rawValue.length)
1035
+ );
1009
1036
  for (const [entry, type] of await file_system_default.readDirectory(uri)) {
1010
1037
  if (entry[0] !== "." && entry !== curFile) {
1011
- result.push(type === FileType.Directory ? {
1012
- label: `${entry}/`,
1013
- kind: CompletionItemKind4.Folder,
1014
- textEdit: TextEdit4.replace(replaceRange, `${entry}/`),
1015
- command: {
1016
- title: "Suggest",
1017
- command: "editor.action.triggerSuggest"
1038
+ result.push(
1039
+ type === FileType.Directory ? {
1040
+ label: `${entry}/`,
1041
+ kind: CompletionItemKind4.Folder,
1042
+ textEdit: TextEdit4.replace(replaceRange, `${entry}/`),
1043
+ command: {
1044
+ title: "Suggest",
1045
+ command: "editor.action.triggerSuggest"
1046
+ }
1047
+ } : {
1048
+ label: entry,
1049
+ kind: CompletionItemKind4.File,
1050
+ textEdit: TextEdit4.replace(replaceRange, entry)
1018
1051
  }
1019
- } : {
1020
- label: entry,
1021
- kind: CompletionItemKind4.File,
1022
- textEdit: TextEdit4.replace(replaceRange, entry)
1023
- });
1052
+ );
1024
1053
  }
1025
1054
  }
1026
1055
  return result;
@@ -1080,20 +1109,23 @@ var doComplete = async (doc, params) => {
1080
1109
  const parsed = parse2(doc);
1081
1110
  const offset = doc.offsetAt(params.position);
1082
1111
  const node = parsed.nodeAt(offset);
1083
- return CompletionList.create(await ((_a = handlers[NodeType[node.type]]) == null ? void 0 : _a.call(handlers, {
1084
- document: doc,
1085
- params,
1086
- parsed,
1087
- offset,
1088
- node,
1089
- code: doc.getText(),
1090
- ...getCompilerInfo(doc)
1091
- })) || [], true);
1112
+ return CompletionList.create(
1113
+ await ((_a = handlers[NodeType[node.type]]) == null ? void 0 : _a.call(handlers, {
1114
+ document: doc,
1115
+ params,
1116
+ parsed,
1117
+ offset,
1118
+ node,
1119
+ code: doc.getText(),
1120
+ ...getCompilerInfo(doc)
1121
+ })) || [],
1122
+ true
1123
+ );
1092
1124
  };
1093
1125
 
1094
1126
  // src/service/marko/validate.ts
1095
- import { Diagnostic, DiagnosticSeverity, Range as Range3 } from "vscode-languageserver";
1096
- var markoErrorRegExp = /^(.+?)(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
1127
+ import { DiagnosticSeverity } from "vscode-languageserver";
1128
+ var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
1097
1129
  var doValidate = (doc) => {
1098
1130
  const fsPath = getDocFile(doc);
1099
1131
  const diagnostics = [];
@@ -1104,15 +1136,33 @@ var doValidate = (doc) => {
1104
1136
  translator,
1105
1137
  code: false,
1106
1138
  output: "source",
1107
- sourceMaps: false
1139
+ sourceMaps: false,
1140
+ babelConfig: {
1141
+ caller: {
1142
+ name: "@marko/language-server",
1143
+ supportsStaticESM: true,
1144
+ supportsDynamicImport: true,
1145
+ supportsTopLevelAwait: true,
1146
+ supportsExportNamespaceFrom: true
1147
+ }
1148
+ }
1108
1149
  });
1109
1150
  } catch (e) {
1110
1151
  let match;
1111
1152
  while (match = markoErrorRegExp.exec(e.message)) {
1112
- const [, fileName, rawLine, rawCol, msg] = match;
1113
- const line = (parseInt(rawLine, 10) || 1) - 1;
1114
- const col = (parseInt(rawCol, 10) || 1) - 1;
1115
- diagnostics.push(Diagnostic.create(Range3.create(line, col, line, col), msg, DiagnosticSeverity.Error, void 0, fileName));
1153
+ const [, , rawLine, rawCol, message] = match;
1154
+ const pos = {
1155
+ line: (parseInt(rawLine, 10) || 1) - 1,
1156
+ character: (parseInt(rawCol, 10) || 1) - 1
1157
+ };
1158
+ diagnostics.push({
1159
+ range: { start: pos, end: pos },
1160
+ source: "marko",
1161
+ code: void 0,
1162
+ tags: void 0,
1163
+ severity: DiagnosticSeverity.Error,
1164
+ message
1165
+ });
1116
1166
  }
1117
1167
  }
1118
1168
  return diagnostics;
@@ -1121,9 +1171,12 @@ var doValidate = (doc) => {
1121
1171
  // src/utils/utils.ts
1122
1172
  import fs2 from "fs";
1123
1173
  import { URI as URI3 } from "vscode-uri";
1124
- import { Position, Range as Range4 } from "vscode-languageserver";
1174
+ import { Position, Range as Range3 } from "vscode-languageserver";
1125
1175
  import { TextDocument } from "vscode-languageserver-textdocument";
1126
- var START_OF_FILE = Range4.create(Position.create(0, 0), Position.create(0, 0));
1176
+ var START_OF_FILE = Range3.create(
1177
+ Position.create(0, 0),
1178
+ Position.create(0, 0)
1179
+ );
1127
1180
  function createTextDocument(filename) {
1128
1181
  const uri = URI3.file(filename).toString();
1129
1182
  const content = fs2.readFileSync(filename, "utf-8");
@@ -1177,7 +1230,7 @@ var doHover = async (doc, params) => {
1177
1230
  // src/service/marko/definition/OpenTagName.ts
1178
1231
  import path4 from "path";
1179
1232
  import { URI as URI4 } from "vscode-uri";
1180
- import { Range as Range5, LocationLink } from "vscode-languageserver";
1233
+ import { Range as Range4, LocationLink } from "vscode-languageserver";
1181
1234
 
1182
1235
  // src/utils/regexp-builder.ts
1183
1236
  function RegExpBuilder(strings, ...expressions) {
@@ -1229,19 +1282,29 @@ function OpenTagName3({
1229
1282
  }
1230
1283
  if (/\/marko(?:-tag)?\.json$/.test(tagEntryFile)) {
1231
1284
  const tagDefDoc = createTextDocument(tagEntryFile);
1232
- const match = RegExpBuilder`/"(?:<${tag.nameText}>|${tag.nameText})"\s*:\s*[^\r\n,]+/g`.exec(tagDefDoc.getText());
1285
+ const match = RegExpBuilder`/"(?:<${tag.nameText}>|${tag.nameText})"\s*:\s*[^\r\n,]+/g`.exec(
1286
+ tagDefDoc.getText()
1287
+ );
1233
1288
  if (match && match.index) {
1234
- range = Range5.create(tagDefDoc.positionAt(match.index), tagDefDoc.positionAt(match.index + match[0].length));
1289
+ range = Range4.create(
1290
+ tagDefDoc.positionAt(match.index),
1291
+ tagDefDoc.positionAt(match.index + match[0].length)
1292
+ );
1235
1293
  }
1236
1294
  }
1237
1295
  return [
1238
- LocationLink.create(URI4.file(tagEntryFile).toString(), range, range, parsed.locationAt(node))
1296
+ LocationLink.create(
1297
+ URI4.file(tagEntryFile).toString(),
1298
+ range,
1299
+ range,
1300
+ parsed.locationAt(node)
1301
+ )
1239
1302
  ];
1240
1303
  }
1241
1304
 
1242
1305
  // src/service/marko/definition/AttrName.ts
1243
1306
  import { URI as URI5 } from "vscode-uri";
1244
- import { Range as Range6, LocationLink as LocationLink2 } from "vscode-languageserver";
1307
+ import { Range as Range5, LocationLink as LocationLink2 } from "vscode-languageserver";
1245
1308
  function AttrName2({
1246
1309
  lookup,
1247
1310
  parsed,
@@ -1263,13 +1326,23 @@ function AttrName2({
1263
1326
  }
1264
1327
  if (/\/marko(?:-tag)?\.json$/.test(attrEntryFile)) {
1265
1328
  const tagDefDoc = createTextDocument(attrEntryFile);
1266
- const match = RegExpBuilder`/"@${attrName}"\s*:\s*[^\r\n,]+/g`.exec(tagDefDoc.getText());
1329
+ const match = RegExpBuilder`/"@${attrName}"\s*:\s*[^\r\n,]+/g`.exec(
1330
+ tagDefDoc.getText()
1331
+ );
1267
1332
  if (match && match.index) {
1268
- range = Range6.create(tagDefDoc.positionAt(match.index), tagDefDoc.positionAt(match.index + match[0].length));
1333
+ range = Range5.create(
1334
+ tagDefDoc.positionAt(match.index),
1335
+ tagDefDoc.positionAt(match.index + match[0].length)
1336
+ );
1269
1337
  }
1270
1338
  }
1271
1339
  return [
1272
- LocationLink2.create(URI5.file(attrEntryFile).toString(), range, range, parsed.locationAt(node))
1340
+ LocationLink2.create(
1341
+ URI5.file(attrEntryFile).toString(),
1342
+ range,
1343
+ range,
1344
+ parsed.locationAt(node)
1345
+ )
1273
1346
  ];
1274
1347
  }
1275
1348
 
@@ -1329,9 +1402,17 @@ function extractDocumentLinks(doc, parsed, lookup) {
1329
1402
  if (node.attrs && node.nameText) {
1330
1403
  for (const attr of node.attrs) {
1331
1404
  if (isDocumentLinkAttr(doc, node, attr)) {
1332
- const resolved = resolveUrl(read(attr.value.value).slice(1, -1), doc.uri);
1405
+ const resolved = resolveUrl(
1406
+ read(attr.value.value).slice(1, -1),
1407
+ doc.uri
1408
+ );
1333
1409
  if (resolved) {
1334
- links.push(DocumentLink.create(parsed.locationAt(attr.value.value), resolveUrl(read(attr.value.value).slice(1, -1), doc.uri)));
1410
+ links.push(
1411
+ DocumentLink.create(
1412
+ parsed.locationAt(attr.value.value),
1413
+ resolveUrl(read(attr.value.value).slice(1, -1), doc.uri)
1414
+ )
1415
+ );
1335
1416
  }
1336
1417
  }
1337
1418
  }
@@ -1354,10 +1435,15 @@ function extractDocumentLinks(doc, parsed, lookup) {
1354
1435
  const tagDef = lookup.getTag(tagName);
1355
1436
  const fileForTag = tagDef && (tagDef.template || tagDef.renderer);
1356
1437
  if (fileForTag) {
1357
- links.push(DocumentLink.create(parsed.locationAt({
1358
- start: item.start + match.index,
1359
- end: item.start + match.index + length
1360
- }), fileForTag));
1438
+ links.push(
1439
+ DocumentLink.create(
1440
+ parsed.locationAt({
1441
+ start: item.start + match.index,
1442
+ end: item.start + match.index + length
1443
+ }),
1444
+ fileForTag
1445
+ )
1446
+ );
1361
1447
  }
1362
1448
  }
1363
1449
  }
@@ -1392,7 +1478,14 @@ function extractDocumentSymbols(doc, parsed, lookup) {
1392
1478
  switch (node.type) {
1393
1479
  case 1 /* Tag */:
1394
1480
  case 14 /* AttrTag */:
1395
- symbols.push(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) && SymbolKind.Property || SymbolKind.Class, parsed.locationAt(node), doc.uri));
1481
+ symbols.push(
1482
+ SymbolInformation.create(
1483
+ (node.type === 14 /* AttrTag */ ? (_a = node.nameText) == null ? void 0 : _a.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
1484
+ node.nameText && ((_b = lookup.getTag(node.nameText)) == null ? void 0 : _b.html) && SymbolKind.Property || SymbolKind.Class,
1485
+ parsed.locationAt(node),
1486
+ doc.uri
1487
+ )
1488
+ );
1396
1489
  if (node.body) {
1397
1490
  for (const child of node.body) {
1398
1491
  visit(child);
@@ -1408,7 +1501,7 @@ function extractDocumentSymbols(doc, parsed, lookup) {
1408
1501
  }
1409
1502
 
1410
1503
  // src/service/marko/format.ts
1411
- import { Range as Range7, TextEdit as TextEdit6 } from "vscode-languageserver";
1504
+ import { Range as Range6, TextEdit as TextEdit6 } from "vscode-languageserver";
1412
1505
  import { URI as URI8 } from "vscode-uri";
1413
1506
  import * as prettier from "prettier";
1414
1507
  import * as markoPrettier from "prettier-plugin-marko";
@@ -1429,7 +1522,10 @@ var format2 = async (doc, params, cancel) => {
1429
1522
  if (cancel.isCancellationRequested)
1430
1523
  return;
1431
1524
  return [
1432
- TextEdit6.replace(Range7.create(doc.positionAt(0), doc.positionAt(text.length)), prettier.format(text, options))
1525
+ TextEdit6.replace(
1526
+ Range6.create(doc.positionAt(0), doc.positionAt(text.length)),
1527
+ prettier.format(text, options)
1528
+ )
1433
1529
  ];
1434
1530
  } catch (e) {
1435
1531
  displayError(e);
@@ -1450,7 +1546,7 @@ var marko_default = {
1450
1546
  // src/service/stylesheet/index.ts
1451
1547
  import {
1452
1548
  CompletionList as CompletionList2,
1453
- Range as Range9,
1549
+ Range as Range8,
1454
1550
  TextDocumentEdit
1455
1551
  } from "vscode-languageserver";
1456
1552
  import {
@@ -1645,12 +1741,21 @@ var StyleSheetService = {
1645
1741
  if (generatedOffset === void 0)
1646
1742
  continue;
1647
1743
  const { service: service2, virtualDoc } = info;
1648
- const result = await service2.doComplete2(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed, { resolveReference: resolveUrl });
1744
+ const result = await service2.doComplete2(
1745
+ virtualDoc,
1746
+ virtualDoc.positionAt(generatedOffset),
1747
+ info.parsed,
1748
+ { resolveReference: resolveUrl }
1749
+ );
1649
1750
  if (result.itemDefaults) {
1650
1751
  const { editRange } = result.itemDefaults;
1651
1752
  if (editRange) {
1652
1753
  if ("start" in editRange) {
1653
- result.itemDefaults.editRange = getSourceRange(doc, info, editRange);
1754
+ result.itemDefaults.editRange = getSourceRange(
1755
+ doc,
1756
+ info,
1757
+ editRange
1758
+ );
1654
1759
  } else {
1655
1760
  editRange.insert = getSourceRange(doc, info, editRange.insert);
1656
1761
  editRange.replace = getSourceRange(doc, info, editRange.replace);
@@ -1662,7 +1767,11 @@ var StyleSheetService = {
1662
1767
  item.textEdit = getSourceInsertReplaceEdit(doc, info, item.textEdit);
1663
1768
  }
1664
1769
  if (item.additionalTextEdits) {
1665
- item.additionalTextEdits = getSourceEdits(doc, info, item.additionalTextEdits);
1770
+ item.additionalTextEdits = getSourceEdits(
1771
+ doc,
1772
+ info,
1773
+ item.additionalTextEdits
1774
+ );
1666
1775
  }
1667
1776
  }
1668
1777
  return result;
@@ -1678,7 +1787,11 @@ var StyleSheetService = {
1678
1787
  if (generatedOffset === void 0)
1679
1788
  continue;
1680
1789
  const { service: service2, virtualDoc } = info;
1681
- const result = service2.findDefinition(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed);
1790
+ const result = service2.findDefinition(
1791
+ virtualDoc,
1792
+ virtualDoc.positionAt(generatedOffset),
1793
+ info.parsed
1794
+ );
1682
1795
  if (result) {
1683
1796
  const range = getSourceRange(doc, info, result.range);
1684
1797
  if (range) {
@@ -1701,7 +1814,11 @@ var StyleSheetService = {
1701
1814
  continue;
1702
1815
  const { service: service2, virtualDoc } = info;
1703
1816
  const result = [];
1704
- for (const location of service2.findReferences(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed)) {
1817
+ for (const location of service2.findReferences(
1818
+ virtualDoc,
1819
+ virtualDoc.positionAt(generatedOffset),
1820
+ info.parsed
1821
+ )) {
1705
1822
  const range = getSourceRange(doc, info, location.range);
1706
1823
  if (range) {
1707
1824
  result.push({
@@ -1719,7 +1836,10 @@ var StyleSheetService = {
1719
1836
  for (const ext in infoByExt) {
1720
1837
  const info = infoByExt[ext];
1721
1838
  const { service: service2, virtualDoc } = info;
1722
- for (const symbol of service2.findDocumentSymbols(virtualDoc, info.parsed)) {
1839
+ for (const symbol of service2.findDocumentSymbols(
1840
+ virtualDoc,
1841
+ info.parsed
1842
+ )) {
1723
1843
  if (symbol.location.uri === doc.uri) {
1724
1844
  const range = getSourceRange(doc, info, symbol.location.range);
1725
1845
  if (range) {
@@ -1745,7 +1865,11 @@ var StyleSheetService = {
1745
1865
  for (const ext in infoByExt) {
1746
1866
  const info = infoByExt[ext];
1747
1867
  const { service: service2, virtualDoc } = info;
1748
- for (const link of await service2.findDocumentLinks2(virtualDoc, info.parsed, { resolveReference: resolveUrl })) {
1868
+ for (const link of await service2.findDocumentLinks2(
1869
+ virtualDoc,
1870
+ info.parsed,
1871
+ { resolveReference: resolveUrl }
1872
+ )) {
1749
1873
  const range = getSourceRange(doc, info, link.range);
1750
1874
  if (range) {
1751
1875
  result.push({
@@ -1769,7 +1893,11 @@ var StyleSheetService = {
1769
1893
  continue;
1770
1894
  const { service: service2, virtualDoc } = info;
1771
1895
  const result = [];
1772
- for (const highlight of service2.findDocumentHighlights(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed)) {
1896
+ for (const highlight of service2.findDocumentHighlights(
1897
+ virtualDoc,
1898
+ virtualDoc.positionAt(generatedOffset),
1899
+ info.parsed
1900
+ )) {
1773
1901
  const range = getSourceRange(doc, info, highlight.range);
1774
1902
  if (range) {
1775
1903
  result.push({
@@ -1787,7 +1915,10 @@ var StyleSheetService = {
1787
1915
  for (const ext in infoByExt) {
1788
1916
  const info = infoByExt[ext];
1789
1917
  const { service: service2, virtualDoc } = info;
1790
- for (const colorInfo of service2.findDocumentColors(virtualDoc, info.parsed)) {
1918
+ for (const colorInfo of service2.findDocumentColors(
1919
+ virtualDoc,
1920
+ info.parsed
1921
+ )) {
1791
1922
  const range = getSourceRange(doc, info, colorInfo.range);
1792
1923
  if (range) {
1793
1924
  result.push({
@@ -1807,12 +1938,22 @@ var StyleSheetService = {
1807
1938
  const generatedOffsetStart = info.generatedOffsetAt(sourceOffset);
1808
1939
  if (generatedOffsetStart === void 0)
1809
1940
  continue;
1810
- const generatedOffsetEnd = info.generatedOffsetAt(doc.offsetAt(params.range.end));
1941
+ const generatedOffsetEnd = info.generatedOffsetAt(
1942
+ doc.offsetAt(params.range.end)
1943
+ );
1811
1944
  if (generatedOffsetEnd === void 0)
1812
1945
  continue;
1813
1946
  const { service: service2, virtualDoc } = info;
1814
1947
  const result = [];
1815
- for (const colorPresentation of service2.getColorPresentations(virtualDoc, info.parsed, params.color, Range9.create(virtualDoc.positionAt(generatedOffsetStart), virtualDoc.positionAt(generatedOffsetEnd)))) {
1948
+ for (const colorPresentation of service2.getColorPresentations(
1949
+ virtualDoc,
1950
+ info.parsed,
1951
+ params.color,
1952
+ Range8.create(
1953
+ virtualDoc.positionAt(generatedOffsetStart),
1954
+ virtualDoc.positionAt(generatedOffsetEnd)
1955
+ )
1956
+ )) {
1816
1957
  const textEdit = colorPresentation.textEdit && getSourceEdit(doc, info, colorPresentation.textEdit);
1817
1958
  const additionalTextEdits = colorPresentation.additionalTextEdits && getSourceEdits(doc, info, colorPresentation.additionalTextEdits);
1818
1959
  if (textEdit || additionalTextEdits) {
@@ -1835,7 +1976,11 @@ var StyleSheetService = {
1835
1976
  if (generatedOffset === void 0)
1836
1977
  continue;
1837
1978
  const { service: service2, virtualDoc } = info;
1838
- const result = service2.doHover(virtualDoc, virtualDoc.positionAt(generatedOffset), info.parsed);
1979
+ const result = service2.doHover(
1980
+ virtualDoc,
1981
+ virtualDoc.positionAt(generatedOffset),
1982
+ info.parsed
1983
+ );
1839
1984
  if (result) {
1840
1985
  if (result.range) {
1841
1986
  const range = getSourceRange(doc, info, result.range);
@@ -1860,7 +2005,12 @@ var StyleSheetService = {
1860
2005
  if (generatedOffset === void 0)
1861
2006
  continue;
1862
2007
  const { service: service2, virtualDoc } = info;
1863
- const result = service2.doRename(virtualDoc, virtualDoc.positionAt(generatedOffset), params.newName, info.parsed);
2008
+ const result = service2.doRename(
2009
+ virtualDoc,
2010
+ virtualDoc.positionAt(generatedOffset),
2011
+ params.newName,
2012
+ info.parsed
2013
+ );
1864
2014
  if (result.changes) {
1865
2015
  for (const uri in result.changes) {
1866
2016
  if (uri === doc.uri) {
@@ -1889,11 +2039,21 @@ var StyleSheetService = {
1889
2039
  const generatedOffsetStart = info.generatedOffsetAt(sourceOffset);
1890
2040
  if (generatedOffsetStart === void 0)
1891
2041
  continue;
1892
- const generatedOffsetEnd = info.generatedOffsetAt(doc.offsetAt(params.range.end));
2042
+ const generatedOffsetEnd = info.generatedOffsetAt(
2043
+ doc.offsetAt(params.range.end)
2044
+ );
1893
2045
  if (generatedOffsetEnd === void 0)
1894
2046
  continue;
1895
2047
  const { service: service2, virtualDoc } = info;
1896
- const result = service2.doCodeActions(virtualDoc, Range9.create(virtualDoc.positionAt(generatedOffsetStart), virtualDoc.positionAt(generatedOffsetEnd)), params.context, info.parsed);
2048
+ const result = service2.doCodeActions(
2049
+ virtualDoc,
2050
+ Range8.create(
2051
+ virtualDoc.positionAt(generatedOffsetStart),
2052
+ virtualDoc.positionAt(generatedOffsetEnd)
2053
+ ),
2054
+ params.context,
2055
+ info.parsed
2056
+ );
1897
2057
  for (const command of result) {
1898
2058
  const edits = (_a = command.arguments) == null ? void 0 : _a[2];
1899
2059
  if (edits && Array.isArray(edits) && isTextEdit(edits[0])) {
@@ -1908,7 +2068,10 @@ var StyleSheetService = {
1908
2068
  const result = [];
1909
2069
  for (const ext in infoByExt) {
1910
2070
  const info = infoByExt[ext];
1911
- for (const diag of info.service.doValidation(info.virtualDoc, info.parsed)) {
2071
+ for (const diag of info.service.doValidation(
2072
+ info.virtualDoc,
2073
+ info.parsed
2074
+ )) {
1912
2075
  const range = getSourceRange(doc, info, diag.range);
1913
2076
  if (range) {
1914
2077
  diag.range = range;
@@ -1980,7 +2143,11 @@ function getStyleSheetInfo(doc) {
1980
2143
  const parsed = parse2(doc);
1981
2144
  let cached = cache3.get(parsed);
1982
2145
  if (!cached) {
1983
- const results = extractStyleSheets(doc.getText(), parsed.program, getCompilerInfo(doc).lookup);
2146
+ const results = extractStyleSheets(
2147
+ doc.getText(),
2148
+ parsed.program,
2149
+ getCompilerInfo(doc).lookup
2150
+ );
1984
2151
  cached = {};
1985
2152
  for (const ext in results) {
1986
2153
  const service2 = (_a = services[ext]) == null ? void 0 : _a.call(services, {
@@ -1990,7 +2157,12 @@ function getStyleSheetInfo(doc) {
1990
2157
  if (!service2)
1991
2158
  continue;
1992
2159
  const { generated, sourceOffsetAt, generatedOffsetAt } = results[ext];
1993
- const virtualDoc = TextDocument2.create(doc.uri, "css", doc.version, generated);
2160
+ const virtualDoc = TextDocument2.create(
2161
+ doc.uri,
2162
+ "css",
2163
+ doc.version,
2164
+ generated
2165
+ );
1994
2166
  cached[ext] = {
1995
2167
  service: service2,
1996
2168
  virtualDoc,
@@ -2020,10 +2192,12 @@ var service = {
2020
2192
  let items;
2021
2193
  let isIncomplete = false;
2022
2194
  try {
2023
- for (const pending of plugins.map((plugin) => {
2024
- var _a;
2025
- return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2026
- })) {
2195
+ for (const pending of plugins.map(
2196
+ (plugin) => {
2197
+ var _a;
2198
+ return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2199
+ }
2200
+ )) {
2027
2201
  const cur = await pending;
2028
2202
  if (cancel.isCancellationRequested)
2029
2203
  return;
@@ -2049,10 +2223,12 @@ var service = {
2049
2223
  async findDefinition(doc, params, cancel) {
2050
2224
  let result;
2051
2225
  try {
2052
- for (const pending of plugins.map((plugin) => {
2053
- var _a;
2054
- return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2055
- })) {
2226
+ for (const pending of plugins.map(
2227
+ (plugin) => {
2228
+ var _a;
2229
+ return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2230
+ }
2231
+ )) {
2056
2232
  const cur = await pending;
2057
2233
  if (cancel.isCancellationRequested)
2058
2234
  return;
@@ -2067,10 +2243,12 @@ var service = {
2067
2243
  async findReferences(doc, params, cancel) {
2068
2244
  let result;
2069
2245
  try {
2070
- for (const pending of plugins.map((plugin) => {
2071
- var _a;
2072
- return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2073
- })) {
2246
+ for (const pending of plugins.map(
2247
+ (plugin) => {
2248
+ var _a;
2249
+ return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2250
+ }
2251
+ )) {
2074
2252
  const cur = await pending;
2075
2253
  if (cancel.isCancellationRequested)
2076
2254
  return;
@@ -2085,10 +2263,12 @@ var service = {
2085
2263
  async findDocumentSymbols(doc, params, cancel) {
2086
2264
  let result;
2087
2265
  try {
2088
- for (const pending of plugins.map((plugin) => {
2089
- var _a;
2090
- return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2091
- })) {
2266
+ for (const pending of plugins.map(
2267
+ (plugin) => {
2268
+ var _a;
2269
+ return (_a = plugin.findDocumentSymbols) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2270
+ }
2271
+ )) {
2092
2272
  const cur = await pending;
2093
2273
  if (cancel.isCancellationRequested)
2094
2274
  return;
@@ -2103,10 +2283,12 @@ var service = {
2103
2283
  async findDocumentLinks(doc, params, cancel) {
2104
2284
  let result;
2105
2285
  try {
2106
- for (const pending of plugins.map((plugin) => {
2107
- var _a;
2108
- return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2109
- })) {
2286
+ for (const pending of plugins.map(
2287
+ (plugin) => {
2288
+ var _a;
2289
+ return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2290
+ }
2291
+ )) {
2110
2292
  const cur = await pending;
2111
2293
  if (cancel.isCancellationRequested)
2112
2294
  return;
@@ -2121,10 +2303,12 @@ var service = {
2121
2303
  async findDocumentHighlights(doc, params, cancel) {
2122
2304
  let result;
2123
2305
  try {
2124
- for (const pending of plugins.map((plugin) => {
2125
- var _a;
2126
- return (_a = plugin.findDocumentHighlights) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2127
- })) {
2306
+ for (const pending of plugins.map(
2307
+ (plugin) => {
2308
+ var _a;
2309
+ return (_a = plugin.findDocumentHighlights) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2310
+ }
2311
+ )) {
2128
2312
  const cur = await pending;
2129
2313
  if (cancel.isCancellationRequested)
2130
2314
  return;
@@ -2139,10 +2323,12 @@ var service = {
2139
2323
  async findDocumentColors(doc, params, cancel) {
2140
2324
  let result;
2141
2325
  try {
2142
- for (const pending of plugins.map((plugin) => {
2143
- var _a;
2144
- return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2145
- })) {
2326
+ for (const pending of plugins.map(
2327
+ (plugin) => {
2328
+ var _a;
2329
+ return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2330
+ }
2331
+ )) {
2146
2332
  const cur = await pending;
2147
2333
  if (cancel.isCancellationRequested)
2148
2334
  return;
@@ -2157,10 +2343,12 @@ var service = {
2157
2343
  async getColorPresentations(doc, params, cancel) {
2158
2344
  let result;
2159
2345
  try {
2160
- for (const pending of plugins.map((plugin) => {
2161
- var _a;
2162
- return (_a = plugin.getColorPresentations) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2163
- })) {
2346
+ for (const pending of plugins.map(
2347
+ (plugin) => {
2348
+ var _a;
2349
+ return (_a = plugin.getColorPresentations) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2350
+ }
2351
+ )) {
2164
2352
  const cur = await pending;
2165
2353
  if (cancel.isCancellationRequested)
2166
2354
  return;
@@ -2191,10 +2379,12 @@ var service = {
2191
2379
  let changeAnnotations;
2192
2380
  let documentChanges;
2193
2381
  try {
2194
- for (const pending of plugins.map((plugin) => {
2195
- var _a;
2196
- return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2197
- })) {
2382
+ for (const pending of plugins.map(
2383
+ (plugin) => {
2384
+ var _a;
2385
+ return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2386
+ }
2387
+ )) {
2198
2388
  const cur = await pending;
2199
2389
  if (cancel.isCancellationRequested)
2200
2390
  return;
@@ -2234,10 +2424,12 @@ var service = {
2234
2424
  async doCodeActions(doc, params, cancel) {
2235
2425
  let result;
2236
2426
  try {
2237
- for (const pending of plugins.map((plugin) => {
2238
- var _a;
2239
- return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2240
- })) {
2427
+ for (const pending of plugins.map(
2428
+ (plugin) => {
2429
+ var _a;
2430
+ return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
2431
+ }
2432
+ )) {
2241
2433
  const cur = await pending;
2242
2434
  if (cancel.isCancellationRequested)
2243
2435
  return;
@@ -2335,40 +2527,88 @@ documents.onDidChangeContent(({ document }) => {
2335
2527
  clearCompilerCache(document);
2336
2528
  });
2337
2529
  connection2.onCompletion(async (params, cancel) => {
2338
- return await service.doComplete(documents.get(params.textDocument.uri), params, cancel) || null;
2530
+ return await service.doComplete(
2531
+ documents.get(params.textDocument.uri),
2532
+ params,
2533
+ cancel
2534
+ ) || null;
2339
2535
  });
2340
2536
  connection2.onDefinition(async (params, cancel) => {
2341
- return await service.findDefinition(documents.get(params.textDocument.uri), params, cancel) || null;
2537
+ return await service.findDefinition(
2538
+ documents.get(params.textDocument.uri),
2539
+ params,
2540
+ cancel
2541
+ ) || null;
2342
2542
  });
2343
2543
  connection2.onReferences(async (params, cancel) => {
2344
- return await service.findReferences(documents.get(params.textDocument.uri), params, cancel) || null;
2544
+ return await service.findReferences(
2545
+ documents.get(params.textDocument.uri),
2546
+ params,
2547
+ cancel
2548
+ ) || null;
2345
2549
  });
2346
2550
  connection2.onDocumentLinks(async (params, cancel) => {
2347
- return await service.findDocumentLinks(documents.get(params.textDocument.uri), params, cancel) || null;
2551
+ return await service.findDocumentLinks(
2552
+ documents.get(params.textDocument.uri),
2553
+ params,
2554
+ cancel
2555
+ ) || null;
2348
2556
  });
2349
2557
  connection2.onDocumentSymbol(async (params, cancel) => {
2350
- return await service.findDocumentSymbols(documents.get(params.textDocument.uri), params, cancel) || null;
2558
+ return await service.findDocumentSymbols(
2559
+ documents.get(params.textDocument.uri),
2560
+ params,
2561
+ cancel
2562
+ ) || null;
2351
2563
  });
2352
2564
  connection2.onDocumentHighlight(async (params, cancel) => {
2353
- return await service.findDocumentHighlights(documents.get(params.textDocument.uri), params, cancel) || null;
2565
+ return await service.findDocumentHighlights(
2566
+ documents.get(params.textDocument.uri),
2567
+ params,
2568
+ cancel
2569
+ ) || null;
2354
2570
  });
2355
2571
  connection2.onDocumentColor(async (params, cancel) => {
2356
- return await service.findDocumentColors(documents.get(params.textDocument.uri), params, cancel) || null;
2572
+ return await service.findDocumentColors(
2573
+ documents.get(params.textDocument.uri),
2574
+ params,
2575
+ cancel
2576
+ ) || null;
2357
2577
  });
2358
2578
  connection2.onColorPresentation(async (params, cancel) => {
2359
- return await service.getColorPresentations(documents.get(params.textDocument.uri), params, cancel) || null;
2579
+ return await service.getColorPresentations(
2580
+ documents.get(params.textDocument.uri),
2581
+ params,
2582
+ cancel
2583
+ ) || null;
2360
2584
  });
2361
2585
  connection2.onHover(async (params, cancel) => {
2362
- return await service.doHover(documents.get(params.textDocument.uri), params, cancel) || null;
2586
+ return await service.doHover(
2587
+ documents.get(params.textDocument.uri),
2588
+ params,
2589
+ cancel
2590
+ ) || null;
2363
2591
  });
2364
2592
  connection2.onRenameRequest(async (params, cancel) => {
2365
- return await service.doRename(documents.get(params.textDocument.uri), params, cancel) || null;
2593
+ return await service.doRename(
2594
+ documents.get(params.textDocument.uri),
2595
+ params,
2596
+ cancel
2597
+ ) || null;
2366
2598
  });
2367
2599
  connection2.onCodeAction(async (params, cancel) => {
2368
- return await service.doCodeActions(documents.get(params.textDocument.uri), params, cancel) || null;
2600
+ return await service.doCodeActions(
2601
+ documents.get(params.textDocument.uri),
2602
+ params,
2603
+ cancel
2604
+ ) || null;
2369
2605
  });
2370
2606
  connection2.onDocumentFormatting(async (params, cancel) => {
2371
- return await service.format(documents.get(params.textDocument.uri), params, cancel) || null;
2607
+ return await service.format(
2608
+ documents.get(params.textDocument.uri),
2609
+ params,
2610
+ cancel
2611
+ ) || null;
2372
2612
  });
2373
2613
  function validateDocs() {
2374
2614
  queueDiagnostic();
@@ -2380,15 +2620,17 @@ function validateDocs() {
2380
2620
  function queueDiagnostic() {
2381
2621
  clearTimeout(diagnosticTimeout);
2382
2622
  const id = diagnosticTimeout = setTimeout(async () => {
2383
- const results = await Promise.all(documents.all().map(async (doc) => {
2384
- if (!pendingDiags.delete(doc))
2385
- return;
2386
- const prevDiag = prevDiags.get(doc) || [];
2387
- const nextDiag = await service.doValidate(doc) || [];
2388
- if (isDeepStrictEqual(prevDiag, nextDiag))
2389
- return;
2390
- return [doc, nextDiag];
2391
- }));
2623
+ const results = await Promise.all(
2624
+ documents.all().map(async (doc) => {
2625
+ if (!pendingDiags.delete(doc))
2626
+ return;
2627
+ const prevDiag = prevDiags.get(doc) || [];
2628
+ const nextDiag = await service.doValidate(doc) || [];
2629
+ if (isDeepStrictEqual(prevDiag, nextDiag))
2630
+ return;
2631
+ return [doc, nextDiag];
2632
+ })
2633
+ );
2392
2634
  if (id === diagnosticTimeout) {
2393
2635
  for (const result of results) {
2394
2636
  if (result) {