This involves a large refactoring of completion_metrics.dart, extracting
out some common code into completion_metrics_base.dart
The code in completion_metrics.dart and completion_metrics_base.dart is
largely unchanged, but restructured to fit the sub-class structure.
* Rename CompletionMetricsComputer -> CompletionQualityMetricsComputer,
as this is focused on quality metrics.
* Extract out applyOverlay and removeOverlay methods.
* Extract out computeSuggestionsAndMetrics, code which is run per
ExpectedCompletion.
* Extract out setupForResolution, for code custom to the quality
computer.
The meat of this change though is in completion_metrics_client.dart:
* _AnalysisServerClient is code which was extracted from
package:dartdev/src/analysis_server.dart. It may seem like an odd
choice when we have package:analysis_server_client, but I think
dartdev's client is fairly mature in creating a short-lived client,
and handling crashes, etc. If this should be re-combined with dartdev,
I think there are open questions about where that should live, and I'd
like to address that in a follow-up.
* The client does not perform overlays yet.
* The client does not track slowest requests yet.
* The client does not have support for performance metrics which DAS
tracks itself. Adding this is high priority.
Change-Id: Ib259f78e4646d10b61559bfd5700d98a95d14d43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243522
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This option allows the completion position to be an offset from the
start of each token, and plays well in each overlay mode. For the
original content:
```dart
void main() {
foo();
}
```
In OVERLAY_NONE mode, completing on `main`, with `--prefix-length=2`,
we complete at:
```dart
void main() {
^
foo();
}
```
In OVERLAY_REMOVE_TOKEN mode, completing on `main`, with
`--prefix-length=2`, we complete at:
```dart
void ma() {
^
foo();
}
In OVERLAY_REMOVE_REST_OF_FILE mode, completing on `main`, with
`--prefix-length=2`, we complete at:
```dart
void ma
^
```
Change-Id: Id2493777cb38f147f7a2c401a9e53e17561516bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Previously, the 'slowest requests' flag would only track and print the
slowest 5 requests for each category. But this ends up printing many
requests which are not slow at all, and are perfectly reasonable. It is
more interesting to print the slowest results, those in the 90th
percentile.
The limit is set to 100. This is to set a limit on serialization in the
map/reduce system, and a limit on printing to stdout.
Change-Id: I31fde906e227ea195ec25d8c9c2d92569ceb72b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241865
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
* Replace `identifier` field with `expression`, which means deprecating
`identifier`, redirecting users to `expression`. For now, `expression`
always returns an Identifier. In a future breaking release, it will
return other CommentReferableExpressions.
* SimpleIdentifier, PrefixedIdentifier, PropertyAccess,
ConstructorReference, FunctionReference, and TypeLiteral are all
CommentReferableExpressions, but support is not implemented yet to
parse CommentReferences with those contained expressions.
Bug: https://github.com/dart-lang/sdk/issues/47444
Change-Id: I1905afecf3878cd7dca6e275ef0a2ab80500eb4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216320
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
I think we don't expect that users will write plugins that use these
types. So, we can remove the indirection.
Similarly, CompletionRequest is also currently de-facto a Dart
completion request, because it has `ResolvedUnitResult result`. I will
fold it into DartCompletionRequest in a future CL.
Change-Id: I2ea1d443ae18535f8c72f785dd1b91cf8d30ffa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
I found this while testing a change to the computation of the completion
location in `OpType`. The experiment started producing a completion
location that wasn't previously produced, and that's what led to it being
a key for one set of data but not in the other set of data.
Change-Id: I3938ae68ec61afbef98d9674c7d6377fa4120d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This causes completion failures to be split into two groups: those for
which there was no suggestion and those for which the name was suggested
but the wrong element was selected (as in the case where the correct
element shadows the one that was suggested.
In addition, the both groups of failures are now further grouped by the
location in which they occur.
Finally, failures to complete in hide and show combinators are temporarily
ignored until we can figure out how to complete as if the target identifier
wasn't already in the list.
Change-Id: I1515ad5a8862132b1b77287af45a638649cef7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203082
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This also fixes a bug in the completion metrics that I found while
adding the suggestion. The bug happens when an experiment causes a kind
of completion to be produced that wasn't produced before.
Change-Id: I244ae41161a9ff607c18273d0744f3cf27eb5caa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
When I added more comparisons of data to the output I unintentionally
removed some output in the case where there is no comparison being
performed. This restores most or all of that data to the output.
Change-Id: Idccd0ea0ffb76188dee3d54513c91ba95fb9d459
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201061
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
As per our earlier conversation, I looked for places where a local
variable was introduced to overcome field promotion and has the same
name as the field. Where possible I made them final; where not possible
I changed the name.
Change-Id: Iad3d2139693ca66f1eb22a3926c3b84a4115f13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196552
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
It now captures and prints the minimum and maximum values for several
characteristics. It also now allows the flag controlling whether the
available suggestion sets are used to be set for each experiment rather
than globally (which allows us to now compare the results with and
without the flag set).
Change-Id: I5b5930216ff2f448de35f6dbf3ccd9de712179d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196564
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>