File tree 2 files changed +21
-9
lines changed
2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -555,19 +555,14 @@ function vm.viewKey(source, uri)
555
555
return ' [' .. key .. ' ]'
556
556
end
557
557
end
558
- if source .type == ' tableindex' then
558
+ if source .type == ' tableindex'
559
+ or source .type == ' setindex' then
559
560
local index = source .index
560
- local name = vm .getKeyName (index )
561
+ local name = vm .getInfer (index ): viewLiterals ( )
561
562
if not name then
562
563
return nil
563
564
end
564
- local key
565
- if index .type == ' string' then
566
- key = util .viewString (name , index [2 ])
567
- else
568
- key = util .viewLiteral (name )
569
- end
570
- return (' [%s]' ):format (key ), name
565
+ return (' [%s]' ):format (name ), name
571
566
end
572
567
if source .type == ' tableexp' then
573
568
return (' [%d]' ):format (source .tindex ), source .tindex
Original file line number Diff line number Diff line change @@ -2430,3 +2430,20 @@ local t: {
2430
2430
['y']: integer = 2,
2431
2431
}
2432
2432
]]
2433
+
2434
+ TEST [[
2435
+ local enum = { a = 1, b = 2 }
2436
+
2437
+ local <?t?> = {
2438
+ [enum.a] = true,
2439
+ [enum.b] = 2,
2440
+ [3] = {}
2441
+ }
2442
+ ]]
2443
+ [[
2444
+ local t: {
2445
+ [1]: boolean = true,
2446
+ [2]: integer = 2,
2447
+ [3]: table,
2448
+ }
2449
+ ]]
You can’t perform that action at this time.
0 commit comments