@marko/language-server 1.0.14 → 1.0.15
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 +39 -9
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +39 -9
- package/dist/index.mjs.map +2 -2
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -771,26 +771,56 @@ var doValidate = (doc) => {
|
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
);
|
|
774
|
-
} catch (
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
character: (parseInt(rawCol, 10) || 1) - 1
|
|
781
|
-
};
|
|
774
|
+
} catch (err) {
|
|
775
|
+
if (isErrorWithLoc(err)) {
|
|
776
|
+
const message = err.label || err.message || err.stack;
|
|
777
|
+
if (!message)
|
|
778
|
+
return;
|
|
779
|
+
const { loc } = err;
|
|
782
780
|
diagnostics.push({
|
|
783
|
-
range: {
|
|
781
|
+
range: {
|
|
782
|
+
start: {
|
|
783
|
+
line: loc.start.line - 1,
|
|
784
|
+
character: loc.start.column
|
|
785
|
+
},
|
|
786
|
+
end: {
|
|
787
|
+
line: loc.end.line - 1,
|
|
788
|
+
character: loc.end.column
|
|
789
|
+
}
|
|
790
|
+
},
|
|
784
791
|
source: "marko",
|
|
785
792
|
code: void 0,
|
|
786
793
|
tags: void 0,
|
|
787
794
|
severity: import_vscode_languageserver7.DiagnosticSeverity.Error,
|
|
788
795
|
message
|
|
789
796
|
});
|
|
797
|
+
} else {
|
|
798
|
+
let match;
|
|
799
|
+
while (match = markoErrorRegExp.exec(err.message)) {
|
|
800
|
+
const [, , rawLine, rawCol, message] = match;
|
|
801
|
+
const pos = {
|
|
802
|
+
line: (parseInt(rawLine, 10) || 1) - 1,
|
|
803
|
+
character: (parseInt(rawCol, 10) || 1) - 1
|
|
804
|
+
};
|
|
805
|
+
diagnostics.push({
|
|
806
|
+
range: { start: pos, end: pos },
|
|
807
|
+
source: "marko",
|
|
808
|
+
code: void 0,
|
|
809
|
+
tags: void 0,
|
|
810
|
+
severity: import_vscode_languageserver7.DiagnosticSeverity.Error,
|
|
811
|
+
message
|
|
812
|
+
});
|
|
813
|
+
}
|
|
790
814
|
}
|
|
791
815
|
}
|
|
792
816
|
return diagnostics;
|
|
793
817
|
};
|
|
818
|
+
function isErrorWithLoc(err) {
|
|
819
|
+
const loc = err == null ? void 0 : err.loc;
|
|
820
|
+
if (typeof loc !== "object")
|
|
821
|
+
return false;
|
|
822
|
+
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";
|
|
823
|
+
}
|
|
794
824
|
|
|
795
825
|
// src/service/marko/hover/index.ts
|
|
796
826
|
var import_language_tools7 = require("@marko/language-tools");
|