Skip to content

Add new getSourceReport parameter #1598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 14.0.1-dev
- Add `libraryFilters` optional parameter to the vm service implememtation
of `getSourceReport`.

## 14.0.0
- Add column information to breakpoints to allow precise breakpoint placement.
- Split SDK validation methods to allow validation of separate components.
Expand Down
16 changes: 10 additions & 6 deletions dwds/lib/src/debugging/inspector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,16 @@ function($argsString) {
/// Return the VM SourceReport for the given parameters.
///
/// Currently this implements the 'PossibleBreakpoints' report kind.
Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
{String scriptId,
int tokenPos,
int endTokenPos,
bool forceCompile,
bool reportLines}) {
Future<SourceReport> getSourceReport(
String isolateId,
List<String> reports, {
String scriptId,
int tokenPos,
int endTokenPos,
bool forceCompile,
bool reportLines,
List<String> libraryFilters,
}) {
checkIsolate('getSourceReport', isolateId);

if (reports.contains(SourceReportKind.kCoverage)) {
Expand Down
12 changes: 6 additions & 6 deletions dwds/lib/src/injected/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 20 additions & 12 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -562,20 +562,28 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
}

@override
Future<SourceReport> getSourceReport(String isolateId, List<String> reports,
{String scriptId,
int tokenPos,
int endTokenPos,
bool forceCompile,
bool reportLines}) async {
Future<SourceReport> getSourceReport(
String isolateId,
List<String> reports, {
String scriptId,
int tokenPos,
int endTokenPos,
bool forceCompile,
bool reportLines,
List<String> libraryFilters,
}) async {
return await captureElapsedTime(() async {
await isInitialized;
return await _inspector?.getSourceReport(isolateId, reports,
scriptId: scriptId,
tokenPos: tokenPos,
endTokenPos: endTokenPos,
forceCompile: forceCompile,
reportLines: reportLines);
return await _inspector?.getSourceReport(
isolateId,
reports,
scriptId: scriptId,
tokenPos: tokenPos,
endTokenPos: endTokenPos,
forceCompile: forceCompile,
reportLines: reportLines,
libraryFilters: libraryFilters,
);
}, (result) => DwdsEvent.getSourceReport());
}

Expand Down
2 changes: 1 addition & 1 deletion dwds/lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dwds/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dwds
# Every time this changes you need to run `dart run build_runner build`.
version: 14.0.0
version: 14.0.1-dev
description: >-
A service that proxies between the Chrome debug protocol and the Dart VM
service protocol.
Expand Down
10 changes: 10 additions & 0 deletions dwds/test/chrome_proxy_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,16 @@ void main() {
service.getSourceReport(isolateId, ['Coverage']), throwsRPCError);
});

test('Coverage report', () async {
var vm = await service.getVM();
var isolateId = vm.isolates.first.id;

await expectLater(
service.getSourceReport(isolateId, ['Coverage'],
libraryFilters: ['foo']),
throwsRPCError);
});

test('report type not understood', () async {
var vm = await service.getVM();
var isolateId = vm.isolates.first.id;
Expand Down