z_mirror/luapls

git clone https://git.raiguard.me/z_mirror/luapls

Caleb HeuerFix testsa9d7242

main
10.2 KiB470 linesraw
1[
2  {
3    "Label": "plain",
4    "Input": "print(foo)",
5    "AST": {
6      "Type": "Block",
7      "Range": {
8        "Start": 0,
9        "End": 10
10      },
11      "Stmts": [
12        {
13          "Type": "FunctionCall",
14          "Range": {
15            "Start": 0,
16            "End": 10
17          },
18          "Left": {
19            "Type": "Identifier",
20            "Range": {
21              "Start": 0,
22              "End": 5
23            },
24            "Literal": "print"
25          },
26          "Args": [
27            {
28              "Type": "Identifier",
29              "Range": {
30                "Start": 6,
31                "End": 9
32              },
33              "Literal": "foo"
34            }
35          ]
36        }
37      ]
38    }
39  },
40  {
41    "Label": "plain_table",
42    "Input": "print{msg = 'foo'}",
43    "AST": {
44      "Type": "Block",
45      "Range": {
46        "Start": 0,
47        "End": 18
48      },
49      "Stmts": [
50        {
51          "Type": "FunctionCall",
52          "Range": {
53            "Start": 0,
54            "End": 18
55          },
56          "Left": {
57            "Type": "Identifier",
58            "Range": {
59              "Start": 0,
60              "End": 5
61            },
62            "Literal": "print"
63          },
64          "Args": [
65            {
66              "Type": "TableLiteral",
67              "Range": {
68                "Start": 5,
69                "End": 18
70              },
71              "Fields": [
72                {
73                  "Type": "TableField",
74                  "Range": {
75                    "Start": 6,
76                    "End": 17
77                  },
78                  "Key": {
79                    "Type": "Identifier",
80                    "Range": {
81                      "Start": 6,
82                      "End": 9
83                    },
84                    "Literal": "msg"
85                  },
86                  "Value": {
87                    "Type": "StringLiteral",
88                    "Range": {
89                      "Start": 12,
90                      "End": 17
91                    },
92                    "Literal": "'foo'"
93                  }
94                }
95              ],
96              "StartPos": 5
97            }
98          ]
99        }
100      ]
101    }
102  },
103  {
104    "Label": "plain_string",
105    "Input": "print 'foo'",
106    "AST": {
107      "Type": "Block",
108      "Range": {
109        "Start": 0,
110        "End": 11
111      },
112      "Stmts": [
113        {
114          "Type": "FunctionCall",
115          "Range": {
116            "Start": 0,
117            "End": 11
118          },
119          "Left": {
120            "Type": "Identifier",
121            "Range": {
122              "Start": 0,
123              "End": 5
124            },
125            "Literal": "print"
126          },
127          "Args": [
128            {
129              "Type": "StringLiteral",
130              "Range": {
131                "Start": 6,
132                "End": 11
133              },
134              "Literal": "'foo'"
135            }
136          ]
137        }
138      ]
139    }
140  },
141  {
142    "Label": "plain_string_chained",
143    "Input": "print 'foo' 'bar'",
144    "AST": {
145      "Type": "Block",
146      "Range": {
147        "Start": 0,
148        "End": 17
149      },
150      "Stmts": [
151        {
152          "Type": "FunctionCall",
153          "Range": {
154            "Start": 0,
155            "End": 17
156          },
157          "Left": {
158            "Type": "FunctionCall",
159            "Range": {
160              "Start": 0,
161              "End": 11
162            },
163            "Left": {
164              "Type": "Identifier",
165              "Range": {
166                "Start": 0,
167                "End": 5
168              },
169              "Literal": "print"
170            },
171            "Args": [
172              {
173                "Type": "StringLiteral",
174                "Range": {
175                  "Start": 6,
176                  "End": 11
177                },
178                "Literal": "'foo'"
179              }
180            ]
181          },
182          "Args": [
183            {
184              "Type": "StringLiteral",
185              "Range": {
186                "Start": 12,
187                "End": 17
188              },
189              "Literal": "'bar'"
190            }
191          ]
192        }
193      ]
194    }
195  },
196  {
197    "Label": "method",
198    "Input": "foo:bar('baz')",
199    "AST": {
200      "Type": "Block",
201      "Range": {
202        "Start": 0,
203        "End": 14
204      },
205      "Stmts": [
206        {
207          "Type": "FunctionCall",
208          "Range": {
209            "Start": 0,
210            "End": 14
211          },
212          "Left": {
213            "Type": "IndexExpression",
214            "Range": {
215              "Start": 0,
216              "End": 7
217            },
218            "Left": {
219              "Type": "Identifier",
220              "Range": {
221                "Start": 0,
222                "End": 3
223              },
224              "Literal": "foo"
225            },
226            "Indexer": "colon",
227            "Inner": {
228              "Type": "Identifier",
229              "Range": {
230                "Start": 4,
231                "End": 7
232              },
233              "Literal": "bar"
234            }
235          },
236          "Args": [
237            {
238              "Type": "StringLiteral",
239              "Range": {
240                "Start": 8,
241                "End": 13
242              },
243              "Literal": "'baz'"
244            }
245          ]
246        }
247      ]
248    }
249  },
250  {
251    "Label": "method_table",
252    "Input": "foo:bar{msg = 'baz'}",
253    "AST": {
254      "Type": "Block",
255      "Range": {
256        "Start": 0,
257        "End": 20
258      },
259      "Stmts": [
260        {
261          "Type": "FunctionCall",
262          "Range": {
263            "Start": 0,
264            "End": 20
265          },
266          "Left": {
267            "Type": "IndexExpression",
268            "Range": {
269              "Start": 0,
270              "End": 7
271            },
272            "Left": {
273              "Type": "Identifier",
274              "Range": {
275                "Start": 0,
276                "End": 3
277              },
278              "Literal": "foo"
279            },
280            "Indexer": "colon",
281            "Inner": {
282              "Type": "Identifier",
283              "Range": {
284                "Start": 4,
285                "End": 7
286              },
287              "Literal": "bar"
288            }
289          },
290          "Args": [
291            {
292              "Type": "TableLiteral",
293              "Range": {
294                "Start": 7,
295                "End": 20
296              },
297              "Fields": [
298                {
299                  "Type": "TableField",
300                  "Range": {
301                    "Start": 8,
302                    "End": 19
303                  },
304                  "Key": {
305                    "Type": "Identifier",
306                    "Range": {
307                      "Start": 8,
308                      "End": 11
309                    },
310                    "Literal": "msg"
311                  },
312                  "Value": {
313                    "Type": "StringLiteral",
314                    "Range": {
315                      "Start": 14,
316                      "End": 19
317                    },
318                    "Literal": "'baz'"
319                  }
320                }
321              ],
322              "StartPos": 7
323            }
324          ]
325        }
326      ]
327    }
328  },
329  {
330    "Label": "method_string",
331    "Input": "foo:bar 'baz'",
332    "AST": {
333      "Type": "Block",
334      "Range": {
335        "Start": 0,
336        "End": 13
337      },
338      "Stmts": [
339        {
340          "Type": "FunctionCall",
341          "Range": {
342            "Start": 0,
343            "End": 13
344          },
345          "Left": {
346            "Type": "IndexExpression",
347            "Range": {
348              "Start": 0,
349              "End": 7
350            },
351            "Left": {
352              "Type": "Identifier",
353              "Range": {
354                "Start": 0,
355                "End": 3
356              },
357              "Literal": "foo"
358            },
359            "Indexer": "colon",
360            "Inner": {
361              "Type": "Identifier",
362              "Range": {
363                "Start": 4,
364                "End": 7
365              },
366              "Literal": "bar"
367            }
368          },
369          "Args": [
370            {
371              "Type": "StringLiteral",
372              "Range": {
373                "Start": 8,
374                "End": 13
375              },
376              "Literal": "'baz'"
377            }
378          ]
379        }
380      ]
381    }
382  },
383  {
384    "Label": "method_string_chained",
385    "Input": "foo:bar 'baz' :bar 'lorem'",
386    "AST": {
387      "Type": "Block",
388      "Range": {
389        "Start": 0,
390        "End": 26
391      },
392      "Stmts": [
393        {
394          "Type": "FunctionCall",
395          "Range": {
396            "Start": 0,
397            "End": 26
398          },
399          "Left": {
400            "Type": "IndexExpression",
401            "Range": {
402              "Start": 0,
403              "End": 18
404            },
405            "Left": {
406              "Type": "FunctionCall",
407              "Range": {
408                "Start": 0,
409                "End": 13
410              },
411              "Left": {
412                "Type": "IndexExpression",
413                "Range": {
414                  "Start": 0,
415                  "End": 7
416                },
417                "Left": {
418                  "Type": "Identifier",
419                  "Range": {
420                    "Start": 0,
421                    "End": 3
422                  },
423                  "Literal": "foo"
424                },
425                "Indexer": "colon",
426                "Inner": {
427                  "Type": "Identifier",
428                  "Range": {
429                    "Start": 4,
430                    "End": 7
431                  },
432                  "Literal": "bar"
433                }
434              },
435              "Args": [
436                {
437                  "Type": "StringLiteral",
438                  "Range": {
439                    "Start": 8,
440                    "End": 13
441                  },
442                  "Literal": "'baz'"
443                }
444              ]
445            },
446            "Indexer": "colon",
447            "Inner": {
448              "Type": "Identifier",
449              "Range": {
450                "Start": 15,
451                "End": 18
452              },
453              "Literal": "bar"
454            }
455          },
456          "Args": [
457            {
458              "Type": "StringLiteral",
459              "Range": {
460                "Start": 19,
461                "End": 26
462              },
463              "Literal": "'lorem'"
464            }
465          ]
466        }
467      ]
468    }
469  }
470]