Commit Graph

38 Commits

Author SHA1 Message Date
Konstantin Shcheglov 79327c9f05 Make ResolvedUnitResult.content/unit non-nullable.
Change-Id: Ia79567d248f2c91290bfdf8204ea7e9f3dc85fa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206668
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-14 02:33:10 +00:00
Konstantin Shcheglov cac96f7f8d Rename AnalysisSession.getXyz2() into getXyz().
Change-Id: Ia76aafc6a1190dcdca026097c364270389f2860a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206565
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-12 22:42:58 +00:00
Konstantin Shcheglov 672d66cea0 Make AnalysisResult.path non-nullable.
Change-Id: I861643f6c5493b6990c0bacddd81643aaba8e368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-07-12 18:21:11 +00:00
Brian Wilkerson 1a7895f56f Fix metrics for built-in identifiers outside directives
Change-Id: I285199b8dd168215a1a41de9de77a83ddfa57d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203665
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-15 00:40:59 +00:00
Brian Wilkerson 7acd2e7635 Improve metrics tool to group failures
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>
2021-06-09 22:35:19 +00:00
Brian Wilkerson dbdde949e0 Suggest Never when types are appropriate
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>
2021-06-02 17:46:22 +00:00
Brian Wilkerson 6bb4c62d82 Print more completion metrics data when not comparing
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>
2021-05-21 21:41:19 +00:00
Brian Wilkerson b42c5c77d4 Cache documentation comments to improve completion performance
I'm not convinced that this is the right way to cache comments, so
feedback is welcome.

Change-Id: I2bd393b80e05c26199020e19daf0eadeb99d8c2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199303
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-05-13 16:31:35 +00:00
Brian Wilkerson f25fc4287c Improve the code completion metrics tool
Added user tags for profiling and started tracking the distribution of
completion times.

Change-Id: I57153aa550787535ee955359a810cabbdee1941b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-05 16:48:25 +00:00
Brian Wilkerson 1ad68b9b16 Make local variables that hide fields be final (analysis_server)
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>
2021-04-24 18:12:07 +00:00
Brian Wilkerson 529e8abc5c Minor improvements to the code completion metrics tool
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>
2021-04-23 00:07:36 +00:00
Brian Wilkerson f32f6afbfd Fix a couple of bugs in the metrics tool
Change-Id: Ib8c17f9e9963996118473c5c32d3d6fb51ce632e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196343
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-21 20:56:11 +00:00
Konstantin Shcheglov 26d9fbbd04 Add getResolvedUnit2(), deprecate getResolvedUnit().
Change-Id: I0217fefb2747f2f9bd757bc041b53acaf3d1a8f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195495
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-16 21:33:54 +00:00
Brian Wilkerson d08c65be05 Migrate the completion metrics tool
Change-Id: I6d66ebd2d5cbb32147252927819f9d6533cb4012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194882
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-10 04:15:23 +00:00
Brian Wilkerson b0a358c10b Migrate two more tools in server
Change-Id: I5cd174caa77653cc39a37a8c0464f0f1e93c4a90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194320
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-08 01:03:34 +00:00
Konstantin Shcheglov ad498f34dc Migrate a few test/tool/completion_metrics/ libraries.
R=brianwilkerson@google.com

Change-Id: I8221b0c2f97ada211b101d31420e60062f30887d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194115
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-04-06 22:58:53 +00:00
Brian Wilkerson d4bc97ec16 Migrate a couple of files in the completion support
Change-Id: Idcb26425dad2b2a1d88346ad0ceea9d1fff209f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194012
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-05 16:40:06 +00:00
Brian Wilkerson 23bee1698f Migrate the instrumentation log viewer tool
Change-Id: I2087c3c9d25cdf3266142ba57bb8dbc57bc3fc46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194002
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-04-05 05:11:45 +00:00
Brian Wilkerson 628e630ca2 Convert a few utility libraries to null safety
Change-Id: I1e1cde29a40eb498d8e25c72189641d568d7db03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193591
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-31 05:45:32 +00:00
Konstantin Shcheglov e97f1bdbf0 Switch analysis_server to language 2.12, so null safety, but opt-out files.
This should allow doing partial migration, specifically protocol files,
which are imported by other libraries, but are a small library cycle
that does not import much outside of it.

Change-Id: I904c05d6d5b444ee9a9dbd1f7ada12aabdcc5165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-30 23:39:37 +00:00
Brian Wilkerson 2802e4fbdc Make the map file explicit rather than trying to coordinate between caller and callee
Change-Id: I6f7b7807eeca7a023772c0bdcf4992e4762f84e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-27 22:42:56 +00:00
Brian Wilkerson 78ca98ac8e Minor cleanup to SuggestionBuilder
Change-Id: I1f3a71b81e7f2bb29808102ea076c7e7e67a6967
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190740
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-11 17:18:30 +00:00
Brian Wilkerson 8f2ca0b248 Make markdown the only output option for the completion metrics tool
Change-Id: Id4c2020ea85453980f1ed044552b76f13316c7b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-06 20:57:49 +00:00
Konstantin Shcheglov 53c8eda967 Keep more specific types for AnalysisContextCollectionImpl to avoid downcasts.
It seems to me that implicitly expecting DriverBasedAnalysisContext
is equivalent to explicitly stating this with types.

Change-Id: I16ec14e73030d9b34242a2f4ad582e93fc44afa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189382
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-06 06:23:25 +00:00
Konstantin Shcheglov c8d6f85d0f Enforce lint unnecessary_parenthesis in analysis_server.
Change-Id: Ib68c124988743b45807015e7274f429fff67fe44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189384
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-06 05:20:16 +00:00
Brian Wilkerson 7aaf620de7 Make it easier to experiment with enabling or disabling existing features with example
Change-Id: I22b7a1259fee585e1baeba0faf7b62c9f0d2f5ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189340
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-06 01:02:24 +00:00
Brian Wilkerson 61d09495b9 Add code to support comparing the quality of code completion relevance tables
Change-Id: Ib4500712e3e63114a357af8cf2c2479b70cc27d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188583
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-03-02 22:37:47 +00:00
Brian Wilkerson 4643444205 Add map/reduce functionality to the completion metrics tool
Change-Id: I69d206fa7d817b022eedac01a13355a14a09a650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188002
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-26 20:45:17 +00:00
Brian Wilkerson 71cd2eab85 Add support to the relevance table generator to generate multiple tables for comparison purposes
Change-Id: Iba8dc640540b1689d619a928cc7075c4b17555ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-24 21:36:34 +00:00
Konstantin Shcheglov fd81b73e67 Replace AnalysisEngine.isDartFileName() with file_paths.isDart()
Change-Id: Icf5d524945ffdb7087b96555968804946b4e5af4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187062
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-02-24 21:03:24 +00:00
Brian Wilkerson 2c982b0c1f Enhance the command-line relevance table generator tool to support a map-reduce style of table generation
Change-Id: Ie0e26094b4cd6acaf864556d04d3de0415683cdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-23 17:46:21 +00:00
Brian Wilkerson f4f974a1ac Add a feature to decrease the probability of suggesting noSuchMethod
This feature improves the metrics in locations where methods can be
suggested and has no effect in the remaining locations. The improvement
is very small, but I think it's worthwhile nontheless.

Change-Id: I88cdb19a1d870f5a27871925d56ce204f5b3f8a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-02 18:48:54 +00:00
Brian Wilkerson 8363ed81b0 Enhance the relevance table generator
Add support for serializing and deserializing the data and for combining
data from multiple sources. The intent is for this to be used to allow
us to efficiently analyzer larger code bases to get more accurate values.

Change-Id: I89fe11bbfa7acc2cab56c2f06cb9ac06c2a4fb30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-02-01 00:24:08 +00:00
Brian Wilkerson 8cf4c15bf0 Update the context location label for general type alias support
By the way, I didn't actually regenerate the table, I just hand edited
it. We don't have any way to ensure that the checked in table matches
what would be generated because we can't have the code used to generate
the table available on the build systems (or every developer's machine).

Change-Id: I4b645f3a276f23bab469e5daf2325cc8f2d0bce4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181441
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-01-27 22:38:07 +00:00
Brian Wilkerson b23be6b8ee Update the completion metrics measurement tool
Change-Id: I8e67d138e60e0e226cef87e9efd35088526dec72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-01-26 23:54:15 +00:00
Nate Bosch 58e7e7eb26 Prepare for breaking change in package:http
The `url` argument is changing from `Object`, accepting either `String`
or `Uri` at runtime, to `Uri` for better static help.
https://github.com/dart-lang/http/pull/507

- Switch to using `Uri` for requests. Where sensible push this type into
  the signature of the surrounding method.
- Make some updated method private where they were unnecessarily public
  which makes it harder to have confidence when looking for usages.
  Rename a method with an unnecessary `get` name.

Change-Id: Ibf075741d6b9d292349b15f1dc84004981729aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179368
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2021-01-15 16:35:01 +00:00
Brian Wilkerson 3f2e5d8a90 Improve the output from the code completion metrics tool
This CL does three things.

First, it makes the output options more fine grained to allow us to get
the information we're after without getting information that we don't
care about at the moment.

Second, it prints the unconditional output in a more compact tabular
form so that it's easier to read.

Third, it adds support for outputing a high-level comparison of multiple
experiments to make it easier to gauage the impact of a change.

Change-Id: Iee8b1eb126de43cb08c27a1b60036090fffc0421
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174941
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-12-03 17:14:13 +00:00
Brian Wilkerson 8fee2b96af Rename the tool/completion_metrics directory
The directory contains tools related to code completion that are not
used to measure completion metrics, so the old name was too specific.

Change-Id: Ie8745901655df6e7b29da645b3b0a48011ca9f10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174483
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-30 23:57:44 +00:00