-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triagedIssue has been triaged by sub teamIssue has been triaged by sub teamvm-serviceThe VM Service Protocol, both the specification and its implementationThe VM Service Protocol, both the specification and its implementation
Description
In VS Code's debug adapter and the new SDK DAP implementation, there is a setting that allows showing values of getters in debug tooltips/watch window/etc.. This works by walking up the class hierarchy getting all of the names of any getters at each level and then sending evaluate requests for each.
This code seems fragile and involves looking at an internal field to identify the getters (f.json?['_kind'] == 'GetterFunction'
). It would be better to have a more official way to do this (and perhaps in a single request).
sdk/pkg/dds/lib/src/dap/protocol_converter.dart
Lines 444 to 475 in 248e943
/// Collect a list of all getter names for [classRef] and its super classes. | |
/// | |
/// This is used to show/evaluate getters in debug views like hovers and | |
/// variables/watch panes. | |
Future<Set<String>> _getterNamesForClassHierarchy( | |
ThreadInfo thread, | |
vm.ClassRef? classRef, | |
) async { | |
final getterNames = <String>{}; | |
final service = _adapter.vmService; | |
while (service != null && classRef != null) { | |
final classResponse = | |
await service.getObject(thread.isolate.id!, classRef.id!); | |
if (classResponse is! vm.Class) { | |
break; | |
} | |
final functions = classResponse.functions; | |
if (functions != null) { | |
final instanceFields = functions.where((f) => | |
// TODO(dantup): Update this to use something better that bkonyi is | |
// adding to the protocol. | |
f.json?['_kind'] == 'GetterFunction' && | |
!(f.isStatic ?? false) && | |
!(f.isConst ?? false)); | |
getterNames.addAll(instanceFields.map((f) => f.name!)); | |
} | |
classRef = classResponse.superClass; | |
} | |
return getterNames; | |
} |
@bkonyi (I think @jacob314 may also have been interested in this?)
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triagedIssue has been triaged by sub teamIssue has been triaged by sub teamvm-serviceThe VM Service Protocol, both the specification and its implementationThe VM Service Protocol, both the specification and its implementation