@marko/language-server 1.2.1 → 1.3.0

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
@@ -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();
@@ -897,8 +893,7 @@ var HTMLService = {
897
893
  commands: {
898
894
  "$/showHtmlOutput": async (uri) => {
899
895
  const doc = get(uri);
900
- if (!doc)
901
- return;
896
+ if (!doc) return;
902
897
  const { extracted } = extract(doc);
903
898
  return {
904
899
  language: "html",
@@ -928,8 +923,7 @@ var HTMLService = {
928
923
  return violations.flatMap((result) => {
929
924
  var _a;
930
925
  const { element } = result;
931
- if (!element)
932
- return [];
926
+ if (!element) return [];
933
927
  const ruleId = result.ruleId;
934
928
  if (element.dataset.markoNodeId) {
935
929
  const details = nodeDetails[element.dataset.markoNodeId];
@@ -940,14 +934,12 @@ var HTMLService = {
940
934
  }
941
935
  }
942
936
  const generatedLoc = jsdom.nodeLocation(element);
943
- if (!generatedLoc)
944
- return [];
937
+ if (!generatedLoc) return [];
945
938
  const sourceRange = extracted.sourceLocationAt(
946
939
  generatedLoc.startOffset + 1,
947
940
  generatedLoc.startOffset + 1 + element.tagName.length
948
941
  );
949
- if (!sourceRange)
950
- return [];
942
+ if (!sourceRange) return [];
951
943
  return [
952
944
  {
953
945
  range: sourceRange,
@@ -1130,10 +1122,8 @@ async function stat(uri) {
1130
1122
  let size = -1;
1131
1123
  try {
1132
1124
  const stat2 = await import_promises.default.stat((0, import_url.fileURLToPath)(uri));
1133
- if (stat2.isDirectory())
1134
- type = import_vscode_css_languageservice.FileType.Directory;
1135
- else if (stat2.isFile())
1136
- type = import_vscode_css_languageservice.FileType.File;
1125
+ if (stat2.isDirectory()) type = import_vscode_css_languageservice.FileType.Directory;
1126
+ else if (stat2.isFile()) type = import_vscode_css_languageservice.FileType.File;
1137
1127
  ctime = stat2.ctimeMs;
1138
1128
  mtime = stat2.mtimeMs;
1139
1129
  size = stat2.size;
@@ -1165,8 +1155,7 @@ async function readDirectory(uri) {
1165
1155
  function resolveUrl(to, base) {
1166
1156
  try {
1167
1157
  const url = new URL(to, base);
1168
- if (url.protocol === "file:")
1169
- return url.toString();
1158
+ if (url.protocol === "file:") return url.toString();
1170
1159
  } catch {
1171
1160
  return void 0;
1172
1161
  }
@@ -1181,8 +1170,7 @@ async function AttrValue({
1181
1170
  const attr = node.parent;
1182
1171
  if (isDocumentLinkAttr(code, attr.parent, attr)) {
1183
1172
  const start = node.value.start + 1;
1184
- if (code[start] !== ".")
1185
- return;
1173
+ if (code[start] !== ".") return;
1186
1174
  const end = node.value.end - 1;
1187
1175
  const relativeOffset = offset - start;
1188
1176
  const rawValue = parsed.read({
@@ -1190,8 +1178,7 @@ async function AttrValue({
1190
1178
  end
1191
1179
  });
1192
1180
  const segmentStart = rawValue.lastIndexOf("/", relativeOffset);
1193
- if (segmentStart === -1)
1194
- return;
1181
+ if (segmentStart === -1) return;
1195
1182
  const req = rawValue.slice(0, segmentStart);
1196
1183
  const resolved = resolveUrl(req, uri);
1197
1184
  if (resolved) {
@@ -1286,7 +1273,7 @@ ${autocomplete.description}`;
1286
1273
  }
1287
1274
 
1288
1275
  // src/service/marko/complete/Import.ts
1289
- var importTagReg = /(['"])<((?:[^\1\\>]+|\\.)*)>?\1/;
1276
+ var importTagReg = /(['"])<((?:[^'"\\>]+|\\.)*)>?\1/;
1290
1277
  function Import({
1291
1278
  node,
1292
1279
  file: { parsed, filename, lookup }
@@ -1330,8 +1317,7 @@ function OpenTagName({
1330
1317
  const result = [];
1331
1318
  if (isAttrTag) {
1332
1319
  let parentTag = tag.owner;
1333
- while ((parentTag == null ? void 0 : parentTag.type) === import_language_tools5.NodeType.AttrTag)
1334
- parentTag = parentTag.owner;
1320
+ while ((parentTag == null ? void 0 : parentTag.type) === import_language_tools5.NodeType.AttrTag) parentTag = parentTag.owner;
1335
1321
  const parentTagDef = parentTag && parentTag.nameText && lookup.getTag(parentTag.nameText);
1336
1322
  if (parentTagDef) {
1337
1323
  const { nestedTags } = parentTagDef;
@@ -1377,8 +1363,7 @@ function Tag({
1377
1363
  file: { parsed, code }
1378
1364
  }) {
1379
1365
  const isClosed = node.end !== import_language_tools6.UNFINISHED;
1380
- if (isClosed || node.concise)
1381
- return;
1366
+ if (isClosed || node.concise) return;
1382
1367
  const closingTagStr = `</${node.nameText || ""}>`;
1383
1368
  if (offset === node.open.end) {
1384
1369
  return [
@@ -1533,8 +1518,7 @@ function OpenTagName2({
1533
1518
  let range = START_LOCATION;
1534
1519
  if (tag.type === import_language_tools9.NodeType.AttrTag) {
1535
1520
  let parentTag = tag.owner;
1536
- while ((parentTag == null ? void 0 : parentTag.type) === import_language_tools9.NodeType.AttrTag)
1537
- parentTag = parentTag.owner;
1521
+ while ((parentTag == null ? void 0 : parentTag.type) === import_language_tools9.NodeType.AttrTag) parentTag = parentTag.owner;
1538
1522
  tagDef = parentTag && parentTag.nameText ? lookup.getTag(parentTag.nameText) : void 0;
1539
1523
  } else {
1540
1524
  tagDef = tag.nameText ? lookup.getTag(tag.nameText) : void 0;
@@ -1589,7 +1573,7 @@ var findDefinition = async (doc, params) => {
1589
1573
 
1590
1574
  // src/service/marko/document-links.ts
1591
1575
  var import_language_tools11 = require("@marko/language-tools");
1592
- var importTagReg2 = /(['"])<((?:[^\1\\>]+|\\.)*)>?\1/g;
1576
+ var importTagReg2 = /(['"])<((?:[^'"\\>]+|\\.)*)>?\1/g;
1593
1577
  var findDocumentLinks = async (doc) => {
1594
1578
  return processDoc(doc, extractDocumentLinks);
1595
1579
  };
@@ -1730,8 +1714,7 @@ async function formatDocument(doc, formatOptions, cancel) {
1730
1714
  }).catch(() => null) : null
1731
1715
  };
1732
1716
  markoPrettier.setCompiler(import_language_tools13.Project.getCompiler(dir), import_language_tools13.Project.getConfig(dir));
1733
- if (cancel == null ? void 0 : cancel.isCancellationRequested)
1734
- return;
1717
+ if (cancel == null ? void 0 : cancel.isCancellationRequested) return;
1735
1718
  return [
1736
1719
  import_vscode_languageserver8.TextEdit.replace(
1737
1720
  {
@@ -1885,8 +1868,7 @@ function addDiagnosticsForError(err, diagnostics) {
1885
1868
  }
1886
1869
  } else if (isErrorWithLoc(err)) {
1887
1870
  const message = err.label || err.message || err.stack;
1888
- if (!message)
1889
- return;
1871
+ if (!message) return;
1890
1872
  const { loc } = err;
1891
1873
  diagnostics.push({
1892
1874
  range: {
@@ -1932,8 +1914,7 @@ function isAggregateError(err) {
1932
1914
  }
1933
1915
  function isErrorWithLoc(err) {
1934
1916
  const loc = err == null ? void 0 : err.loc;
1935
- if (typeof loc !== "object")
1936
- return false;
1917
+ if (typeof loc !== "object") return false;
1937
1918
  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
1919
  }
1939
1920
 
@@ -2002,8 +1983,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
2002
1983
  if (getScriptKind) {
2003
1984
  host.getScriptKind = (fileName) => {
2004
1985
  const processor = getProcessor(fileName);
2005
- if (processor)
2006
- return processor.getScriptKind(fileName);
1986
+ if (processor) return processor.getScriptKind(fileName);
2007
1987
  return getScriptKind(fileName);
2008
1988
  };
2009
1989
  }
@@ -2031,8 +2011,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
2031
2011
  const getScriptVersion = host.getScriptVersion.bind(host);
2032
2012
  host.getScriptVersion = (fileName) => {
2033
2013
  const processor = getProcessor(fileName);
2034
- if (processor)
2035
- return host.getProjectVersion();
2014
+ if (processor) return host.getProjectVersion();
2036
2015
  return getScriptVersion(fileName);
2037
2016
  };
2038
2017
  }
@@ -2169,8 +2148,7 @@ function printJSDocTag(tag) {
2169
2148
  }
2170
2149
  case "return":
2171
2150
  case "returns": {
2172
- if (!((_a = tag.text) == null ? void 0 : _a.length))
2173
- return void 0;
2151
+ if (!((_a = tag.text) == null ? void 0 : _a.length)) return void 0;
2174
2152
  break;
2175
2153
  }
2176
2154
  }
@@ -2188,8 +2166,7 @@ function getTagBodyParts(tag) {
2188
2166
  return convertLinkTags(tag.text).split(/^(\S+)\s*-?\s*/);
2189
2167
  }
2190
2168
  function getTagBodyText(tag) {
2191
- if (!tag.text)
2192
- return "";
2169
+ if (!tag.text) return "";
2193
2170
  const text = convertLinkTags(tag.text);
2194
2171
  switch (tag.name) {
2195
2172
  case "example": {
@@ -2217,10 +2194,8 @@ ${ensureCodeblock(
2217
2194
  return replaceLinks(text);
2218
2195
  }
2219
2196
  function convertLinkTags(parts) {
2220
- if (!parts)
2221
- return "";
2222
- if (typeof parts === "string")
2223
- return parts;
2197
+ if (!parts) return "";
2198
+ if (typeof parts === "string") return parts;
2224
2199
  let result = "";
2225
2200
  let currentLink;
2226
2201
  for (const part of parts) {
@@ -2340,11 +2315,9 @@ var ScriptService = {
2340
2315
  commands: {
2341
2316
  "$/showScriptOutput": async (uri) => {
2342
2317
  const doc = get(uri);
2343
- if ((doc == null ? void 0 : doc.languageId) !== "marko")
2344
- return;
2318
+ if ((doc == null ? void 0 : doc.languageId) !== "marko") return;
2345
2319
  const filename = getFSPath(doc);
2346
- if (!filename)
2347
- return;
2320
+ if (!filename) return;
2348
2321
  const tsProject = getTSProject(filename);
2349
2322
  const extracted = processScript(doc, tsProject);
2350
2323
  const lang = import_language_tools17.Project.getScriptLang(
@@ -2381,14 +2354,12 @@ var ScriptService = {
2381
2354
  async doComplete(doc, params) {
2382
2355
  var _a;
2383
2356
  const fileName = getFSPath(doc);
2384
- if (!fileName)
2385
- return;
2357
+ if (!fileName) return;
2386
2358
  const project = getTSProject(fileName);
2387
2359
  const extracted = processScript(doc, project);
2388
2360
  const sourceOffset = doc.offsetAt(params.position);
2389
2361
  const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
2390
- if (generatedOffset === void 0)
2391
- return;
2362
+ if (generatedOffset === void 0) return;
2392
2363
  const completions = project.service.getCompletionsAtPosition(
2393
2364
  fileName,
2394
2365
  generatedOffset,
@@ -2398,13 +2369,11 @@ var ScriptService = {
2398
2369
  triggerCharacter: getTSTriggerChar((_a = params.context) == null ? void 0 : _a.triggerCharacter)
2399
2370
  }
2400
2371
  );
2401
- if (!(completions == null ? void 0 : completions.entries.length))
2402
- return;
2372
+ if (!(completions == null ? void 0 : completions.entries.length)) return;
2403
2373
  const result = [];
2404
2374
  for (const completion of completions.entries) {
2405
2375
  let { name: label, insertText, sortText } = completion;
2406
- if (label.startsWith(localInternalsPrefix))
2407
- continue;
2376
+ if (label.startsWith(localInternalsPrefix)) continue;
2408
2377
  const { replacementSpan } = completion;
2409
2378
  let textEdit;
2410
2379
  let detail;
@@ -2478,14 +2447,11 @@ var ScriptService = {
2478
2447
  },
2479
2448
  async doCompletionResolve(item) {
2480
2449
  const { data } = item;
2481
- if (!data)
2482
- return;
2450
+ if (!data) return;
2483
2451
  const { fileName } = data;
2484
- if (!fileName)
2485
- return;
2452
+ if (!fileName) return;
2486
2453
  const doc = get(filenameToURI(fileName));
2487
- if (!doc)
2488
- return;
2454
+ if (!doc) return;
2489
2455
  const project = getTSProject(fileName);
2490
2456
  const detail = project.service.getCompletionEntryDetails(
2491
2457
  fileName,
@@ -2496,14 +2462,12 @@ var ScriptService = {
2496
2462
  await getPreferences(project.markoScriptLang),
2497
2463
  data.originalData
2498
2464
  );
2499
- if (!(detail == null ? void 0 : detail.codeActions))
2500
- return;
2465
+ if (!(detail == null ? void 0 : detail.codeActions)) return;
2501
2466
  const extracted = processScript(doc, project);
2502
2467
  const textEdits = item.additionalTextEdits = item.additionalTextEdits || [];
2503
2468
  for (const action of detail.codeActions) {
2504
2469
  for (const change of action.changes) {
2505
- if (change.fileName !== fileName)
2506
- continue;
2470
+ if (change.fileName !== fileName) continue;
2507
2471
  for (const { span, newText: rawText } of change.textChanges) {
2508
2472
  let range;
2509
2473
  let newText = rawText;
@@ -2535,20 +2499,17 @@ var ScriptService = {
2535
2499
  },
2536
2500
  findDefinition(doc, params) {
2537
2501
  const fileName = getFSPath(doc);
2538
- if (!fileName)
2539
- return;
2502
+ if (!fileName) return;
2540
2503
  const project = getTSProject(fileName);
2541
2504
  const extracted = processScript(doc, project);
2542
2505
  const sourceOffset = doc.offsetAt(params.position);
2543
2506
  const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
2544
- if (generatedOffset === void 0)
2545
- return;
2507
+ if (generatedOffset === void 0) return;
2546
2508
  const boundary = project.service.getDefinitionAndBoundSpan(
2547
2509
  fileName,
2548
2510
  generatedOffset
2549
2511
  );
2550
- if (!(boundary == null ? void 0 : boundary.definitions))
2551
- return;
2512
+ if (!(boundary == null ? void 0 : boundary.definitions)) return;
2552
2513
  const originSelectionRange = sourceLocationAtTextSpan(
2553
2514
  extracted,
2554
2515
  boundary.textSpan
@@ -2557,8 +2518,7 @@ var ScriptService = {
2557
2518
  for (const def of boundary.definitions) {
2558
2519
  const targetUri = filenameToURI(def.fileName);
2559
2520
  const defDoc = get(targetUri);
2560
- if (!defDoc)
2561
- continue;
2521
+ if (!defDoc) continue;
2562
2522
  let link;
2563
2523
  if (markoFileReg.test(targetUri)) {
2564
2524
  const extracted2 = processScript(defDoc, project);
@@ -2594,23 +2554,19 @@ var ScriptService = {
2594
2554
  },
2595
2555
  doHover(doc, params) {
2596
2556
  const fileName = getFSPath(doc);
2597
- if (!fileName)
2598
- return;
2557
+ if (!fileName) return;
2599
2558
  const project = getTSProject(fileName);
2600
2559
  const extracted = processScript(doc, project);
2601
2560
  const sourceOffset = doc.offsetAt(params.position);
2602
2561
  const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
2603
- if (generatedOffset === void 0)
2604
- return;
2562
+ if (generatedOffset === void 0) return;
2605
2563
  const quickInfo = project.service.getQuickInfoAtPosition(
2606
2564
  fileName,
2607
2565
  generatedOffset
2608
2566
  );
2609
- if (!quickInfo)
2610
- return;
2567
+ if (!quickInfo) return;
2611
2568
  const sourceRange = sourceLocationAtTextSpan(extracted, quickInfo.textSpan);
2612
- if (!sourceRange)
2613
- return;
2569
+ if (!sourceRange) return;
2614
2570
  let contents = "";
2615
2571
  const displayParts = import_tsserverlibrary.default.displayPartsToString(quickInfo.displayParts);
2616
2572
  if (displayParts) {
@@ -2634,14 +2590,12 @@ ${documentation}`;
2634
2590
  },
2635
2591
  doRename(doc, params) {
2636
2592
  const fileName = getFSPath(doc);
2637
- if (!fileName)
2638
- return;
2593
+ if (!fileName) return;
2639
2594
  const project = getTSProject(fileName);
2640
2595
  const extracted = processScript(doc, project);
2641
2596
  const sourceOffset = doc.offsetAt(params.position);
2642
2597
  const generatedOffset = extracted.generatedOffsetAt(sourceOffset);
2643
- if (generatedOffset === void 0)
2644
- return;
2598
+ if (generatedOffset === void 0) return;
2645
2599
  const renameLocations = project.service.findRenameLocations(
2646
2600
  fileName,
2647
2601
  generatedOffset,
@@ -2649,15 +2603,13 @@ ${documentation}`;
2649
2603
  false,
2650
2604
  false
2651
2605
  );
2652
- if (!renameLocations)
2653
- return;
2606
+ if (!renameLocations) return;
2654
2607
  const changes = {};
2655
2608
  for (const rename of renameLocations) {
2656
2609
  const renameURI = filenameToURI(rename.fileName);
2657
2610
  const renameDoc = get(renameURI);
2658
2611
  let edit;
2659
- if (!renameDoc)
2660
- continue;
2612
+ if (!renameDoc) continue;
2661
2613
  if (markoFileReg.test(renameURI)) {
2662
2614
  const extracted2 = processScript(renameDoc, project);
2663
2615
  const sourceRange = sourceLocationAtTextSpan(
@@ -2690,8 +2642,7 @@ ${documentation}`;
2690
2642
  },
2691
2643
  doValidate(doc) {
2692
2644
  const fileName = getFSPath(doc);
2693
- if (!fileName)
2694
- return;
2645
+ if (!fileName) return;
2695
2646
  const project = getTSProject(fileName);
2696
2647
  const extracted = processScript(doc, project);
2697
2648
  let results;
@@ -2767,8 +2718,7 @@ function getOffsetAfterComments(node) {
2767
2718
  return Math.max(0, node.start - 1);
2768
2719
  }
2769
2720
  function sourceLocationAtTextSpan(extracted, { start, length }) {
2770
- if (start === 0 && length === 0)
2771
- return START_LOCATION;
2721
+ if (start === 0 && length === 0) return START_LOCATION;
2772
2722
  return extracted.sourceLocationAt(start, start + length);
2773
2723
  }
2774
2724
  function docLocationAtTextSpan(doc, { start, length }) {
@@ -2810,8 +2760,7 @@ function getTSProject(docFsPath) {
2810
2760
  let cached;
2811
2761
  if (projectCache) {
2812
2762
  cached = projectCache.get(basePath);
2813
- if (cached)
2814
- return cached;
2763
+ if (cached) return cached;
2815
2764
  } else {
2816
2765
  projectCache = /* @__PURE__ */ new Map();
2817
2766
  cache.set(getTSProject, projectCache);
@@ -2925,8 +2874,7 @@ function getTSProject(docFsPath) {
2925
2874
  let snapshot = snapshotCache.get(filename);
2926
2875
  if (!snapshot) {
2927
2876
  const doc = get(filenameToURI(filename));
2928
- if (!doc)
2929
- return;
2877
+ if (!doc) return;
2930
2878
  snapshot = import_tsserverlibrary.default.ScriptSnapshot.fromString(doc.getText());
2931
2879
  snapshotCache.set(filename, snapshot);
2932
2880
  }
@@ -3028,10 +2976,8 @@ function convertDiagTags(tsDiag) {
3028
2976
  tags = [import_vscode_languageserver10.DiagnosticTag.Deprecated];
3029
2977
  }
3030
2978
  if (tsDiag.reportsUnnecessary) {
3031
- if (tags)
3032
- tags.push(import_vscode_languageserver10.DiagnosticTag.Unnecessary);
3033
- else
3034
- tags = [import_vscode_languageserver10.DiagnosticTag.Unnecessary];
2979
+ if (tags) tags.push(import_vscode_languageserver10.DiagnosticTag.Unnecessary);
2980
+ else tags = [import_vscode_languageserver10.DiagnosticTag.Unnecessary];
3035
2981
  }
3036
2982
  return tags;
3037
2983
  }
@@ -3120,8 +3066,7 @@ var StyleSheetService = {
3120
3066
  const sourceOffset = doc.offsetAt(params.position);
3121
3067
  for (const style of processStyle(doc)) {
3122
3068
  const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
3123
- if (generatedPos === void 0)
3124
- continue;
3069
+ if (generatedPos === void 0) continue;
3125
3070
  const result = await style.service.doComplete2(
3126
3071
  style.virtualDoc,
3127
3072
  generatedPos,
@@ -3157,8 +3102,7 @@ var StyleSheetService = {
3157
3102
  const sourceOffset = doc.offsetAt(params.position);
3158
3103
  for (const style of processStyle(doc)) {
3159
3104
  const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
3160
- if (generatedPos === void 0)
3161
- continue;
3105
+ if (generatedPos === void 0) continue;
3162
3106
  const result = style.service.findDefinition(
3163
3107
  style.virtualDoc,
3164
3108
  generatedPos,
@@ -3180,8 +3124,7 @@ var StyleSheetService = {
3180
3124
  const sourceOffset = doc.offsetAt(params.position);
3181
3125
  for (const style of processStyle(doc)) {
3182
3126
  const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
3183
- if (generatedPos === void 0)
3184
- continue;
3127
+ if (generatedPos === void 0) continue;
3185
3128
  const result = [];
3186
3129
  for (const location of style.service.findReferences(
3187
3130
  style.virtualDoc,
@@ -3250,8 +3193,7 @@ var StyleSheetService = {
3250
3193
  const sourceOffset = doc.offsetAt(params.position);
3251
3194
  for (const style of processStyle(doc)) {
3252
3195
  const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
3253
- if (generatedPos === void 0)
3254
- continue;
3196
+ if (generatedPos === void 0) continue;
3255
3197
  const result = [];
3256
3198
  for (const highlight of style.service.findDocumentHighlights(
3257
3199
  style.virtualDoc,
@@ -3290,8 +3232,7 @@ var StyleSheetService = {
3290
3232
  getColorPresentations(doc, params) {
3291
3233
  for (const extracted of processStyle(doc)) {
3292
3234
  const generatedRange = getGeneratedRange(doc, extracted, params.range);
3293
- if (generatedRange === void 0)
3294
- continue;
3235
+ if (generatedRange === void 0) continue;
3295
3236
  const result = [];
3296
3237
  for (const colorPresentation of extracted.service.getColorPresentations(
3297
3238
  extracted.virtualDoc,
@@ -3316,8 +3257,7 @@ var StyleSheetService = {
3316
3257
  const sourceOffset = doc.offsetAt(params.position);
3317
3258
  for (const style of processStyle(doc)) {
3318
3259
  const generatedPos = style.extracted.generatedPositionAt(sourceOffset);
3319
- if (generatedPos === void 0)
3320
- continue;
3260
+ if (generatedPos === void 0) continue;
3321
3261
  const result = style.service.doHover(
3322
3262
  style.virtualDoc,
3323
3263
  generatedPos,
@@ -3342,8 +3282,7 @@ var StyleSheetService = {
3342
3282
  const sourceOffset = doc.offsetAt(params.position);
3343
3283
  for (const style of processStyle(doc)) {
3344
3284
  const generatedOffset = style.extracted.generatedOffsetAt(sourceOffset);
3345
- if (generatedOffset === void 0)
3346
- continue;
3285
+ if (generatedOffset === void 0) continue;
3347
3286
  const result = style.service.doRename(
3348
3287
  style.virtualDoc,
3349
3288
  style.virtualDoc.positionAt(generatedOffset),
@@ -3373,8 +3312,7 @@ var StyleSheetService = {
3373
3312
  var _a;
3374
3313
  for (const extracted of processStyle(doc)) {
3375
3314
  const generatedRange = getGeneratedRange(doc, extracted, params.range);
3376
- if (generatedRange === void 0)
3377
- continue;
3315
+ if (generatedRange === void 0) continue;
3378
3316
  const result = extracted.service.doCodeActions(
3379
3317
  extracted.virtualDoc,
3380
3318
  generatedRange,
@@ -3514,12 +3452,10 @@ var service = {
3514
3452
  return (_a = plugin.doComplete) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3515
3453
  })
3516
3454
  );
3517
- if (cancel.isCancellationRequested)
3518
- return;
3455
+ if (cancel.isCancellationRequested) return;
3519
3456
  const itemsByLabel = /* @__PURE__ */ new Map();
3520
3457
  for (const result of results) {
3521
- if (result.status !== "fulfilled" || !result.value)
3522
- continue;
3458
+ if (result.status !== "fulfilled" || !result.value) continue;
3523
3459
  for (const item of Array.isArray(result.value) ? result.value : result.value.items) {
3524
3460
  const { label } = item;
3525
3461
  const existingItem = itemsByLabel.get(label);
@@ -3539,10 +3475,8 @@ var service = {
3539
3475
  for (const plugin of plugins) {
3540
3476
  try {
3541
3477
  const result = await ((_a = plugin.doCompletionResolve) == null ? void 0 : _a.call(plugin, item, cancel));
3542
- if (cancel.isCancellationRequested)
3543
- return;
3544
- if (result)
3545
- return result;
3478
+ if (cancel.isCancellationRequested) return;
3479
+ if (result) return result;
3546
3480
  } catch {
3547
3481
  }
3548
3482
  }
@@ -3554,12 +3488,10 @@ var service = {
3554
3488
  return (_a = plugin.findDefinition) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3555
3489
  })
3556
3490
  );
3557
- if (cancel.isCancellationRequested)
3558
- return;
3491
+ if (cancel.isCancellationRequested) return;
3559
3492
  let links;
3560
3493
  for (const result of results) {
3561
- if (result.status !== "fulfilled" || !result.value)
3562
- continue;
3494
+ if (result.status !== "fulfilled" || !result.value) continue;
3563
3495
  links = (links || []).concat(result.value);
3564
3496
  }
3565
3497
  return links;
@@ -3571,12 +3503,10 @@ var service = {
3571
3503
  return (_a = plugin.findReferences) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3572
3504
  })
3573
3505
  );
3574
- if (cancel.isCancellationRequested)
3575
- return;
3506
+ if (cancel.isCancellationRequested) return;
3576
3507
  let references;
3577
3508
  for (const result of results) {
3578
- if (result.status !== "fulfilled" || !result.value)
3579
- continue;
3509
+ if (result.status !== "fulfilled" || !result.value) continue;
3580
3510
  references = (references || []).concat(result.value);
3581
3511
  }
3582
3512
  return references;
@@ -3590,12 +3520,10 @@ var service = {
3590
3520
  }
3591
3521
  )
3592
3522
  );
3593
- if (cancel.isCancellationRequested)
3594
- return;
3523
+ if (cancel.isCancellationRequested) return;
3595
3524
  let symbols;
3596
3525
  for (const result of results) {
3597
- if (result.status !== "fulfilled" || !result.value)
3598
- continue;
3526
+ if (result.status !== "fulfilled" || !result.value) continue;
3599
3527
  symbols = (symbols || []).concat(result.value);
3600
3528
  }
3601
3529
  return symbols;
@@ -3607,12 +3535,10 @@ var service = {
3607
3535
  return (_a = plugin.findDocumentLinks) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3608
3536
  })
3609
3537
  );
3610
- if (cancel.isCancellationRequested)
3611
- return;
3538
+ if (cancel.isCancellationRequested) return;
3612
3539
  let links;
3613
3540
  for (const result of results) {
3614
- if (result.status !== "fulfilled" || !result.value)
3615
- continue;
3541
+ if (result.status !== "fulfilled" || !result.value) continue;
3616
3542
  links = (links || []).concat(result.value);
3617
3543
  }
3618
3544
  return links;
@@ -3626,12 +3552,10 @@ var service = {
3626
3552
  }
3627
3553
  )
3628
3554
  );
3629
- if (cancel.isCancellationRequested)
3630
- return;
3555
+ if (cancel.isCancellationRequested) return;
3631
3556
  let highlights;
3632
3557
  for (const result of results) {
3633
- if (result.status !== "fulfilled" || !result.value)
3634
- continue;
3558
+ if (result.status !== "fulfilled" || !result.value) continue;
3635
3559
  highlights = (highlights || []).concat(result.value);
3636
3560
  }
3637
3561
  return highlights;
@@ -3643,12 +3567,10 @@ var service = {
3643
3567
  return (_a = plugin.findDocumentColors) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3644
3568
  })
3645
3569
  );
3646
- if (cancel.isCancellationRequested)
3647
- return;
3570
+ if (cancel.isCancellationRequested) return;
3648
3571
  let colors;
3649
3572
  for (const result of results) {
3650
- if (result.status !== "fulfilled" || !result.value)
3651
- continue;
3573
+ if (result.status !== "fulfilled" || !result.value) continue;
3652
3574
  colors = (colors || []).concat(result.value);
3653
3575
  }
3654
3576
  return colors;
@@ -3662,12 +3584,10 @@ var service = {
3662
3584
  }
3663
3585
  )
3664
3586
  );
3665
- if (cancel.isCancellationRequested)
3666
- return;
3587
+ if (cancel.isCancellationRequested) return;
3667
3588
  let presentations;
3668
3589
  for (const result of results) {
3669
- if (result.status !== "fulfilled" || !result.value)
3670
- continue;
3590
+ if (result.status !== "fulfilled" || !result.value) continue;
3671
3591
  presentations = (presentations || []).concat(result.value);
3672
3592
  }
3673
3593
  return presentations;
@@ -3679,12 +3599,10 @@ var service = {
3679
3599
  return (_a = plugin.doHover) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3680
3600
  })
3681
3601
  );
3682
- if (cancel.isCancellationRequested)
3683
- return;
3602
+ if (cancel.isCancellationRequested) return;
3684
3603
  let hovers;
3685
3604
  for (const result of results) {
3686
- if (result.status !== "fulfilled" || !result.value)
3687
- continue;
3605
+ if (result.status !== "fulfilled" || !result.value) continue;
3688
3606
  if (hovers) {
3689
3607
  hovers.range = maxRange(hovers.range, result.value.range);
3690
3608
  hovers.contents = mergeHoverContents(
@@ -3704,14 +3622,12 @@ var service = {
3704
3622
  return (_a = plugin.doRename) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3705
3623
  })
3706
3624
  );
3707
- if (cancel.isCancellationRequested)
3708
- return;
3625
+ if (cancel.isCancellationRequested) return;
3709
3626
  let changes;
3710
3627
  let changeAnnotations;
3711
3628
  let documentChanges;
3712
3629
  for (const result of results) {
3713
- if (result.status !== "fulfilled" || !result.value)
3714
- continue;
3630
+ if (result.status !== "fulfilled" || !result.value) continue;
3715
3631
  const { value } = result;
3716
3632
  if (value.changes) {
3717
3633
  if (changes) {
@@ -3748,12 +3664,10 @@ var service = {
3748
3664
  return (_a = plugin.doCodeActions) == null ? void 0 : _a.call(plugin, doc, params, cancel);
3749
3665
  })
3750
3666
  );
3751
- if (cancel.isCancellationRequested)
3752
- return;
3667
+ if (cancel.isCancellationRequested) return;
3753
3668
  let actions;
3754
3669
  for (const result of results) {
3755
- if (result.status !== "fulfilled" || !result.value)
3756
- continue;
3670
+ if (result.status !== "fulfilled" || !result.value) continue;
3757
3671
  actions = (actions || []).concat(result.value);
3758
3672
  }
3759
3673
  return actions;
@@ -3767,8 +3681,7 @@ var service = {
3767
3681
  );
3768
3682
  let diagnostics;
3769
3683
  for (const result of results) {
3770
- if (result.status !== "fulfilled" || !result.value)
3771
- continue;
3684
+ if (result.status !== "fulfilled" || !result.value) continue;
3772
3685
  diagnostics = (diagnostics || []).concat(result.value);
3773
3686
  }
3774
3687
  return diagnostics;
@@ -3776,10 +3689,8 @@ var service = {
3776
3689
  format: marko_default.format
3777
3690
  };
3778
3691
  function maxRange(a, b) {
3779
- if (!a)
3780
- return b;
3781
- if (!b)
3782
- return a;
3692
+ if (!a) return b;
3693
+ if (!b) return a;
3783
3694
  return {
3784
3695
  start: {
3785
3696
  line: Math.min(a.start.line, b.start.line),
@@ -3792,10 +3703,8 @@ function maxRange(a, b) {
3792
3703
  };
3793
3704
  }
3794
3705
  function mergeHoverContents(a, b) {
3795
- if (!a)
3796
- return b;
3797
- if (!b)
3798
- return a;
3706
+ if (!a) return b;
3707
+ if (!b) return a;
3799
3708
  if (!import_vscode_languageserver12.MarkupContent.is(a)) {
3800
3709
  a = markedStringToMarkupContent(a);
3801
3710
  }
@@ -4024,8 +3933,7 @@ function queueDiagnostic() {
4024
3933
  }
4025
3934
  const prevDiag = prevDiags.get(doc) || [];
4026
3935
  const nextDiag = await service.doValidate(doc) || [];
4027
- if ((0, import_util2.isDeepStrictEqual)(prevDiag, nextDiag))
4028
- return;
3936
+ if ((0, import_util2.isDeepStrictEqual)(prevDiag, nextDiag)) return;
4029
3937
  return [doc, nextDiag];
4030
3938
  })
4031
3939
  );