@marko/language-server 1.1.4 → 1.1.5
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 +8 -9
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +8 -9
- package/dist/index.mjs.map +2 -2
- package/dist/utils/file.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -22,15 +22,17 @@ import { URI } from "vscode-uri";
|
|
|
22
22
|
var processorCaches = /* @__PURE__ */ new WeakMap();
|
|
23
23
|
function getFSDir(doc) {
|
|
24
24
|
const filename = getFSPath(doc);
|
|
25
|
-
return filename
|
|
25
|
+
return filename && path.dirname(filename);
|
|
26
26
|
}
|
|
27
27
|
function getFSPath(doc) {
|
|
28
|
-
|
|
28
|
+
const parsed = URI.parse(doc.uri);
|
|
29
|
+
return parsed.scheme === "file" ? parsed.fsPath : void 0;
|
|
29
30
|
}
|
|
30
31
|
function getMarkoFile(doc) {
|
|
31
32
|
const { uri } = doc;
|
|
32
|
-
const { fsPath
|
|
33
|
-
const
|
|
33
|
+
const { fsPath, scheme } = URI.parse(uri);
|
|
34
|
+
const filename = scheme === "file" ? fsPath : void 0;
|
|
35
|
+
const dirname = filename ? path.dirname(filename) : process.cwd();
|
|
34
36
|
const cache = Project.getCache(dirname);
|
|
35
37
|
let file = cache.get(doc);
|
|
36
38
|
if (!file) {
|
|
@@ -55,10 +57,7 @@ function getMarkoFile(doc) {
|
|
|
55
57
|
return file;
|
|
56
58
|
}
|
|
57
59
|
function clearMarkoCacheForFile(doc) {
|
|
58
|
-
|
|
59
|
-
const dirname = filename && path.dirname(filename);
|
|
60
|
-
const cache = Project.getCache(dirname);
|
|
61
|
-
cache.delete(doc);
|
|
60
|
+
Project.getCache(getFSDir(doc)).delete(doc);
|
|
62
61
|
}
|
|
63
62
|
function processDoc(doc, process2) {
|
|
64
63
|
const file = getMarkoFile(doc);
|
|
@@ -2812,7 +2811,7 @@ function processScript(doc, tsProject) {
|
|
|
2812
2811
|
ts,
|
|
2813
2812
|
parsed,
|
|
2814
2813
|
lookup,
|
|
2815
|
-
scriptLang: Project5.getScriptLang(filename, markoScriptLang, ts, host),
|
|
2814
|
+
scriptLang: filename ? Project5.getScriptLang(filename, markoScriptLang, ts, host) : markoScriptLang,
|
|
2816
2815
|
runtimeTypesCode: (_a = Project5.getTypeLibs(tsProject.rootDir, ts, host)) == null ? void 0 : _a.markoTypesCode
|
|
2817
2816
|
});
|
|
2818
2817
|
});
|