@marko/language-server 2.1.29 → 2.1.30
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 +30 -33
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +13 -16
- package/dist/index.mjs.map +3 -3
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,7 @@ Project.setDefaultCompilerMeta(defaultCompiler, {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// src/index.ts
|
|
24
|
-
import { Project as
|
|
24
|
+
import { Project as Project6 } from "@marko/language-tools";
|
|
25
25
|
import { inspect as inspect2, isDeepStrictEqual } from "util";
|
|
26
26
|
import {
|
|
27
27
|
createConnection,
|
|
@@ -1675,7 +1675,6 @@ function extractDocumentSymbols({
|
|
|
1675
1675
|
}
|
|
1676
1676
|
|
|
1677
1677
|
// src/service/marko/format.ts
|
|
1678
|
-
import { Project as Project3 } from "@marko/language-tools";
|
|
1679
1678
|
import * as prettier from "prettier";
|
|
1680
1679
|
import * as markoPrettier from "prettier-plugin-marko";
|
|
1681
1680
|
import { TextEdit as TextEdit6 } from "vscode-languageserver";
|
|
@@ -1708,7 +1707,6 @@ function display(type, data) {
|
|
|
1708
1707
|
// src/service/marko/format.ts
|
|
1709
1708
|
async function formatDocument(doc, formatOptions, cancel) {
|
|
1710
1709
|
try {
|
|
1711
|
-
const dir = getFSDir(doc);
|
|
1712
1710
|
const filepath = getFSPath(doc);
|
|
1713
1711
|
const text = doc.getText();
|
|
1714
1712
|
const options = {
|
|
@@ -1722,7 +1720,6 @@ async function formatDocument(doc, formatOptions, cancel) {
|
|
|
1722
1720
|
editorconfig: true
|
|
1723
1721
|
}).catch(() => null) : null
|
|
1724
1722
|
};
|
|
1725
|
-
markoPrettier.setCompiler(Project3.getCompiler(dir), Project3.getConfig(dir));
|
|
1726
1723
|
if (cancel?.isCancellationRequested) return;
|
|
1727
1724
|
return [
|
|
1728
1725
|
TextEdit6.replace(
|
|
@@ -1785,7 +1782,7 @@ var doHover = async (doc, params) => {
|
|
|
1785
1782
|
|
|
1786
1783
|
// src/service/marko/validate.ts
|
|
1787
1784
|
import { DiagnosticType } from "@marko/compiler/babel-utils";
|
|
1788
|
-
import { Project as
|
|
1785
|
+
import { Project as Project3 } from "@marko/language-tools";
|
|
1789
1786
|
import path6 from "path";
|
|
1790
1787
|
import { DiagnosticSeverity } from "vscode-languageserver";
|
|
1791
1788
|
var markoErrorRegExp = /^(.+?)\.marko(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
|
|
@@ -1811,7 +1808,7 @@ var doValidate = (doc) => {
|
|
|
1811
1808
|
const filename = getFSPath(doc);
|
|
1812
1809
|
const diagnostics = [];
|
|
1813
1810
|
try {
|
|
1814
|
-
const { meta } =
|
|
1811
|
+
const { meta } = Project3.getCompiler(
|
|
1815
1812
|
filename && path6.dirname(filename)
|
|
1816
1813
|
).compileSync(doc.getText(), filename || "untitled.marko", compilerConfig);
|
|
1817
1814
|
if (meta.diagnostics) {
|
|
@@ -1951,7 +1948,7 @@ var marko_default = {
|
|
|
1951
1948
|
import {
|
|
1952
1949
|
extractScript,
|
|
1953
1950
|
NodeType as NodeType10,
|
|
1954
|
-
Project as
|
|
1951
|
+
Project as Project5,
|
|
1955
1952
|
ScriptLang
|
|
1956
1953
|
} from "@marko/language-tools";
|
|
1957
1954
|
import path8 from "path";
|
|
@@ -1972,7 +1969,7 @@ import {
|
|
|
1972
1969
|
getExt,
|
|
1973
1970
|
isDefinitionFile,
|
|
1974
1971
|
Processors,
|
|
1975
|
-
Project as
|
|
1972
|
+
Project as Project4
|
|
1976
1973
|
} from "@marko/language-tools";
|
|
1977
1974
|
import path7 from "path";
|
|
1978
1975
|
var fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
|
|
@@ -2059,7 +2056,7 @@ function patch(ts2, configFile, extractCache3, resolutionCache, host, ps) {
|
|
|
2059
2056
|
const tagNameMatch = importTagReg3.exec(moduleName);
|
|
2060
2057
|
if (tagNameMatch) {
|
|
2061
2058
|
const [, tagName] = tagNameMatch;
|
|
2062
|
-
const tagDef =
|
|
2059
|
+
const tagDef = Project4.getTagLookup(
|
|
2063
2060
|
path7.dirname(containingFile)
|
|
2064
2061
|
).getTag(tagName);
|
|
2065
2062
|
const tagFileName = tagDef && (tagDef.template || tagDef.renderer);
|
|
@@ -2388,7 +2385,7 @@ var ScriptService = {
|
|
|
2388
2385
|
if (!filename) return;
|
|
2389
2386
|
const tsProject = getTSProject(filename);
|
|
2390
2387
|
const extracted = processScript(doc, tsProject);
|
|
2391
|
-
const lang =
|
|
2388
|
+
const lang = Project5.getScriptLang(
|
|
2392
2389
|
filename,
|
|
2393
2390
|
tsProject.markoScriptLang,
|
|
2394
2391
|
ts,
|
|
@@ -2742,9 +2739,9 @@ function processScript(doc, tsProject) {
|
|
|
2742
2739
|
ts,
|
|
2743
2740
|
parsed,
|
|
2744
2741
|
lookup,
|
|
2745
|
-
translator:
|
|
2746
|
-
scriptLang: filename ?
|
|
2747
|
-
runtimeTypesCode:
|
|
2742
|
+
translator: Project5.getConfig(dirname).translator,
|
|
2743
|
+
scriptLang: filename ? Project5.getScriptLang(filename, markoScriptLang, ts, host) : markoScriptLang,
|
|
2744
|
+
runtimeTypesCode: Project5.getTypeLibs(tsProject.rootDir, ts, host)?.markoTypesCode
|
|
2748
2745
|
});
|
|
2749
2746
|
});
|
|
2750
2747
|
}
|
|
@@ -2797,7 +2794,7 @@ function docLocationAtTextSpan(doc, { start, length }) {
|
|
|
2797
2794
|
function getTSConfigFile(fileName) {
|
|
2798
2795
|
let configFile;
|
|
2799
2796
|
const docFsDir = path8.dirname(fileName);
|
|
2800
|
-
const cache =
|
|
2797
|
+
const cache = Project5.getCache(docFsDir);
|
|
2801
2798
|
let configFileCache = cache.get(getTSConfigFile);
|
|
2802
2799
|
if (configFileCache) {
|
|
2803
2800
|
configFile = configFileCache.get(docFsDir);
|
|
@@ -2821,7 +2818,7 @@ function getTSProject(docFsPath) {
|
|
|
2821
2818
|
}
|
|
2822
2819
|
}
|
|
2823
2820
|
const basePath = configFile && path8.dirname(configFile) || process.cwd();
|
|
2824
|
-
const cache =
|
|
2821
|
+
const cache = Project5.getCache(configFile && basePath);
|
|
2825
2822
|
let projectCache = cache.get(getTSProject);
|
|
2826
2823
|
let cached;
|
|
2827
2824
|
if (projectCache) {
|
|
@@ -3942,7 +3939,7 @@ for (const command in service.commands) {
|
|
|
3942
3939
|
}
|
|
3943
3940
|
function validateDocs() {
|
|
3944
3941
|
queueDiagnostic();
|
|
3945
|
-
|
|
3942
|
+
Project6.clearCaches();
|
|
3946
3943
|
}
|
|
3947
3944
|
function queueDiagnostic() {
|
|
3948
3945
|
clearTimeout(diagnosticTimeout);
|