@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.js
CHANGED
|
@@ -34,15 +34,17 @@ var import_vscode_uri = require("vscode-uri");
|
|
|
34
34
|
var processorCaches = /* @__PURE__ */ new WeakMap();
|
|
35
35
|
function getFSDir(doc) {
|
|
36
36
|
const filename = getFSPath(doc);
|
|
37
|
-
return filename
|
|
37
|
+
return filename && import_path.default.dirname(filename);
|
|
38
38
|
}
|
|
39
39
|
function getFSPath(doc) {
|
|
40
|
-
|
|
40
|
+
const parsed = import_vscode_uri.URI.parse(doc.uri);
|
|
41
|
+
return parsed.scheme === "file" ? parsed.fsPath : void 0;
|
|
41
42
|
}
|
|
42
43
|
function getMarkoFile(doc) {
|
|
43
44
|
const { uri } = doc;
|
|
44
|
-
const { fsPath
|
|
45
|
-
const
|
|
45
|
+
const { fsPath, scheme } = import_vscode_uri.URI.parse(uri);
|
|
46
|
+
const filename = scheme === "file" ? fsPath : void 0;
|
|
47
|
+
const dirname = filename ? import_path.default.dirname(filename) : process.cwd();
|
|
46
48
|
const cache = import_language_tools.Project.getCache(dirname);
|
|
47
49
|
let file = cache.get(doc);
|
|
48
50
|
if (!file) {
|
|
@@ -67,10 +69,7 @@ function getMarkoFile(doc) {
|
|
|
67
69
|
return file;
|
|
68
70
|
}
|
|
69
71
|
function clearMarkoCacheForFile(doc) {
|
|
70
|
-
|
|
71
|
-
const dirname = filename && import_path.default.dirname(filename);
|
|
72
|
-
const cache = import_language_tools.Project.getCache(dirname);
|
|
73
|
-
cache.delete(doc);
|
|
72
|
+
import_language_tools.Project.getCache(getFSDir(doc)).delete(doc);
|
|
74
73
|
}
|
|
75
74
|
function processDoc(doc, process2) {
|
|
76
75
|
const file = getMarkoFile(doc);
|
|
@@ -2784,7 +2783,7 @@ function processScript(doc, tsProject) {
|
|
|
2784
2783
|
ts: import_tsserverlibrary.default,
|
|
2785
2784
|
parsed,
|
|
2786
2785
|
lookup,
|
|
2787
|
-
scriptLang: import_language_tools16.Project.getScriptLang(filename, markoScriptLang, import_tsserverlibrary.default, host),
|
|
2786
|
+
scriptLang: filename ? import_language_tools16.Project.getScriptLang(filename, markoScriptLang, import_tsserverlibrary.default, host) : markoScriptLang,
|
|
2788
2787
|
runtimeTypesCode: (_a = import_language_tools16.Project.getTypeLibs(tsProject.rootDir, import_tsserverlibrary.default, host)) == null ? void 0 : _a.markoTypesCode
|
|
2789
2788
|
});
|
|
2790
2789
|
});
|