Skip to content

Commit 54b9a5e

Browse files
committed
Skip unnecessary values when 0
These values are assumed to be 0 if they're missing.
1 parent b24af44 commit 54b9a5e

12 files changed

+4
-269
lines changed

Diff for: lib/debug/server_dap.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -849,14 +849,12 @@ def process_dap args
849849
presentationHint: 'locals',
850850
# variablesReference: N, # filled by SESSION
851851
namedVariables: lnum,
852-
indexedVariables: 0,
853852
expensive: false,
854853
}, {
855854
name: 'Global variables',
856855
presentationHint: 'globals',
857856
variablesReference: 1, # GLOBAL
858857
namedVariables: safe_global_variables.size,
859-
indexedVariables: 0,
860858
expensive: false,
861859
}]
862860
when :scope
@@ -1052,18 +1050,19 @@ def render_variable member
10521050
value: member.inspect_value,
10531051
type: member.value_type_name,
10541052
variablesReference: vid,
1053+
indexedVariables: indexedVariables,
1054+
namedVariables: namedVariables,
10551055
}
10561056
else
10571057
{
10581058
value: member.inspect_value,
10591059
type: member.value_type_name,
10601060
variablesReference: vid,
1061+
indexedVariables: indexedVariables,
1062+
namedVariables: namedVariables,
10611063
}
10621064
end
10631065

1064-
variable[:indexedVariables] = indexedVariables unless indexedVariables == 0
1065-
variable[:namedVariables] = namedVariables unless namedVariables == 0
1066-
10671066
variable
10681067
end
10691068
end

Diff for: test/protocol/boot_config_raw_dap_test.rb

-3
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ def test_boot_configuration_works_correctly
200200
name: "Local variables",
201201
presentationHint: "locals",
202202
namedVariables: /\d+/,
203-
indexedVariables: 0,
204203
expensive: false,
205204
variablesReference: 2
206205
},
@@ -209,7 +208,6 @@ def test_boot_configuration_works_correctly
209208
presentationHint: "globals",
210209
variablesReference: 1,
211210
namedVariables: /\d+/,
212-
indexedVariables: 0,
213211
expensive: false
214212
}
215213
]
@@ -237,7 +235,6 @@ def test_boot_configuration_works_correctly
237235
value: "main",
238236
type: "Object",
239237
variablesReference: 3,
240-
indexedVariables: 0,
241238
namedVariables: /\d+/
242239
}
243240
]

Diff for: test/protocol/break_raw_dap_test.rb

-21
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def test_break_works_correctly
127127
name: "Local variables",
128128
presentationHint: "locals",
129129
namedVariables: /\d+/,
130-
indexedVariables: 0,
131130
expensive: false,
132131
variablesReference: 2
133132
},
@@ -136,7 +135,6 @@ def test_break_works_correctly
136135
presentationHint: "globals",
137136
variablesReference: 1,
138137
namedVariables: /\d+/,
139-
indexedVariables: 0,
140138
expensive: false
141139
}
142140
]
@@ -164,7 +162,6 @@ def test_break_works_correctly
164162
value: "main",
165163
type: "Object",
166164
variablesReference: 3,
167-
indexedVariables: 0,
168165
namedVariables: /\d+/
169166
}
170167
]
@@ -416,7 +413,6 @@ def test_break_works_correctly
416413
name: "Local variables",
417414
presentationHint: "locals",
418415
namedVariables: /\d+/,
419-
indexedVariables: 0,
420416
expensive: false,
421417
variablesReference: 4
422418
},
@@ -425,7 +421,6 @@ def test_break_works_correctly
425421
presentationHint: "globals",
426422
variablesReference: 1,
427423
namedVariables: /\d+/,
428-
indexedVariables: 0,
429424
expensive: false
430425
}
431426
]
@@ -453,15 +448,13 @@ def test_break_works_correctly
453448
value: "Foo",
454449
type: "Module",
455450
variablesReference: 5,
456-
indexedVariables: 0,
457451
namedVariables: /\d+/
458452
},
459453
{
460454
name: "bar",
461455
value: "nil",
462456
type: "NilClass",
463457
variablesReference: 6,
464-
indexedVariables: 0,
465458
namedVariables: /\d+/
466459
}
467460
]
@@ -595,7 +588,6 @@ def test_break_works_correctly
595588
name: "Local variables",
596589
presentationHint: "locals",
597590
namedVariables: /\d+/,
598-
indexedVariables: 0,
599591
expensive: false,
600592
variablesReference: 7
601593
},
@@ -604,7 +596,6 @@ def test_break_works_correctly
604596
presentationHint: "globals",
605597
variablesReference: 1,
606598
namedVariables: /\d+/,
607-
indexedVariables: 0,
608599
expensive: false
609600
}
610601
]
@@ -632,7 +623,6 @@ def test_break_works_correctly
632623
value: "Foo::Bar",
633624
type: "Class",
634625
variablesReference: 8,
635-
indexedVariables: 0,
636626
namedVariables: /\d+/
637627
}
638628
]
@@ -755,7 +745,6 @@ def test_break_works_correctly
755745
name: "Local variables",
756746
presentationHint: "locals",
757747
namedVariables: /\d+/,
758-
indexedVariables: 0,
759748
expensive: false,
760749
variablesReference: 9
761750
},
@@ -764,7 +753,6 @@ def test_break_works_correctly
764753
presentationHint: "globals",
765754
variablesReference: 1,
766755
namedVariables: /\d+/,
767-
indexedVariables: 0,
768756
expensive: false
769757
}
770758
]
@@ -792,15 +780,13 @@ def test_break_works_correctly
792780
value: "Foo",
793781
type: "Module",
794782
variablesReference: 10,
795-
indexedVariables: 0,
796783
namedVariables: /\d+/
797784
},
798785
{
799786
name: "bar",
800787
value: "nil",
801788
type: "NilClass",
802789
variablesReference: 11,
803-
indexedVariables: 0,
804790
namedVariables: /\d+/
805791
}
806792
]
@@ -953,7 +939,6 @@ def test_check_run_to_line_works_correctly
953939
name: "Local variables",
954940
presentationHint: "locals",
955941
namedVariables: /\d+/,
956-
indexedVariables: 0,
957942
expensive: false,
958943
variablesReference: 2
959944
},
@@ -962,7 +947,6 @@ def test_check_run_to_line_works_correctly
962947
presentationHint: "globals",
963948
variablesReference: 1,
964949
namedVariables: /\d+/,
965-
indexedVariables: 0,
966950
expensive: false
967951
}
968952
]
@@ -990,7 +974,6 @@ def test_check_run_to_line_works_correctly
990974
value: "main",
991975
type: "Object",
992976
variablesReference: 3,
993-
indexedVariables: 0,
994977
namedVariables: /\d+/
995978
}
996979
]
@@ -1149,7 +1132,6 @@ def test_check_run_to_line_works_correctly
11491132
name: "Local variables",
11501133
presentationHint: "locals",
11511134
namedVariables: /\d+/,
1152-
indexedVariables: 0,
11531135
expensive: false,
11541136
variablesReference: 4
11551137
},
@@ -1158,7 +1140,6 @@ def test_check_run_to_line_works_correctly
11581140
presentationHint: "globals",
11591141
variablesReference: 1,
11601142
namedVariables: /\d+/,
1161-
indexedVariables: 0,
11621143
expensive: false
11631144
}
11641145
]
@@ -1186,15 +1167,13 @@ def test_check_run_to_line_works_correctly
11861167
value: "Foo",
11871168
type: "Module",
11881169
variablesReference: 5,
1189-
indexedVariables: 0,
11901170
namedVariables: /\d+/
11911171
},
11921172
{
11931173
name: "bar",
11941174
value: "nil",
11951175
type: "NilClass",
11961176
variablesReference: 6,
1197-
indexedVariables: 0,
11981177
namedVariables: /\d+/
11991178
}
12001179
]

Diff for: test/protocol/call_stack_raw_dap_test.rb

-13
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def test_call_stack_works_correctly_1643805481
127127
name: "Local variables",
128128
presentationHint: "locals",
129129
namedVariables: /\d+/,
130-
indexedVariables: 0,
131130
expensive: false,
132131
variablesReference: 2
133132
},
@@ -136,7 +135,6 @@ def test_call_stack_works_correctly_1643805481
136135
presentationHint: "globals",
137136
variablesReference: 1,
138137
namedVariables: /\d+/,
139-
indexedVariables: 0,
140138
expensive: false
141139
}
142140
]
@@ -164,7 +162,6 @@ def test_call_stack_works_correctly_1643805481
164162
value: "main",
165163
type: "Object",
166164
variablesReference: 3,
167-
indexedVariables: 0,
168165
namedVariables: /\d+/
169166
}
170167
]
@@ -334,7 +331,6 @@ def test_call_stack_works_correctly_1643805481
334331
name: "Local variables",
335332
presentationHint: "locals",
336333
namedVariables: /\d+/,
337-
indexedVariables: 0,
338334
expensive: false,
339335
variablesReference: 4
340336
},
@@ -343,7 +339,6 @@ def test_call_stack_works_correctly_1643805481
343339
presentationHint: "globals",
344340
variablesReference: 1,
345341
namedVariables: /\d+/,
346-
indexedVariables: 0,
347342
expensive: false
348343
}
349344
]
@@ -371,7 +366,6 @@ def test_call_stack_works_correctly_1643805481
371366
value: "Foo::Bar",
372367
type: "Class",
373368
variablesReference: 5,
374-
indexedVariables: 0,
375369
namedVariables: /\d+/
376370
}
377371
]
@@ -398,7 +392,6 @@ def test_call_stack_works_correctly_1643805481
398392
name: "Local variables",
399393
presentationHint: "locals",
400394
namedVariables: /\d+/,
401-
indexedVariables: 0,
402395
expensive: false,
403396
variablesReference: 6
404397
},
@@ -407,7 +400,6 @@ def test_call_stack_works_correctly_1643805481
407400
presentationHint: "globals",
408401
variablesReference: 1,
409402
namedVariables: /\d+/,
410-
indexedVariables: 0,
411403
expensive: false
412404
}
413405
]
@@ -435,15 +427,13 @@ def test_call_stack_works_correctly_1643805481
435427
value: "Foo",
436428
type: "Module",
437429
variablesReference: 7,
438-
indexedVariables: 0,
439430
namedVariables: /\d+/
440431
},
441432
{
442433
name: "bar",
443434
value: "nil",
444435
type: "NilClass",
445436
variablesReference: 8,
446-
indexedVariables: 0,
447437
namedVariables: /\d+/
448438
}
449439
]
@@ -470,7 +460,6 @@ def test_call_stack_works_correctly_1643805481
470460
name: "Local variables",
471461
presentationHint: "locals",
472462
namedVariables: /\d+/,
473-
indexedVariables: 0,
474463
expensive: false,
475464
variablesReference: 9
476465
},
@@ -479,7 +468,6 @@ def test_call_stack_works_correctly_1643805481
479468
presentationHint: "globals",
480469
variablesReference: 1,
481470
namedVariables: /\d+/,
482-
indexedVariables: 0,
483471
expensive: false
484472
}
485473
]
@@ -507,7 +495,6 @@ def test_call_stack_works_correctly_1643805481
507495
value: "main",
508496
type: "Object",
509497
variablesReference: 10,
510-
indexedVariables: 0,
511498
namedVariables: /\d+/
512499
}
513500
]

0 commit comments

Comments
 (0)