Commit graph

139 commits

Author SHA1 Message Date
Brian Wilkerson 3a3731665f Initial implementation of server support for training data
Change-Id: I4943b8c30575e78c1028d9d0be174f535db99303
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97841
Reviewed-by: Ari Aye <ariaye@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-26 20:32:20 +00:00
Konstantin Shcheglov 4b609422e9 Make AVAILABLE_SUGGESTION_SETS and related APIs non-experimental.
R=brianwilkerson@google.com

Change-Id: I1facae905319f050636126b021f56f353f81d6f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95661
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-07 21:29:36 +00:00
lambdabaa 1c27b817fc New protocol to inspect analysis server state at code completion time
This change adds a new, experimental completion domain request
`completion.listTokenDetails`. Its purpose is to allow
other programs to observe and make smarter decisions contingent
upon analyzer's internal knowledge of a Dart program.

Bug: 36083
Change-Id: I5ab477221efeac076eccc873a29cf6feae91052e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95100
Commit-Queue: Ari Aye <ariaye@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-03-04 20:33:44 +00:00
Konstantin Shcheglov 266ce73e28 Remove CompletionSuggestion.elementUri, replaced with AvailableSuggestionSet.
R=brianwilkerson@google.com

Context: https://github.com/JetBrains/intellij-plugins/pull/633#issuecomment-465725310
Change-Id: I03a1b7e7ec7cc0a5b0797dc960b72ca314a32132
Reviewed-on: https://dart-review.googlesource.com/c/93745
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 21:34:18 +00:00
Konstantin Shcheglov 4c1025493a Enhance available suggestions protocol.
1. Rename includedSuggestionKinds -> includedElementKinds.

2. Add defaultArgumentListString and defaultArgumentListTextRanges.

R=brianwilkerson@google.com

Change-Id: I65c67252f6bad66c0c60a20315fd87affbeb653a
Reviewed-on: https://dart-review.googlesource.com/c/93560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 19:51:11 +00:00
Konstantin Shcheglov 0ef30fb86e Protocol for IncludedSuggestionSet.displayUri.
R=brianwilkerson@google.com

Context: https://github.com/JetBrains/intellij-plugins/pull/633#issuecomment-464746341
Change-Id: I27339f4c9327adb761f2bb0ba326c318ce010383
Reviewed-on: https://dart-review.googlesource.com/c/93487
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-19 16:42:30 +00:00
Konstantin Shcheglov b9bcfb4529 Change IncludedSuggestionRelevanceTag to using 'relevanceBoost'.
Sometimes there is no difference between 'relevance' and 'relevanceBoost',
for example for enum constants. But for primitive constants, there might
be multiple `double` constants, in different libraries with their own
different relevances. And it would be nice to keep relative relevances
of these libraries in primitive type constants.

R=brianwilkerson@google.com

Change-Id: I3641a4709e09f5c5dd979f5ca8df7b0235c708d2
Reviewed-on: https://dart-review.googlesource.com/c/92623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-11 20:10:29 +00:00
Konstantin Shcheglov 67c5923cce Enhance protocol to allow changing relevance of individual suggesions.
R=brianwilkerson@google.com

Change-Id: I3f3d256fcdc4d41c527bbc03fb71800583a264f7
Reviewed-on: https://dart-review.googlesource.com/c/92382
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ari Aye <ariaye@google.com>
2019-02-08 19:25:05 +00:00
danrubel 6c680a0ebd Update dartfix readme and update version numbers
* Update the readme to discuss required vs suggested fixes
* Remove the out-of-date options section from the readme
* Update dartfix and analysis_server_client versions and changelog

Change-Id: Ida4b30f9f89eb84a2fe856f61562ff73bf6725da
Reviewed-on: https://dart-review.googlesource.com/c/92153
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2019-02-07 01:16:56 +00:00
Konstantin Shcheglov d236dca9d9 Add 'offset' to 'getSuggestionDetails'.
We need it to know if names in the syntactic scope will shadow
the requested name if unprefixed import is used.

R=brianwilkerson@google.com

Change-Id: I1fd28add9241b27795160c4705a80e0f8aa6c647
Reviewed-on: https://dart-review.googlesource.com/c/92022
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-05 16:49:55 +00:00
lambdabaa d4b8e0696d Add the capability in analysis server protocol for clients to express
interest in receiving not yet imported code completions from specific
packages and libraries.

The design of this interaction aims to avoid forcing analysis server
to send every public symbol from dependent packages at every completion.
Instead, clients express interest in certain packages and/or libraries
and analysis server will notify with the entire set of symbols for
each of them only once. Then it is the client's responsibility to save
these pre-computed completions in memory, and analysis server can
instruct the client on how to union them with the base set of completion
suggestions at code completion time.

Bug: https://github.com/dart-lang/sdk/issues/35680
Change-Id: I42c6fddc5d8daa2b546daa81456c0992e3ef547d
Reviewed-on: https://dart-review.googlesource.com/c/90125
Commit-Queue: Ari Aye <ariaye@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-31 19:56:18 +00:00
danrubel db44a727e5 Extend the edit.dartfix protocol
This CL extends the dartfix protocol to allow specifying which
fixes should be applied. In summary:

* includedFixes - list of fix names to be applied
* includeRequiredFixes - bool indicating required fixes should be applied
* excludedFixes - list of fix names that should not be applied

Given that the client can specify the fixes to be included/excluded,
then the dartfix cmdline help text should include the list of known fixes.
Rather than hard code this in the dartfix client, a new edit.getDartfix
request has been added to return the list of known fixes.

Change-Id: I319f6f405a5d29757bf28b70b778a449f901bbef
Reviewed-on: https://dart-review.googlesource.com/c/91700
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-31 01:53:32 +00:00
lambdabaa b767744cfc Add optional elementUri field to CompletionSuggestion types in analysis server protocol
This will enable clients such as IntelliJ to display the package which code
completions are being offered from in addition to the keyword or identifier
that they're already getting from analysis server.

R=brianwilkerson@google.com

Change-Id: I30311451ad56b4eddbe73da20641ee0d14849293
Reviewed-on: https://dart-review.googlesource.com/c/88744
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ari Aye <ariaye@google.com>
2019-01-09 00:13:39 +00:00
Paul Berry a84863253c Re-apply "Add AnalysisDriver.resetUriResolution() and use it for analysis.reanalyze request."
Original change's description:
> Add AnalysisDriver.resetUriResolution() and use it for analysis.reanalyze request.
>
> This CL changes "analysis.reanalyze" API. We decided to repurpose it. It was not
> used for some time now in IntelliJ, and AFAIK has never been used in VS Code.
>
> R=​brianwilkerson@google.com, paulberry@google.com
>
> Change-Id: I7510b0189197c9f3f848b0fc59a7b2bd22889ac7
> Reviewed-on: https://dart-review.googlesource.com/c/85523
> Reviewed-by: Paul Berry <paulberry@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I828c9a77f1e28d44c00bfcf39527514e39cccc42
Reviewed-on: https://dart-review.googlesource.com/c/86221
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-12-06 23:14:28 +00:00
Dan Rubel 784ad29470 Update dartfix to check analysis server protocol version
This updates dartfix to more narrowly verify the analysis server
protocol version and print instructions for the user if the protocol
version expected by dartfix is incompatible with the current Dart SDK.
This is necessary because the edit.dartfix protocol is experimental
and will continue to evolve.

Change-Id: Ib31eb594a8a94416cb4fc676e7da9150f8c99b6a
Reviewed-on: https://dart-review.googlesource.com/c/84780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-19 21:14:28 +00:00
danrubel e39fa29bd6 analysis_server_client API tweaks before publish
* Rename ClientListener to ServerListener
* Change ServerConnectionHandler on --> implements NotificationHandler

Change-Id: I459e4c566971d49790e12b8f1386ae80db33b38b
Reviewed-on: https://dart-review.googlesource.com/c/84560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-15 21:44:03 +00:00
Devon Carew 23980a34a6 Fix a typo.
Change-Id: I3784a67987a5f4d56301c7ced9f9bcc31ff3fd03
Reviewed-on: https://dart-review.googlesource.com/c/84540
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-11-15 18:45:09 +00:00
Dan Rubel bec2daba02 Cleanup analysis_server_client API
This reduces the client functionality and renames some
of the classes and methods in the API.

Specifically:
- rename Server to Client
- rename ServerConnectionHandler to ConnectionHandler
- rename Client.start to Client.startServer
- rename Client.stop to Client.stopServer
- rename Client.kill to Client.killServer
- extract behavior from Client into Listeners
- move some of the listeners into dartfix
- make several Client fields private
Change-Id: Ie71b0ac55b489099a848764251e8369c27f6ea2d
Reviewed-on: https://dart-review.googlesource.com/c/84460
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-15 15:06:55 +00:00
danrubel 552b25084e Generate NotificationHandler dartdoc and add server tests
Change-Id: Iec977015ae89e2a703e9013fb7b6969043554afc
Reviewed-on: https://dart-review.googlesource.com/c/84080
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-10 01:16:14 +00:00
Dan Rubel aa8cc30e5c Update ServerConnectionHandler to check the protocol version
... as well as reworking the example to use notification handlers and
addressing comments in https://dart-review.googlesource.com/c/sdk/+/83520

Change-Id: I27959cba79953d95d1afd851ab6a5f137dff47db
Reviewed-on: https://dart-review.googlesource.com/c/83580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 21:10:06 +00:00
Dan Rubel d502ba6014 Add new analysis_server_client handlers
* Make the NotificationHandler a mixin
  and move it to /lib/handlers

* Add new notification handler mixins
  - AnalysisCompleteHandler
  - ServerConnectedHandler

* Add Server.stop method

.. and address comments in
https://dart-review.googlesource.com/c/sdk/+/83180

Change-Id: I94ba657f20520ae4bb0e479a014c11509eeb9d2c
Reviewed-on: https://dart-review.googlesource.com/c/83520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-08 21:10:06 +00:00
danrubel 7e6a39fd91 Generate analysis server notification handler
... and generate the analysis server protocol version

Change-Id: I585e50cc854d5ae1aa7440a14f856c983bbfc93a
Reviewed-on: https://dart-review.googlesource.com/c/83180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-06 23:04:53 +00:00
Dan Rubel a074bcf93c Update dartfix package for publication
Updates to dartfix for publication including:
* add changelog, readme, and license
* update pubspec version and executables

along with a collection of smaller changes including:
* test cleanup
* remove duplicate time value from verbose output
* read dartfix pubspec version and pass that to analysis server

Change-Id: Ifa94df45e6cbcf9a98f7bf393c22e06eaab48c38
Reviewed-on: https://dart-review.googlesource.com/c/82240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 17:36:51 +00:00
Dan Rubel c580e8cac6 Cleanup analysis_server_client package
Clients may now optionally add clientId and clientVersion information
when starting the analysis server.

In addition, this CL adds an example of how to use this package
and updates the changelog, readme and pubspec.

Change-Id: I969a13a7d8379d6289fbbbc5f8d1b66315aa6a37
Reviewed-on: https://dart-review.googlesource.com/c/82165
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-31 14:56:10 +00:00
Dan Rubel 6294171508 comment cleanup
Change-Id: I83bf6513b1acd9faedb14f1bf44e32df76dd8528
Reviewed-on: https://dart-review.googlesource.com/c/82164
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-31 14:25:35 +00:00
Dan Rubel 645ec2e8b5 Meld server runner in dart fix with analysis_server_client
Change-Id: I86a2e7b815ff6d3beea2d968c5e34c4e3feae2c3
Reviewed-on: https://dart-review.googlesource.com/c/82080
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 20:04:58 +00:00
danrubel 0fe448a996 Revise the analysis server edit.dartfix protocol
This updates the edit.dartfix protocol to separate location from the text
describing the changes so that the dartfix client can choose
what location information to display and how it should be displayed.

Change-Id: Ic56a4cb187538571d60136d6de9265d879fccb53
Reviewed-on: https://dart-review.googlesource.com/c/81780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-29 01:50:27 +00:00
Dan Rubel b8fd29e0bb Remove dartfix dependencies on analysis server
This replaces dartfix dependencies on ...
* analysis_server
* analyzer (except for testing)
* analyzer_plugins

... with a dependency on analysis_server_client.

Change-Id: If511de69333e925ae082fa06c5114188c3c405b1
Reviewed-on: https://dart-review.googlesource.com/c/81342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-24 19:26:58 +00:00
Dan Rubel 3dc911909b Generate analysis_server_client protocol_generated.dart and related protocol files
Change-Id: I9a9af0ee37eab87a5c3e83cba638d855a2e1121b
Reviewed-on: https://dart-review.googlesource.com/c/81341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-24 17:09:39 +00:00
Dan Rubel 34d0801008 Generate analysis server protocol consts in analysis_server_client
Change-Id: I86c1f7ce98d2c1424c9b77c66fa48c6fa1ba354b
Reviewed-on: https://dart-review.googlesource.com/c/81340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-24 15:37:21 +00:00
Kevin Moore 4d5c5ecdbf Update synced version of pkg:test
Also updated the package references in a number of pubspecs to
more closely align with the package versions that are in the SDK

Change-Id: I061951587befa4211ac7455cf1179911eb07efc0
Reviewed-on: https://dart-review.googlesource.com/c/79920
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-10-16 16:12:38 +00:00
Brian Wilkerson d5ccb53f01 Remove more uses of isInstanceOf
Change-Id: Ib2fc1081b793ac3dbd39889b04c6af3a8f4fac8d
Reviewed-on: https://dart-review.googlesource.com/63684
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-07-03 20:32:26 +00:00
Brian Wilkerson a6ad152315 Fix constant-related deprecation warnings in analyzer packages
Change-Id: I6e4186d2a877275db2f04881a6aa6d154d4f8693
Reviewed-on: https://dart-review.googlesource.com/55820
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-17 21:24:38 +00:00
Brian Wilkerson 824f123a8d Clean up some hints
Change-Id: If20a9f76cfa50f7977182b1a613ed74e508fed97
Reviewed-on: https://dart-review.googlesource.com/48441
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-26 17:39:18 +00:00
Brian Wilkerson db6e377e6d Make analysis_server_client Dart 2 safe
Change-Id: Iab06cb5b779599a1a107fa6fdf832345950fa84c
Reviewed-on: https://dart-review.googlesource.com/48322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-25 15:20:36 +00:00
Brian Wilkerson 602a8c2a7b Clean up usage of deprecated constants
Change-Id: I9005ba6e94529e15d8f7b21322591f4a9dabec47
Reviewed-on: https://dart-review.googlesource.com/45763
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 01:02:49 +00:00
Mike Fairhurst e2f4e6c1c9 Update mockito to be compatible with latest analyzer void changes
Change-Id: I94d8a4eae413df7a5daf5e5da0e42d1de74f43e3
Reviewed-on: https://dart-review.googlesource.com/39847
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-07 23:32:41 +00:00
Max Kim bd8d28dddd Test failing fix. Stdin is mocked to avoid the typing issue; not critical for this unit test.
BUG=
R=regis@google.com

Review-Url: https://codereview.chromium.org/2996703002 .
2017-08-08 19:00:37 -07:00
Max Kim 4e42dbc1f9 Add analysis_server_client without analysis_server.
BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2994723003 .
2017-08-08 14:57:43 -07:00