@xano/xanoscript-language-server 11.6.2 → 11.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/xanoscript-language-server",
3
- "version": "11.6.2",
3
+ "version": "11.6.3",
4
4
  "description": "Language Server Protocol implementation for XanoScript",
5
5
  "type": "module",
6
6
  "main": "server.js",
@@ -55,8 +55,7 @@ export function tryCatchFn($) {
55
55
  }
56
56
 
57
57
  if (!hasCatch) {
58
- $.CONSUME(CatchToken);
59
- $.SUBRULE($.nakedStackFn);
58
+ $.addWarning("try_catch without a catch block will not handle errors");
60
59
  }
61
60
 
62
61
  $.MANY1(() => $.CONSUME1(NewlineToken));
@@ -20,6 +20,18 @@ describe("tryCatchFn", () => {
20
20
  expect(parser.errors).to.be.empty;
21
21
  });
22
22
 
23
+ it("tryCatchFn only try is required, catch and finally are optional", () => {
24
+ const parser = parse(`try_catch {
25
+ try {
26
+ var $x1 {
27
+ value = "try"
28
+ }
29
+ }
30
+ }`);
31
+ expect(parser.errors).to.be.empty;
32
+ expect(parser.warnings).to.not.be.empty;
33
+ });
34
+
23
35
  it("tryCatchFn try and catch can contain a stack", () => {
24
36
  const parser = parse(`try_catch {
25
37
  try {
@@ -166,7 +178,7 @@ describe("tryCatchFn", () => {
166
178
  expect(parser.errors).to.not.be.empty;
167
179
  });
168
180
 
169
- it("tryCatchFn requires a catch block", () => {
181
+ it("tryCatchFn warns when catch block is missing", () => {
170
182
  const parser = parse(`try_catch {
171
183
  try {
172
184
  var $x1 {
@@ -174,6 +186,8 @@ describe("tryCatchFn", () => {
174
186
  }
175
187
  }
176
188
  }`);
177
- expect(parser.errors).to.not.be.empty;
189
+ expect(parser.errors).to.be.empty;
190
+ expect(parser.warnings).to.not.be.empty;
191
+ expect(parser.warnings[0].message).to.include("catch");
178
192
  });
179
193
  });