@marko/language-server 1.1.19 → 1.2.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.mjs CHANGED
@@ -1445,206 +1445,8 @@ var doComplete = async (doc, params) => {
1445
1445
  };
1446
1446
  };
1447
1447
 
1448
- // src/service/marko/validate.ts
1449
- import path5 from "path";
1450
- import { Project as Project3 } from "@marko/language-tools";
1451
- import { DiagnosticSeverity } from "vscode-languageserver";
1452
- import { DiagnosticType } from "@marko/babel-utils";
1453
- var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
1454
- var compilerConfig = {
1455
- code: false,
1456
- output: "migrate",
1457
- sourceMaps: false,
1458
- errorRecovery: true,
1459
- babelConfig: {
1460
- babelrc: false,
1461
- configFile: false,
1462
- browserslistConfigFile: false,
1463
- caller: {
1464
- name: "@marko/language-server",
1465
- supportsStaticESM: true,
1466
- supportsDynamicImport: true,
1467
- supportsTopLevelAwait: true,
1468
- supportsExportNamespaceFrom: true
1469
- }
1470
- }
1471
- };
1472
- var doValidate = (doc) => {
1473
- const filename = getFSPath(doc);
1474
- const diagnostics = [];
1475
- try {
1476
- const { meta } = Project3.getCompiler(
1477
- filename && path5.dirname(filename)
1478
- ).compileSync(doc.getText(), filename || "untitled.marko", compilerConfig);
1479
- if (meta.diagnostics) {
1480
- for (const diag of meta.diagnostics) {
1481
- const range = diag.loc ? {
1482
- start: {
1483
- line: diag.loc.start.line - 1,
1484
- character: diag.loc.start.column
1485
- },
1486
- end: {
1487
- line: diag.loc.end.line - 1,
1488
- character: diag.loc.end.column
1489
- }
1490
- } : {
1491
- start: { line: 0, character: 0 },
1492
- end: { line: 0, character: 0 }
1493
- };
1494
- let severity;
1495
- switch (diag.type) {
1496
- case DiagnosticType.Warning:
1497
- case DiagnosticType.Deprecation:
1498
- severity = DiagnosticSeverity.Warning;
1499
- break;
1500
- case DiagnosticType.Suggestion:
1501
- severity = DiagnosticSeverity.Hint;
1502
- break;
1503
- default:
1504
- severity = DiagnosticSeverity.Error;
1505
- break;
1506
- }
1507
- diagnostics.push({
1508
- range,
1509
- source: "marko",
1510
- code: void 0,
1511
- tags: void 0,
1512
- severity,
1513
- message: diag.label
1514
- });
1515
- }
1516
- }
1517
- } catch (err) {
1518
- addDiagnosticsForError(err, diagnostics);
1519
- }
1520
- return diagnostics;
1521
- };
1522
- function addDiagnosticsForError(err, diagnostics) {
1523
- if (!isError(err)) {
1524
- diagnostics.push({
1525
- range: {
1526
- start: { line: 0, character: 0 },
1527
- end: { line: 0, character: 0 }
1528
- },
1529
- source: "marko",
1530
- code: void 0,
1531
- tags: void 0,
1532
- severity: DiagnosticSeverity.Error,
1533
- message: String(err)
1534
- });
1535
- } else if (isAggregateError(err)) {
1536
- for (const nestedError of err.errors) {
1537
- addDiagnosticsForError(nestedError, diagnostics);
1538
- }
1539
- } else if (isErrorWithLoc(err)) {
1540
- const message = err.label || err.message || err.stack;
1541
- if (!message)
1542
- return;
1543
- const { loc } = err;
1544
- diagnostics.push({
1545
- range: {
1546
- start: {
1547
- line: loc.start.line - 1,
1548
- character: loc.start.column
1549
- },
1550
- end: {
1551
- line: loc.end.line - 1,
1552
- character: loc.end.column
1553
- }
1554
- },
1555
- source: "marko",
1556
- code: void 0,
1557
- tags: void 0,
1558
- severity: DiagnosticSeverity.Error,
1559
- message
1560
- });
1561
- } else {
1562
- let match;
1563
- while (match = markoErrorRegExp.exec(err.message)) {
1564
- const [, , rawLine, rawCol, message] = match;
1565
- const pos = {
1566
- line: (parseInt(rawLine, 10) || 1) - 1,
1567
- character: (parseInt(rawCol, 10) || 1) - 1
1568
- };
1569
- diagnostics.push({
1570
- range: { start: pos, end: pos },
1571
- source: "marko",
1572
- code: void 0,
1573
- tags: void 0,
1574
- severity: DiagnosticSeverity.Error,
1575
- message
1576
- });
1577
- }
1578
- }
1579
- }
1580
- function isError(err) {
1581
- return err != null && typeof err === "object" && typeof err.message === "string";
1582
- }
1583
- function isAggregateError(err) {
1584
- return Array.isArray(err == null ? void 0 : err.errors);
1585
- }
1586
- function isErrorWithLoc(err) {
1587
- const loc = err == null ? void 0 : err.loc;
1588
- if (typeof loc !== "object")
1589
- return false;
1590
- 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";
1591
- }
1592
-
1593
- // src/service/marko/hover/index.ts
1594
- import { NodeType as NodeType4 } from "@marko/language-tools";
1595
-
1596
- // src/utils/constants.ts
1597
- var START_POSITION = {
1598
- line: 0,
1599
- character: 0
1600
- };
1601
- var START_LOCATION = {
1602
- start: START_POSITION,
1603
- end: START_POSITION
1604
- };
1605
-
1606
- // src/service/marko/hover/OpenTagName.ts
1607
- function OpenTagName2({
1608
- node,
1609
- file: { parsed, filename, lookup }
1610
- }) {
1611
- const tag = node.parent;
1612
- const range = parsed.locationAt(node);
1613
- const tagDef = tag.nameText && lookup.getTag(tag.nameText);
1614
- if (tagDef) {
1615
- const completion = getTagNameCompletion({
1616
- tag: tagDef,
1617
- range: START_LOCATION,
1618
- importer: filename
1619
- });
1620
- if (completion.documentation) {
1621
- return {
1622
- range,
1623
- contents: completion.documentation
1624
- };
1625
- }
1626
- }
1627
- }
1628
-
1629
- // src/service/marko/hover/index.ts
1630
- var handlers2 = {
1631
- OpenTagName: OpenTagName2
1632
- };
1633
- var doHover = async (doc, params) => {
1634
- var _a;
1635
- const file = getMarkoFile(doc);
1636
- const offset = doc.offsetAt(params.position);
1637
- const node = file.parsed.nodeAt(offset);
1638
- return await ((_a = handlers2[NodeType4[node.type]]) == null ? void 0 : _a.call(handlers2, {
1639
- file,
1640
- params,
1641
- offset,
1642
- node
1643
- }));
1644
- };
1645
-
1646
1448
  // src/service/marko/definition/index.ts
1647
- import { NodeType as NodeType6 } from "@marko/language-tools";
1449
+ import { NodeType as NodeType5 } from "@marko/language-tools";
1648
1450
 
1649
1451
  // src/service/marko/definition/AttrName.ts
1650
1452
  import fs3 from "fs";
@@ -1675,6 +1477,16 @@ function escape(val) {
1675
1477
  return String(val).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
1676
1478
  }
1677
1479
 
1480
+ // src/utils/constants.ts
1481
+ var START_POSITION = {
1482
+ line: 0,
1483
+ character: 0
1484
+ };
1485
+ var START_LOCATION = {
1486
+ start: START_POSITION,
1487
+ end: START_POSITION
1488
+ };
1489
+
1678
1490
  // src/service/marko/definition/AttrName.ts
1679
1491
  function AttrName2({
1680
1492
  node,
@@ -1717,23 +1529,23 @@ function AttrName2({
1717
1529
 
1718
1530
  // src/service/marko/definition/OpenTagName.ts
1719
1531
  import fs4 from "fs";
1720
- import path6 from "path";
1532
+ import path5 from "path";
1721
1533
  import { URI as URI5 } from "vscode-uri";
1722
1534
  import {
1723
- NodeType as NodeType5,
1535
+ NodeType as NodeType4,
1724
1536
  getLines as getLines2,
1725
1537
  getLocation as getLocation2
1726
1538
  } from "@marko/language-tools";
1727
- function OpenTagName3({
1539
+ function OpenTagName2({
1728
1540
  node,
1729
1541
  file: { parsed, lookup }
1730
1542
  }) {
1731
1543
  const tag = node.parent;
1732
1544
  let tagDef;
1733
1545
  let range = START_LOCATION;
1734
- if (tag.type === NodeType5.AttrTag) {
1546
+ if (tag.type === NodeType4.AttrTag) {
1735
1547
  let parentTag = tag.owner;
1736
- while ((parentTag == null ? void 0 : parentTag.type) === NodeType5.AttrTag)
1548
+ while ((parentTag == null ? void 0 : parentTag.type) === NodeType4.AttrTag)
1737
1549
  parentTag = parentTag.owner;
1738
1550
  tagDef = parentTag && parentTag.nameText ? lookup.getTag(parentTag.nameText) : void 0;
1739
1551
  } else {
@@ -1743,7 +1555,7 @@ function OpenTagName3({
1743
1555
  return;
1744
1556
  }
1745
1557
  const tagEntryFile = tagDef.template || tagDef.renderer || tagDef.filePath;
1746
- if (!path6.isAbsolute(tagEntryFile)) {
1558
+ if (!path5.isAbsolute(tagEntryFile)) {
1747
1559
  return;
1748
1560
  }
1749
1561
  if (/\/marko(?:-tag)?\.json$/.test(tagEntryFile)) {
@@ -1770,8 +1582,8 @@ function OpenTagName3({
1770
1582
  }
1771
1583
 
1772
1584
  // src/service/marko/definition/index.ts
1773
- var handlers3 = {
1774
- OpenTagName: OpenTagName3,
1585
+ var handlers2 = {
1586
+ OpenTagName: OpenTagName2,
1775
1587
  AttrName: AttrName2
1776
1588
  };
1777
1589
  var findDefinition = async (doc, params) => {
@@ -1779,7 +1591,7 @@ var findDefinition = async (doc, params) => {
1779
1591
  const file = getMarkoFile(doc);
1780
1592
  const offset = doc.offsetAt(params.position);
1781
1593
  const node = file.parsed.nodeAt(offset);
1782
- return await ((_a = handlers3[NodeType6[node.type]]) == null ? void 0 : _a.call(handlers3, {
1594
+ return await ((_a = handlers2[NodeType5[node.type]]) == null ? void 0 : _a.call(handlers2, {
1783
1595
  file,
1784
1596
  params,
1785
1597
  offset,
@@ -1788,7 +1600,7 @@ var findDefinition = async (doc, params) => {
1788
1600
  };
1789
1601
 
1790
1602
  // src/service/marko/document-links.ts
1791
- import { NodeType as NodeType7 } from "@marko/language-tools";
1603
+ import { NodeType as NodeType6 } from "@marko/language-tools";
1792
1604
  var importTagReg2 = /(['"])<((?:[^\1\\>]+|\\.)*)>?\1/g;
1793
1605
  var findDocumentLinks = async (doc) => {
1794
1606
  return processDoc(doc, extractDocumentLinks);
@@ -1807,14 +1619,14 @@ function extractDocumentLinks({
1807
1619
  const { program, read } = parsed;
1808
1620
  const visit = (node) => {
1809
1621
  switch (node.type) {
1810
- case NodeType7.AttrTag:
1622
+ case NodeType6.AttrTag:
1811
1623
  if (node.body) {
1812
1624
  for (const child of node.body) {
1813
1625
  visit(child);
1814
1626
  }
1815
1627
  }
1816
1628
  break;
1817
- case NodeType7.Tag:
1629
+ case NodeType6.Tag:
1818
1630
  if (node.attrs && node.nameText) {
1819
1631
  for (const attr of node.attrs) {
1820
1632
  if (isDocumentLinkAttr(code, node, attr)) {
@@ -1840,7 +1652,7 @@ function extractDocumentLinks({
1840
1652
  }
1841
1653
  };
1842
1654
  for (const node of program.static) {
1843
- if (node.type === NodeType7.Import) {
1655
+ if (node.type === NodeType6.Import) {
1844
1656
  importTagReg2.lastIndex = 0;
1845
1657
  const value = parsed.read(node);
1846
1658
  const match = importTagReg2.exec(value);
@@ -1868,7 +1680,7 @@ function extractDocumentLinks({
1868
1680
 
1869
1681
  // src/service/marko/document-symbols.ts
1870
1682
  import { SymbolKind } from "vscode-languageserver";
1871
- import { NodeType as NodeType8 } from "@marko/language-tools";
1683
+ import { NodeType as NodeType7 } from "@marko/language-tools";
1872
1684
  var findDocumentSymbols = async (doc) => processDoc(doc, extractDocumentSymbols);
1873
1685
  function extractDocumentSymbols({
1874
1686
  uri,
@@ -1884,10 +1696,10 @@ function extractDocumentSymbols({
1884
1696
  const visit = (node) => {
1885
1697
  var _a, _b;
1886
1698
  switch (node.type) {
1887
- case NodeType8.Tag:
1888
- case NodeType8.AttrTag:
1699
+ case NodeType7.Tag:
1700
+ case NodeType7.AttrTag:
1889
1701
  symbols.push({
1890
- name: (node.type === NodeType8.AttrTag ? (_a = node.nameText) == null ? void 0 : _a.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
1702
+ name: (node.type === NodeType7.AttrTag ? (_a = node.nameText) == null ? void 0 : _a.slice(node.nameText.indexOf("@")) : node.nameText) || "<${...}>",
1891
1703
  kind: node.nameText && ((_b = lookup.getTag(node.nameText)) == null ? void 0 : _b.html) && SymbolKind.Property || SymbolKind.Class,
1892
1704
  location: {
1893
1705
  uri,
@@ -1909,11 +1721,11 @@ function extractDocumentSymbols({
1909
1721
  }
1910
1722
 
1911
1723
  // src/service/marko/format.ts
1912
- import { TextEdit as TextEdit6 } from "vscode-languageserver";
1724
+ import { Project as Project3 } from "@marko/language-tools";
1913
1725
  import * as prettier from "prettier";
1914
1726
  import * as markoPrettier from "prettier-plugin-marko";
1915
- import { Project as Project4 } from "@marko/language-tools";
1916
- var format2 = async (doc, params, cancel) => {
1727
+ import { TextEdit as TextEdit6 } from "vscode-languageserver";
1728
+ async function formatDocument(doc, formatOptions, cancel) {
1917
1729
  try {
1918
1730
  const dir = getFSDir(doc);
1919
1731
  const filepath = getFSPath(doc);
@@ -1922,16 +1734,17 @@ var format2 = async (doc, params, cancel) => {
1922
1734
  parser: "marko",
1923
1735
  filepath,
1924
1736
  plugins: [markoPrettier],
1925
- tabWidth: params.options.tabSize,
1926
- useTabs: params.options.insertSpaces === false,
1737
+ tabWidth: formatOptions.tabSize,
1738
+ useTabs: formatOptions.insertSpaces === false,
1739
+ markoSyntax: formatOptions.mode ?? "auto",
1927
1740
  ...filepath ? await prettier.resolveConfig(filepath, {
1928
1741
  editorconfig: true
1929
1742
  }).catch(() => null) : null
1930
1743
  };
1931
- if (cancel.isCancellationRequested)
1744
+ markoPrettier.setCompiler(Project3.getCompiler(dir), Project3.getConfig(dir));
1745
+ if (cancel == null ? void 0 : cancel.isCancellationRequested)
1932
1746
  return;
1933
- markoPrettier.setCompiler(Project4.getCompiler(dir), Project4.getConfig(dir));
1934
- const ret = [
1747
+ return [
1935
1748
  TextEdit6.replace(
1936
1749
  {
1937
1750
  start: START_POSITION,
@@ -1940,12 +1753,202 @@ var format2 = async (doc, params, cancel) => {
1940
1753
  await prettier.format(text, options)
1941
1754
  )
1942
1755
  ];
1943
- return ret;
1944
1756
  } catch (e) {
1945
1757
  displayError(e);
1946
1758
  }
1759
+ }
1760
+ var format2 = async (doc, params, cancel) => {
1761
+ return formatDocument(doc, params.options, cancel);
1762
+ };
1763
+
1764
+ // src/service/marko/hover/index.ts
1765
+ import { NodeType as NodeType8 } from "@marko/language-tools";
1766
+
1767
+ // src/service/marko/hover/OpenTagName.ts
1768
+ function OpenTagName3({
1769
+ node,
1770
+ file: { parsed, filename, lookup }
1771
+ }) {
1772
+ const tag = node.parent;
1773
+ const range = parsed.locationAt(node);
1774
+ const tagDef = tag.nameText && lookup.getTag(tag.nameText);
1775
+ if (tagDef) {
1776
+ const completion = getTagNameCompletion({
1777
+ tag: tagDef,
1778
+ range: START_LOCATION,
1779
+ importer: filename
1780
+ });
1781
+ if (completion.documentation) {
1782
+ return {
1783
+ range,
1784
+ contents: completion.documentation
1785
+ };
1786
+ }
1787
+ }
1788
+ }
1789
+
1790
+ // src/service/marko/hover/index.ts
1791
+ var handlers3 = {
1792
+ OpenTagName: OpenTagName3
1793
+ };
1794
+ var doHover = async (doc, params) => {
1795
+ var _a;
1796
+ const file = getMarkoFile(doc);
1797
+ const offset = doc.offsetAt(params.position);
1798
+ const node = file.parsed.nodeAt(offset);
1799
+ return await ((_a = handlers3[NodeType8[node.type]]) == null ? void 0 : _a.call(handlers3, {
1800
+ file,
1801
+ params,
1802
+ offset,
1803
+ node
1804
+ }));
1947
1805
  };
1948
1806
 
1807
+ // src/service/marko/validate.ts
1808
+ import path6 from "path";
1809
+ import { Project as Project4 } from "@marko/language-tools";
1810
+ import { DiagnosticSeverity } from "vscode-languageserver";
1811
+ import { DiagnosticType } from "@marko/babel-utils";
1812
+ var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
1813
+ var compilerConfig = {
1814
+ code: false,
1815
+ output: "migrate",
1816
+ sourceMaps: false,
1817
+ errorRecovery: true,
1818
+ babelConfig: {
1819
+ babelrc: false,
1820
+ configFile: false,
1821
+ browserslistConfigFile: false,
1822
+ caller: {
1823
+ name: "@marko/language-server",
1824
+ supportsStaticESM: true,
1825
+ supportsDynamicImport: true,
1826
+ supportsTopLevelAwait: true,
1827
+ supportsExportNamespaceFrom: true
1828
+ }
1829
+ }
1830
+ };
1831
+ var doValidate = (doc) => {
1832
+ const filename = getFSPath(doc);
1833
+ const diagnostics = [];
1834
+ try {
1835
+ const { meta } = Project4.getCompiler(
1836
+ filename && path6.dirname(filename)
1837
+ ).compileSync(doc.getText(), filename || "untitled.marko", compilerConfig);
1838
+ if (meta.diagnostics) {
1839
+ for (const diag of meta.diagnostics) {
1840
+ const range = diag.loc ? {
1841
+ start: {
1842
+ line: diag.loc.start.line - 1,
1843
+ character: diag.loc.start.column
1844
+ },
1845
+ end: {
1846
+ line: diag.loc.end.line - 1,
1847
+ character: diag.loc.end.column
1848
+ }
1849
+ } : {
1850
+ start: { line: 0, character: 0 },
1851
+ end: { line: 0, character: 0 }
1852
+ };
1853
+ let severity;
1854
+ switch (diag.type) {
1855
+ case DiagnosticType.Warning:
1856
+ case DiagnosticType.Deprecation:
1857
+ severity = DiagnosticSeverity.Warning;
1858
+ break;
1859
+ case DiagnosticType.Suggestion:
1860
+ severity = DiagnosticSeverity.Hint;
1861
+ break;
1862
+ default:
1863
+ severity = DiagnosticSeverity.Error;
1864
+ break;
1865
+ }
1866
+ diagnostics.push({
1867
+ range,
1868
+ source: "marko",
1869
+ code: void 0,
1870
+ tags: void 0,
1871
+ severity,
1872
+ message: diag.label
1873
+ });
1874
+ }
1875
+ }
1876
+ } catch (err) {
1877
+ addDiagnosticsForError(err, diagnostics);
1878
+ }
1879
+ return diagnostics;
1880
+ };
1881
+ function addDiagnosticsForError(err, diagnostics) {
1882
+ if (!isError(err)) {
1883
+ diagnostics.push({
1884
+ range: {
1885
+ start: { line: 0, character: 0 },
1886
+ end: { line: 0, character: 0 }
1887
+ },
1888
+ source: "marko",
1889
+ code: void 0,
1890
+ tags: void 0,
1891
+ severity: DiagnosticSeverity.Error,
1892
+ message: String(err)
1893
+ });
1894
+ } else if (isAggregateError(err)) {
1895
+ for (const nestedError of err.errors) {
1896
+ addDiagnosticsForError(nestedError, diagnostics);
1897
+ }
1898
+ } else if (isErrorWithLoc(err)) {
1899
+ const message = err.label || err.message || err.stack;
1900
+ if (!message)
1901
+ return;
1902
+ const { loc } = err;
1903
+ diagnostics.push({
1904
+ range: {
1905
+ start: {
1906
+ line: loc.start.line - 1,
1907
+ character: loc.start.column
1908
+ },
1909
+ end: {
1910
+ line: loc.end.line - 1,
1911
+ character: loc.end.column
1912
+ }
1913
+ },
1914
+ source: "marko",
1915
+ code: void 0,
1916
+ tags: void 0,
1917
+ severity: DiagnosticSeverity.Error,
1918
+ message
1919
+ });
1920
+ } else {
1921
+ let match;
1922
+ while (match = markoErrorRegExp.exec(err.message)) {
1923
+ const [, , rawLine, rawCol, message] = match;
1924
+ const pos = {
1925
+ line: (parseInt(rawLine, 10) || 1) - 1,
1926
+ character: (parseInt(rawCol, 10) || 1) - 1
1927
+ };
1928
+ diagnostics.push({
1929
+ range: { start: pos, end: pos },
1930
+ source: "marko",
1931
+ code: void 0,
1932
+ tags: void 0,
1933
+ severity: DiagnosticSeverity.Error,
1934
+ message
1935
+ });
1936
+ }
1937
+ }
1938
+ }
1939
+ function isError(err) {
1940
+ return err != null && typeof err === "object" && typeof err.message === "string";
1941
+ }
1942
+ function isAggregateError(err) {
1943
+ return Array.isArray(err == null ? void 0 : err.errors);
1944
+ }
1945
+ function isErrorWithLoc(err) {
1946
+ const loc = err == null ? void 0 : err.loc;
1947
+ if (typeof loc !== "object")
1948
+ return false;
1949
+ return loc !== null && typeof loc === "object" && typeof loc.start === "object" && typeof loc.end === "object" && typeof loc.start.line === "number" && typeof loc.start.column === "number" && typeof loc.end.line === "number" && typeof loc.end.column === "number";
1950
+ }
1951
+
1949
1952
  // src/service/marko/index.ts
1950
1953
  var marko_default = {
1951
1954
  doComplete,
@@ -1954,7 +1957,17 @@ var marko_default = {
1954
1957
  findDefinition,
1955
1958
  findDocumentLinks,
1956
1959
  findDocumentSymbols,
1957
- format: format2
1960
+ format: format2,
1961
+ commands: {
1962
+ "$/formatWithMode": async ({
1963
+ doc: docURI,
1964
+ options
1965
+ }) => {
1966
+ const doc = get(docURI);
1967
+ const formatted = await formatDocument(doc, options);
1968
+ return formatted;
1969
+ }
1970
+ }
1958
1971
  };
1959
1972
 
1960
1973
  // src/service/script/index.ts
@@ -2818,12 +2831,12 @@ function getTSProject(docFsPath) {
2818
2831
  markoScriptLang = ScriptLang.ts;
2819
2832
  }
2820
2833
  }
2821
- const rootDir = configFile && path8.dirname(configFile) || process.cwd();
2822
- const cache = Project5.getCache(configFile && rootDir);
2834
+ const basePath = configFile && path8.dirname(configFile) || process.cwd();
2835
+ const cache = Project5.getCache(configFile && basePath);
2823
2836
  let projectCache = cache.get(getTSProject);
2824
2837
  let cached;
2825
2838
  if (projectCache) {
2826
- cached = projectCache.get(rootDir);
2839
+ cached = projectCache.get(basePath);
2827
2840
  if (cached)
2828
2841
  return cached;
2829
2842
  } else {
@@ -2833,13 +2846,13 @@ function getTSProject(docFsPath) {
2833
2846
  const { fileNames, options, projectReferences } = ts.parseJsonConfigFileContent(
2834
2847
  configFile && ts.readConfigFile(configFile, ts.sys.readFile).config || defaultTSConfig,
2835
2848
  ts.sys,
2836
- rootDir,
2849
+ basePath,
2837
2850
  requiredTSCompilerOptions,
2838
2851
  configFile,
2839
2852
  void 0,
2840
2853
  extraTSCompilerExtensions
2841
2854
  );
2842
- options.rootDir ??= rootDir;
2855
+ options.rootDir = basePath;
2843
2856
  const potentialGlobalFiles = new Set(
2844
2857
  fileNames.filter((file) => /\.[cm]?ts$/.test(file))
2845
2858
  );
@@ -2849,7 +2862,7 @@ function getTSProject(docFsPath) {
2849
2862
  ts.getDefaultLibFileName(options)
2850
2863
  );
2851
2864
  const resolutionCache = ts.createModuleResolutionCache(
2852
- rootDir,
2865
+ basePath,
2853
2866
  getCanonicalFileName,
2854
2867
  options
2855
2868
  );
@@ -2954,7 +2967,7 @@ function getTSProject(docFsPath) {
2954
2967
  service: ts.createLanguageService(host),
2955
2968
  markoScriptLang
2956
2969
  };
2957
- projectCache.set(rootDir, tsProject);
2970
+ projectCache.set(basePath, tsProject);
2958
2971
  return tsProject;
2959
2972
  }
2960
2973
  function filenameToURI(filename) {