z_mirror/luapls

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

Caleb HeuerFix testsa9d7242

main
7.6 KiB353 linesraw
1[
2  {
3    "Label": "standard_numeric",
4    "Input": "for i = 1, 100 do end",
5    "AST": {
6      "Type": "Block",
7      "Range": {
8        "Start": 0,
9        "End": 21
10      },
11      "Stmts": [
12        {
13          "Type": "ForStatement",
14          "Range": {
15            "Start": 0,
16            "End": 21
17          },
18          "Name": {
19            "Type": "Identifier",
20            "Range": {
21              "Start": 4,
22              "End": 5
23            },
24            "Literal": "i"
25          },
26          "Start": {
27            "Type": "NumberLiteral",
28            "Range": {
29              "Start": 8,
30              "End": 9
31            },
32            "Literal": "1",
33            "Value": 1
34          },
35          "Finish": {
36            "Type": "NumberLiteral",
37            "Range": {
38              "Start": 11,
39              "End": 14
40            },
41            "Literal": "100",
42            "Value": 100
43          },
44          "Step": null,
45          "Body": {
46            "Type": "Block",
47            "Range": {
48              "Start": 18,
49              "End": 18
50            },
51            "Stmts": []
52          }
53        }
54      ]
55    }
56  },
57  {
58    "Label": "stepped_numeric",
59    "Input": "for i = 1, 100, 5 do end",
60    "AST": {
61      "Type": "Block",
62      "Range": {
63        "Start": 0,
64        "End": 24
65      },
66      "Stmts": [
67        {
68          "Type": "ForStatement",
69          "Range": {
70            "Start": 0,
71            "End": 24
72          },
73          "Name": {
74            "Type": "Identifier",
75            "Range": {
76              "Start": 4,
77              "End": 5
78            },
79            "Literal": "i"
80          },
81          "Start": {
82            "Type": "NumberLiteral",
83            "Range": {
84              "Start": 8,
85              "End": 9
86            },
87            "Literal": "1",
88            "Value": 1
89          },
90          "Finish": {
91            "Type": "NumberLiteral",
92            "Range": {
93              "Start": 11,
94              "End": 14
95            },
96            "Literal": "100",
97            "Value": 100
98          },
99          "Step": {
100            "Type": "NumberLiteral",
101            "Range": {
102              "Start": 16,
103              "End": 17
104            },
105            "Literal": "5",
106            "Value": 5
107          },
108          "Body": {
109            "Type": "Block",
110            "Range": {
111              "Start": 21,
112              "End": 21
113            },
114            "Stmts": []
115          }
116        }
117      ]
118    }
119  },
120  {
121    "Label": "reverse_numeric",
122    "Input": "for i = 100, -1, -2 do end",
123    "AST": {
124      "Type": "Block",
125      "Range": {
126        "Start": 0,
127        "End": 26
128      },
129      "Stmts": [
130        {
131          "Type": "ForStatement",
132          "Range": {
133            "Start": 0,
134            "End": 26
135          },
136          "Name": {
137            "Type": "Identifier",
138            "Range": {
139              "Start": 4,
140              "End": 5
141            },
142            "Literal": "i"
143          },
144          "Start": {
145            "Type": "NumberLiteral",
146            "Range": {
147              "Start": 8,
148              "End": 11
149            },
150            "Literal": "100",
151            "Value": 100
152          },
153          "Finish": {
154            "Type": "PrefixExpression",
155            "Range": {
156              "Start": 13,
157              "End": 15
158            },
159            "Operator": "minus",
160            "Right": {
161              "Type": "NumberLiteral",
162              "Range": {
163                "Start": 14,
164                "End": 15
165              },
166              "Literal": "1",
167              "Value": 1
168            }
169          },
170          "Step": {
171            "Type": "PrefixExpression",
172            "Range": {
173              "Start": 17,
174              "End": 19
175            },
176            "Operator": "minus",
177            "Right": {
178              "Type": "NumberLiteral",
179              "Range": {
180                "Start": 18,
181                "End": 19
182              },
183              "Literal": "2",
184              "Value": 2
185            }
186          },
187          "Body": {
188            "Type": "Block",
189            "Range": {
190              "Start": 23,
191              "End": 23
192            },
193            "Stmts": []
194          }
195        }
196      ]
197    }
198  },
199  {
200    "Label": "generic_pairs",
201    "Input": "for key, value in pairs({}) do end",
202    "AST": {
203      "Type": "Block",
204      "Range": {
205        "Start": 0,
206        "End": 34
207      },
208      "Stmts": [
209        {
210          "Type": "ForInStatement",
211          "Range": {
212            "Start": 0,
213            "End": 34
214          },
215          "Names": [
216            {
217              "Type": "Identifier",
218              "Range": {
219                "Start": 4,
220                "End": 7
221              },
222              "Literal": "key"
223            },
224            {
225              "Type": "Identifier",
226              "Range": {
227                "Start": 9,
228                "End": 14
229              },
230              "Literal": "value"
231            }
232          ],
233          "Exps": [
234            {
235              "Type": "FunctionCall",
236              "Range": {
237                "Start": 18,
238                "End": 27
239              },
240              "Left": {
241                "Type": "Identifier",
242                "Range": {
243                  "Start": 18,
244                  "End": 23
245                },
246                "Literal": "pairs"
247              },
248              "Args": [
249                {
250                  "Type": "TableLiteral",
251                  "Range": {
252                    "Start": 24,
253                    "End": 26
254                  },
255                  "Fields": [],
256                  "StartPos": 24
257                }
258              ]
259            }
260          ],
261          "Body": {
262            "Type": "Block",
263            "Range": {
264              "Start": 31,
265              "End": 31
266            },
267            "Stmts": []
268          }
269        }
270      ]
271    }
272  },
273  {
274    "Label": "generic_five_values",
275    "Input": "for first, second, third, fourth, fifth in some_iterable_variable do end",
276    "AST": {
277      "Type": "Block",
278      "Range": {
279        "Start": 0,
280        "End": 72
281      },
282      "Stmts": [
283        {
284          "Type": "ForInStatement",
285          "Range": {
286            "Start": 0,
287            "End": 72
288          },
289          "Names": [
290            {
291              "Type": "Identifier",
292              "Range": {
293                "Start": 4,
294                "End": 9
295              },
296              "Literal": "first"
297            },
298            {
299              "Type": "Identifier",
300              "Range": {
301                "Start": 11,
302                "End": 17
303              },
304              "Literal": "second"
305            },
306            {
307              "Type": "Identifier",
308              "Range": {
309                "Start": 19,
310                "End": 24
311              },
312              "Literal": "third"
313            },
314            {
315              "Type": "Identifier",
316              "Range": {
317                "Start": 26,
318                "End": 32
319              },
320              "Literal": "fourth"
321            },
322            {
323              "Type": "Identifier",
324              "Range": {
325                "Start": 34,
326                "End": 39
327              },
328              "Literal": "fifth"
329            }
330          ],
331          "Exps": [
332            {
333              "Type": "Identifier",
334              "Range": {
335                "Start": 43,
336                "End": 65
337              },
338              "Literal": "some_iterable_variable"
339            }
340          ],
341          "Body": {
342            "Type": "Block",
343            "Range": {
344              "Start": 69,
345              "End": 69
346            },
347            "Stmts": []
348          }
349        }
350      ]
351    }
352  }
353]