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