Commit graph

866 commits

Author SHA1 Message Date
Konstantin Shcheglov ad5da2976b Add optional 'timeout' field to 'completion.getSuggestions2'.
The intended use is in benchmarking, to specify a long timeout, so that
the first time, when we warm up, we do necessary one time work,
which would usually run out of budget the first few times. So, the
requests that we do measure are more stable.

Change-Id: I22e870b84dcd6f2ac201c5ec57081c39c6529ea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220129
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-11-15 16:48:42 +00:00
Danny Tuppeny 3238b2c09c [analysis_server] Add LSP support for documentColor/colorPresentation
Fixes https://github.com/dart-lang/sdk/issues/44682.
Fixes https://github.com/Dart-Code/Dart-Code/issues/3240.

Change-Id: I5ccb24247e6cf8e0078699ec7527c0ccd0c0fa74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-12 17:51:02 +00:00
Danny Tuppeny c224cc2e0d Update LSP docs to use the "dart language-server" command
Change-Id: Ia8c948e088c2fe8c8f4fa79e43859aa4755f0bab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219784
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-09 17:31:32 +00:00
Konstantin Shcheglov 5ffec0e46e Create DartCompletionRequest with values, currently using forResolvedUnit() constructor.
Change-Id: Ie3db8617ed882d9561f9ea49b23dd5f8d3b4cf5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219753
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-09 16:17:55 +00:00
Konstantin Shcheglov bea4742bc1 Don't access ResolvedUnitResult from DartCompletionRequest.
When we resolve partially for completion, there is no fully
resolved unit. But we still know its path, content, element.

Change-Id: I57a21eb764ecd0b4c82ade33ad633bb2cd632b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-05 02:29:06 +00:00
Konstantin Shcheglov dd3759d9cc Revert "Remove ServerService.LOG"
This reverts commit 41397cbb9a.

Reason for revert: Actually, we do use it in google3.

Original change's description:
> Remove ServerService.LOG
>
> It looks that it is not used. We have a way to turn it on in
> DartAnalysisServerService.java in Dart plugin for IntelliJ, but
> setServerLogSubscription is not used in the plugin, marked as to be
> used in the Flutter plugin, but actually is not used there.
>
> Change-Id: If851044385100543ec0ff30e02dee3d99f1558e4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219362
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

TBR=scheglov@google.com,jwren@google.com,brianwilkerson@google.com

Change-Id: If5b807bf40adb8527aa801608fac6b1052adf67f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-05 02:18:28 +00:00
Konstantin Shcheglov 41397cbb9a Remove ServerService.LOG
It looks that it is not used. We have a way to turn it on in
DartAnalysisServerService.java in Dart plugin for IntelliJ, but
setServerLogSubscription is not used in the plugin, marked as to be
used in the Flutter plugin, but actually is not used there.

Change-Id: If851044385100543ec0ff30e02dee3d99f1558e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-04 22:56:26 +00:00
Konstantin Shcheglov 1ab3b36649 Make CompletionPerformance a wrapper around existing OperationPerformance.
Change-Id: I787ba5b47a2660d606dcc6c5015e9c9d83f73b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218784
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-01 18:49:31 +00:00
Sam Rawlins 8f756bf96b Add CommentReferableExpression, for expressions which can be used in a CommentReference
* 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>
2021-10-29 16:38:09 +00:00
Konstantin Shcheglov ec1118ead7 Use CompletionBudget.defaultDuration
Change-Id: Ic4da5ac8b5d8dc9911feecdfa4a8ab4e2e4da778
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 18:17:48 +00:00
Konstantin Shcheglov 294aaab9c1 Use time budget in NotImportedContributor.
Change-Id: Ief0ef8185accd68c7b99132393fa0a4db6be31c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-28 17:37:18 +00:00
Konstantin Shcheglov 931121ee2e Create DartCompletionRequest using factory constructor.
Change-Id: I05d7b444329c0bae6d3cd259ed015746963bf737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218327
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-27 22:10:07 +00:00
pq e050ab05de bulk fix for prefer_expression_function_bodies
Change-Id: I5facc84d37552153fbe1da7edb0589939183abd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217521
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-26 20:11:50 +00:00
Konstantin Shcheglov a156ee2f31 Remove CompletionRequest, use DartCompletionRequest only.
Change-Id: I4ecec7c4bc55e6ffacf3023ed8ee62db456bdd4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218062
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-25 22:03:20 +00:00
Konstantin Shcheglov 76dadeecd9 Remove DartCompletionRequest, use what was Impl instead.
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>
2021-10-25 19:32:46 +00:00
Konstantin Shcheglov 9eddeaeb3a Make DartCompletionRequestImpl.from() synchronous.
We give it (indirectly) ResolvedUnitResult, so it does not do any
async operation.

Change-Id: I2d29925fd20ea14bd984e6c3c226de466a03fb39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-25 17:47:00 +00:00
Konstantin Shcheglov 8e1e3c8f2c Pass DartCompletionRequestImpl to DartCompletionManager.
We sometimes create it outside DartCompletionManager, and then call
and create it inside again.

Change-Id: Ifa5bd958437a5ea4e2bac65e7800183f915a9a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-23 17:15:03 +00:00
Konstantin Shcheglov 4487759dd2 Document new DAS completion APIs.
Change-Id: I2ff1f2c494033a62fead7d828d5d875b55eda203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215643
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-21 18:21:35 +00:00
pq 36bfe07b7a document un-bulk-fixable static warning corrections
Change-Id: I8524b2147b00f3e213ae647e60c18eecbd74b401
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-10-20 18:19:41 +00:00
Ahmed Ashour d041cf0478 Remove extra the, be and of
Fixes #https://github.com/dart-lang/sdk/issues/47504

TEST=No tests needed, only comments affected.

Change-Id: Ie096307b5ce314d328fea6780f396aaa226ad3b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216182
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-10-20 09:29:01 +00:00
pq 378d304de8 document not bulk-fixable corrections
Change-Id: I90bb91258ec0c900719fe06fbd4003690384aa28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-10-19 23:15:01 +00:00
pq 15d00a8586 bulk fix accounting for hints with correction producers
Sample run:

```
hints w/ correction producers:

HintCode.CAN_BE_NULL_AFTER_NULL_AWARE bulk fixable: false
HintCode.DEAD_CODE bulk fixable: false
HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH bulk fixable: false
HintCode.DEAD_CODE_ON_CATCH_SUBTYPE bulk fixable: false
HintCode.DIVISION_OPTIMIZATION bulk fixable: false
HintCode.DUPLICATE_HIDDEN_NAME bulk fixable: false
HintCode.DUPLICATE_IMPORT bulk fixable: false
  => override explanation missing for: RemoveUnusedImport
HintCode.DUPLICATE_SHOWN_NAME bulk fixable: false
HintCode.INVALID_FACTORY_ANNOTATION bulk fixable: false
HintCode.INVALID_IMMUTABLE_ANNOTATION bulk fixable: false
HintCode.INVALID_LITERAL_ANNOTATION bulk fixable: false
HintCode.INVALID_REQUIRED_NAMED_PARAM bulk fixable: false
HintCode.INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM bulk fixable: false
HintCode.INVALID_REQUIRED_POSITIONAL_PARAM bulk fixable: false
HintCode.INVALID_SEALED_ANNOTATION bulk fixable: false
HintCode.MISSING_REQUIRED_PARAM bulk fixable: false
HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS bulk fixable: false
HintCode.MISSING_RETURN bulk fixable: false
HintCode.NULLABLE_TYPE_IN_CATCH_CLAUSE bulk fixable: true
HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD bulk fixable: false
HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER bulk fixable: false
HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD bulk fixable: false
HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER bulk fixable: false
HintCode.SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE bulk fixable: false
HintCode.SDK_VERSION_BOOL_OPERATOR_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_EQ_EQ_OPERATOR_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_EXTENSION_METHODS bulk fixable: false
HintCode.SDK_VERSION_GT_GT_GT_OPERATOR bulk fixable: false
HintCode.SDK_VERSION_IS_EXPRESSION_IN_CONST_CONTEXT bulk fixable: false
HintCode.SDK_VERSION_SET_LITERAL bulk fixable: false
HintCode.SDK_VERSION_UI_AS_CODE bulk fixable: false
HintCode.TYPE_CHECK_IS_NOT_NULL bulk fixable: false
  => override explanation missing for: UseNotEqNull
HintCode.TYPE_CHECK_IS_NULL bulk fixable: false
  => override explanation missing for: UseEqEqNull
HintCode.UNDEFINED_HIDDEN_NAME bulk fixable: false
HintCode.UNDEFINED_SHOWN_NAME bulk fixable: false
HintCode.UNNECESSARY_CAST bulk fixable: true
HintCode.UNNECESSARY_IMPORT bulk fixable: false
  => override explanation missing for: RemoveUnusedImport
HintCode.UNNECESSARY_NULL_COMPARISON_FALSE bulk fixable: false
HintCode.UNNECESSARY_NULL_COMPARISON_TRUE bulk fixable: false
HintCode.UNUSED_CATCH_CLAUSE bulk fixable: false
HintCode.UNUSED_CATCH_STACK bulk fixable: false
HintCode.UNUSED_ELEMENT bulk fixable: false
HintCode.UNUSED_FIELD bulk fixable: false
HintCode.UNUSED_IMPORT bulk fixable: false
  => override explanation missing for: RemoveUnusedImport
HintCode.UNUSED_LABEL bulk fixable: false
HintCode.UNUSED_LOCAL_VARIABLE bulk fixable: false
HintCode.UNUSED_SHOWN_NAME bulk fixable: false
```



Change-Id: I9d6e86854d7f1de43ac8154631610869bf56c2c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217149
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-10-19 17:57:52 +00:00
Konstantin Shcheglov 238a72a321 Support for experimental fields in analyzer_plugin common_types_spec.html
Change-Id: Id91cf321f4f99e29fd3f2be672335ae5c349f195
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216683
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-13 20:16:26 +00:00
Kevin Moore b67a67e03c pkg:analy* - don't call .hashCode within Object.hash functions
Follow-up to cb7c932f7b

Change-Id: Ie00e7759880bfc80f7b04a79979325d26607f148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214581
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 21:49:04 +00:00
Konstantin Shcheglov e1b5db7478 Deprecate getters that return TypeName, replace with returning NamedType.
Change-Id: I13764db3da27d5eabe972aab32cdf587a7de53e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-09-22 21:01:58 +00:00
Konstantin Shcheglov 1c125b4868 Deprecate AstVisitor.visitTypeName(), add visitNamedType().
Change-Id: I736a568068c2acfdc7074bb16b11fd38b656a13a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214135
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-22 19:15:54 +00:00
Kevin Moore cb7c932f7b analyzer: use Object.hash functions, deprecate JenkinsSmiHash
Also bump min SDK for pkg:analyzer

Towards https://github.com/dart-lang/sdk/issues/27698

Change-Id: Ic32c839c02f18afd99fdb98eb382540aae7da88a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214126
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-22 19:11:24 +00:00
Konstantin Shcheglov dfd7d7b37a Deprecate NodeList<TypeName> getters and replace with NodeList<NamedType>.
Change-Id: I6a772a7bca75e9c2ab4b3612d51c04ea6114ed6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214130
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-09-22 16:25:56 +00:00
Konstantin Shcheglov 8ecbaa8393 Replace TypeName with NamedType in analysis_server/, where possible.
Change-Id: Ice232aed2b705030861afa115350b1c77aa49d6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-22 01:26:39 +00:00
Ahmed Ashour c1f63c05b8 Remove unnecessary raw string from protocol_generated
Fixes #47146

Change-Id: I6710a8bb32e5ec770e570c93612f44a9ce63bc3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212744
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-09-13 21:10:40 +00:00
Kevin Moore 9f3b7cf4c6 analysis_server: migrate to Object.hash functions
Update min SDK to 2.14

Change-Id: I370875b550f5c103560e13697329c1443c036a2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212880
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-09 00:23:43 +00:00
Konstantin Shcheglov 06f0ecb8e8 Add more HighlightRegionType.xyz_TEAR_OFF
Change-Id: I357d621439c68b77545bdd01719310c60684e1f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212602
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-07 18:31:03 +00:00
Konstantin Shcheglov 1957af707c Use CONSTRUCTOR_TEAR_OFF for ConstructorReference highlighting.
Change-Id: Iee9731ef6e273ae89bc5328d6941aa8ddd530562
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212488
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-07 16:08:02 +00:00
Danny Tuppeny 3aa464af26 [analysis_server] Support renaming files when classes are renamed via LSP
Fixes https://github.com/Dart-Code/Dart-Code/issues/3354.

Change-Id: I2a11a54e0a2c35d525ee08e0849e35c421f6e195
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212291
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-09-02 18:09:38 +00:00
Konstantin Shcheglov 78fd1fb758 Format analysis_server/ and analyzer_plugin/.
R=brianwilkerson@google.com

Change-Id: Ib3140b9a7e1dbefd7106cc471574d210b359e7bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-01 21:08:56 +00:00
Brian Wilkerson 0231a0841a Fix a bug in completion metrics
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>
2021-08-24 19:16:53 +00:00
Brian Wilkerson 804109b3c6 Add documentation to completion metrics and clean up a bit of code
Change-Id: I612b5f5953bc0f8d94ad9976e55590097389c62e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-23 18:26:57 +00:00
Danny Tuppeny 00cc25a28b [analysis_server] Support plugin fixes/assists for LSP
Fixes https://github.com/Dart-Code/Dart-Code/issues/3502.

Change-Id: I90ae72d3ea9581a9e50858fae4c8878fd36bcee8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-30 15:19:57 +00:00
Brian Wilkerson 9db372e6f4 Make Location.endLine and Location.endColumn optional fields in the protocol
In https://dart-review.googlesource.com/c/sdk/+/191862 we added two new
required fields to `Location`. Unfortunately this was a breaking change
because plugins using an older version of the `analyzer_plugin` produce
location objects without those fields, leading to deserialization failures.

This CL makes those fields optional in order to fix the deserialization
issue.

Unfortunately, the `analyzer_plugin` package was published after the
required fields were added. Making them optional is a breaking change
because the constructor parameters go from being positional to being
named parameters.

We also neglected to update the version number of the protocol as part
of the previous CL. Technically this is also a breaking change for clients
of the analysis server, but given that they had no way to test to see
whether these fields existed they would need to have been written as if
the fields were optional in order to reference them at all, so I think
that from a practical standpoint it isn't a breaking change. That does,
however, raise the question of whether we should increment the version
numbers as part of this CL.

Change-Id: I35fc1f8e950669a3d8dd33cee6b81890261b5c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206942
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-15 17:35:55 +00:00
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
Danny Tuppeny c2f5625fa7 [analysis_server] Swap from dynamic to Object? in LSP generated code
Change-Id: Ib8ce2c722806b53b727d256c73859becbc1dbd11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-07 17:14:34 +00:00
Brian Wilkerson 38c1d4aaf8 Remove support for the deprecated dartfix tool
Change-Id: I848334cab0dbebe121198bc91ade3a8f68c5f7b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-02 18:30:24 +00:00
Danny Tuppeny 85d455fbad [analysis_server] Add source.fixAll source command for LSP
Change-Id: I2deac95e665a19065a7ef1d8c1f79485497c9de2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-01 17:56:47 +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
Danny Tuppeny d75becf4ac [analysis_server] Enable multiline element descriptions for all hovers
Change-Id: I5521cb09172b5eee639a4d3e9e21eb5871d6a86f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202971
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-13 15:50:32 +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 7d2ffd78de Make correction producers know whether they can be bulk applied
This change makes sense to me for a couple of reasons. First, when
editing a correction producer the information about whether it can be
bulk applied will be easier to find. Second, the information doesn't
need to be duplicated when the producer can be applied to multiple
error codes. And third, because the information is in one place we can't
enable a producer in one place and miss enabling it in other places.

This does have the unfortunate consequence that an extra producer needs
to be created for bulk application in order to determine whether it
should be applied at all, and can't be re-used because producers
maintain state. We could consider storing a 'generator' object rather
than a generator function in the map and have the `newInstance` methods
produce those objects, but I'm not convinced that it's worthwhile given
how short lived the extra producer is.

There was also one subtle change that you probably won't see by looking
at the changes, which is that one of the producers was enabled for bulk
application for a lint but not enabled for several non-lint cases. It is
now enabled everywhere. I remember thinking at the time that it should
be fine, but I've forgotten which producer it was, so I can't easily
tell you. If you want to confirm that change I'll be happy to do the
work of figuring out which producer it is and which error codes were
impacted by the change.

Change-Id: I2010d777f727472c0d307a6948b84d37491e2b17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-06 16:07:31 +00:00
Konstantin Shcheglov 40856c14c1 Remove most trailing spaces in analysis_server/
Change-Id: Ib03564c09af974b74be893ea2d6fdf1f6669d99b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-06-02 21:50:24 +00:00