Commit Graph

6923 Commits

Author SHA1 Message Date
Danny Tuppeny 96a7c6ab24 [analysis_server] Fix context type for function expressions with implicit returns
Fixes https://github.com/Dart-Code/Dart-Code/issues/5162

Change-Id: I86148b3d847fc2a743307703390ff98c93b4c142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-07-10 14:46:49 +00:00
Sam Rawlins 0e39ed67e6 analyzer: Expose LintCode as public API, for plugins
Work towards https://github.com/dart-lang/sdk/issues/50986

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Ie5783240e3fc2c9f8076b3efb13f79a3b8fa5000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-09 22:16:00 +00:00
Sam Rawlins 04dcf09b94 analyzer: Add quick fix to remove unexpected underscores from number literal
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I9bec5b6101a5642973d3a0abb568b044cddb892e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375061
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-09 21:12:50 +00:00
Konstantin Shcheglov b99585d969 Augment. Report INVALID_USE_OF_IDENTIFIER_AUGMENTED.
Change-Id: I2d95216a5e6c5359433fc936a3e072aea9375894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-07-09 16:59:51 +00:00
Sam Rawlins 2dd4341a52 analyzer: Rename a few lint-rule-related classes; add docs
* LinterContextUnit -> LintRuleUnitContext
* LinterContextImpl -> LinterContextWithResolvedResults
* LinterContextParsedImpl -> LinterContextWithParsedResults


Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I2ead74d0d96f6103e6f7632df678f02d4307d2c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374861
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-07-09 00:27:11 +00:00
Keerti Parthasarathy b971e8cb08 Fix for 'avoid_init_to_null` fix for late variable declarations.
Fixes https://github.com/dart-lang/sdk/issues/55941

Change-Id: Id7bdd133ec302919a436b54a205c279434b2b523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-07-08 20:06:31 +00:00
Danny Tuppeny 0bb52d321a [analysis_server] Add PackageConfigPackageUriResolver support to diagnostics pages
This ensures the servers current package resolution map shows up against each context in the diagnostics pages to help track down package resolution issues (such as https://github.com/Dart-Code/Dart-Code/issues/5171).

Change-Id: Id068a5a1c8054f7120e7e73223541dc6372a62b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-08 16:29:59 +00:00
Brian Wilkerson bdaef502e0 Create a common interface for suggestions based on an element
Change-Id: I52cac5eb5862462035d8d0d32e3cd01c66b349f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-07-03 15:56:38 +00:00
Keerti Parthasarathy ef9afb4383 [dart fix] Support for fixes when only part files have diagnostics.
Fixes https://github.com/dart-lang/sdk/issues/55520

Change-Id: Ibebe155e00758a6bf36e0327c130be70f2910238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374100
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-03 15:26:41 +00:00
Ann Marie Mossman 1c0c5f355f Issue 54063: fixed formatting issues
Issue 54063: Adding in file quick fix support for missing semicolons and associated test

R=srawlins@google.com

Bug: https://github.com/dart-lang/sdk/issues/54063
Change-Id: Ia1a20129e3c630d977ab3d40bf8e79b0ed852936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373326
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ann Mossman <mossman@google.com>
Auto-Submit: Ann Mossman <mossman@google.com>
2024-07-02 17:30:49 +00:00
Brian Wilkerson 8b8a15059c Improve completion at the beginning of an index expression
This is almost identical to the fix for completing at the beginning of a
method invocation. There's probably a more consistent way to do this,
but I'm not sure what that is at the moment. (I think we used to do this
in `completionNode` but were skipping some nodes we shouldn't have been.)

Change-Id: I3f220e0e79a91721b0c1235fdfc0f511ee7400a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373902
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-02 16:32:40 +00:00
Danny Tuppeny 916272331b [analysis_server] Remove the singleton uriConverter and pass explicitly to all toJson/fromJson methods
This avoids accidentally using the converter when talking to plugins, (at least for now) URIs are never expected, and file paths should always be used regardless of which mode the server is in.

This unfortunately touches a _lot_ of code, so I've pushed in many separate patch sets to Gerrit.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5156

Change-Id: I312c3e2cbc35a05a078aaa0138aec7288b3c7dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373745
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-02 14:15:11 +00:00
Keerti Parthasarathy 9f27bdeaf6 Use completionLocation from SuggestionCollector when computing relevance
Change-Id: I2446b8596ce35f53f6370b3a3590e7fd2a2b4974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373767
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-07-01 16:51:27 +00:00
Brian Wilkerson 29d2913e2d Code complete before a method invocation
While the completion scenario is valid, it's probably an unlikely case.
I discovered the issue because it's one of the cases that was frequently
reporting failures in the completion metrics tool. With this change,
the failure count is now down to 249 (1.96% of attempted completions).

Change-Id: I1c9104352c14eb758040e3e0e3a2d2fafc4f909d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373780
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-01 14:44:56 +00:00
Konstantin Shcheglov 9933ca5a53 CQ. Switch to flattenedToList/ToSet from package:collection
Change-Id: I2cd0d4f1653ddc2701961d3b26990d1b1c5cfdc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373604
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-28 22:10:41 +00:00
Brian Wilkerson b22b78d481 Enhance CandidateSuggestions to have more data for relevance computations
I believe that we're computing the same values as we were before, but
the tests won't prove that. I couldn't think of any way to test this.
If you have any concerns and/or can think of a way to test it, do let me
know.

Change-Id: I489a2642b9b0345ad40fdc4afa9283eba5f65b3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373581
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-28 17:14:29 +00:00
Brian Wilkerson 9d28b1eb9f Add code to sort and truncate the candidate suggestions
This code isn't being called anywhere yet, but needs to be available in
order to allow us to convert the handlers over to using
`computeCandidateSuggestions` directly.

I've started wondering whether we want to rename `SuggestionCollector`
to something like `CompletionResult` to reflect the additional
information that it's starting to have and work that it's starting to
do.

Change-Id: Ib989b6649da2228c257fdc0e63f7013769fa2685
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373323
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-06-27 20:35:13 +00:00
Sam Rawlins 2d252d5c49 analyzer: split URI_DOES_NOT_EXIST for doc imports
Work towards supporting https://github.com/dart-lang/sdk/issues/50702
in google3. Related to the work attempted in
https://github.com/flutter/flutter/pull/150798.

Change-Id: I36fb1c47c94d5b965529db910fbd0e347bfba645
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373442
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-27 19:51:32 +00:00
pq 7d22d99b9b quick fixes for EXPECTED_BODY diagnostics
* `EXPECTED_CATCH_CLAUSE_BODY`
* `EXPECTED_CLASS_BODY`
* `EXPECTED_EXTENSION_BODY`
* `EXPECTED_EXTENSION_TYPE_BODY`
* `EXPECTED_FINALLY_CLAUSE_BODY`
* `EXPECTED_MIXIN_BODY`
* `EXPECTED_SWITCH_EXPRESSION_BODY`
* `EXPECTED_SWITCH_STATEMENT_BODY`
* `EXPECTED_TRY_STATEMENT_BODY`
* `MISSING_ENUM_BODY`

See: https://github.com/dart-lang/sdk/issues/55917


Change-Id: If33df1e9b3e93c7aaff30565f6d61dc56c24e491
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-26 22:21:11 +00:00
Konstantin Shcheglov aea99e79ae Augment. Report AUGMENTATION_TYPE_PARAMETER_NAME
Change-Id: Icd455e26ec11f2daa9907e996df2706bd8f7d9f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373321
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-26 20:05:29 +00:00
Konstantin Shcheglov 18a90180de Augment. Report AUGMENTATION_TYPE_PARAMETER_BOUND
Change-Id: Ie6c4e223f0fa85dadf0c3fe7902db67a55021b75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373163
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-26 17:11:48 +00:00
Sam Rawlins 1e84b64a0e DAS: Move DartChangeWorkspace to the analysis_server_plugin package
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I79f43d06b48149b1d9dec30c5f5a77fdfd57ce4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373143
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-26 02:17:59 +00:00
Keerti Parthasarathy ee5881bd58 Suggest static members when visiting contructor name.
Fixes https://github.com/dart-lang/sdk/issues/56056.

Change-Id: I97cded39b83f70305a9ceec8af7b1f07b63e43de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-06-25 18:48:55 +00:00
Danny Tuppeny 4f36252fd3 [analysis_server] Support folding multiline strings
Fixes https://github.com/Dart-Code/Dart-Code/issues/5139

Change-Id: I7038568b5504b97c0bb817a608e000c268a3fae6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 18:47:56 +00:00
Konstantin Shcheglov 6d6251528a Augment. Report AUGMENTATION_TYPE_PARAMETER_COUNT.
Change-Id: Iafd5613c7ed87f9f9aff244f0852a663bb45d642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372562
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-24 16:50:19 +00:00
Brian Wilkerson e159bfee64 Improve the computation of the completion prefix
There are a couple of tests where the new code fails to produce a
prefix, but in those cases the prefixes are `""` and `{`, which are
not useful for filtering (and wrong for replacing). The new code does,
however, now find prefixes that the old code missed, which improves the
filtering. The changes to the tests reflect the improved filtering.

Change-Id: I3d48162ee56de1b94ecb3a88d11e8a2167fb8f2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372860
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 16:04:53 +00:00
Danny Tuppeny a42ae0c906 [analysis_server] Include types in closure completions when always_specify_types is enabled
Fixes https://github.com/Dart-Code/Dart-Code/issues/5149

Change-Id: Ic212e13d9fe90b4c728f92ecdf8fd5ca519047ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372426
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-21 20:43:37 +00:00
Konstantin Shcheglov 35cae3a8b8 Augment. Report AUGMENTATION_EXTENDS_CLAUSE_ALREADY_PRESENT
Change-Id: I5590b68366a12129e42e19e26ac3ec4fa8330149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-21 15:55:11 +00:00
Brian Wilkerson c475a7ebcd Add a method that returns the candidate suggestions
The intent of the new method is that it can be used to get the candidate
suggestions before they are sent to the suggestion builder, making it
easier for us to skip the suggestion builder (in the future) and
translate directly into the apporpriate protocol objects.

Change-Id: I4cb185f9076e559dd131870f9c3f05bc4fc883f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372601
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-21 15:09:08 +00:00
Keerti Parthasarathy bcbe3a54ff Fix bug in AddDiagnosticReference when using it via CLI.
Fixes https://github.com/dart-lang/sdk/issues/55772.

Change-Id: Ic77f67486f71bdfea726ea3161d83728326b2c5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372120
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-20 18:10:32 +00:00
Sam Rawlins 4f5dc5603f analyzer: Deprecate dead properties on Comment
Work towards https://github.com/dart-lang/sdk/issues/56038

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: If7ae2738fec598f16756c524b6bd6c258ee5609e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-18 18:27:25 +00:00
Brian Wilkerson 1e5f96514c Remove type cast in completion to prevent exception
Change-Id: If97adc54523894a3b9df241ffb0308ee1299d03d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372020
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-18 14:14:19 +00:00
Sam Rawlins 8c918ffda3 analyzer: Fix resolution of private extension members
Fixes https://github.com/dart-lang/sdk/issues/45240

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Idc054d968c5884dcf6bc876d996c741e8300cab0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-17 18:28:21 +00:00
Parker Lougheed 041d4ffd6a [analysis_server] Disallow construction/extension of namespaced enumerations
Change-Id: Ic4279ed0c29649b7ad7ece1e190606fe04f2778f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371504
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-17 15:23:00 +00:00
Keerti Parthasarathy 627cd3047d Hide nonVirtual elements in override completions.
Fixes https://github.com/dart-lang/sdk/issues/55628

Change-Id: I70dcf5b47dae2faef30a47a4e3f811e735a1eeec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-06-14 23:45:19 +00:00
pq 2e9bd8a967 quick fixes for EXTENSION_{TYPE_}DECLARES_MEMBER_OF_OBJECT
Quick fixes for:

* `EXTENSION_DECLARES_MEMBER_OF_OBJECT`
* `EXTENSION_TYPE_DECLARES_MEMBER_OF_OBJECT

See: https://github.com/dart-lang/sdk/issues/55917


Change-Id: I4a3576f7e78c58a4cf7dd6d659b576f2c7f11279
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371686
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-14 20:47:02 +00:00
Parker Lougheed 2cd388617e [analyzer] Fix spelling of new workspace diagnostics
Change-Id: I94c0fce250845faf2fbc5ecb0d0865393600a636
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371503
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-06-14 20:32:27 +00:00
pq de63980b40 quick fixes for SUBTYPE_OF_{BASE,FINAL}_IS_NOT_BASE_FINAL_OR_SEALED
Quick fixes for:

* `SUBTYPE_OF_BASE_IS_NOT_BASE_FINAL_OR_SEALED`
* `SUBTYPE_OF_FINAL_IS_NOT_BASE_FINAL_OR_SEALED`

See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I1ee373fb030a1570f93e3a7bee694aa0ecc974f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371683
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-14 20:16:46 +00:00
pq 5d3578a2a9 quick fix for WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER
(`error_fix_status.yaml` to be updated when pending quick fixes are landed.)

See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I042f6dc2171a37d008c6c2c4d1f843e0bcffc46c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371662
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-14 19:03:50 +00:00
Keerti Parthasarathy 205ad1c492 [dart-fix] Output pubspec error code in lower case, similar to other error codes.
Fixes https://github.com/dart-lang/sdk/issues/55945

Change-Id: I3e03148222e215ea1afd53377f83e86e0983bca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371502
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-06-14 15:52:23 +00:00
Sam Rawlins 50e4c576b9 analyzer: fix various issues for static extension member resolution
* Unqualified, out-of-scope static extension members are not
  accessible.
* Locally scoped extension members shadow others.
* Static and instance extension members do not conflict.

Fixes https://github.com/dart-lang/sdk/issues/41268

Fixes https://github.com/dart-lang/sdk/issues/55848

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Icd618d044b3857efa24f365c6835d42c0022c176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370323
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-06-14 00:59:57 +00:00
Danny Tuppeny bf7f5171e5 [analysis_server] Treat field formal parameters and fields equally when finding references in LSP
This changes LSP's Find References to treat fields and field formal parameters as a single entity (matching what Document Highlights (Occurences) and Rename refactor does).

It does this in one direction by resolving the initial element to a field if it's a FieldFormalParameter, and in the other by including FieldFormalParameters when collecting the set of elements in the hierarchy to find references to.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4868

Change-Id: I33626a8d58f35d0c3bda574078f32bf98f4bc87c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 18:34:33 +00:00
pq dcf72c0882 quick fix for REPRESENTATION_FIELD_TRAILING_COMMA
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Ib278e49749618325c8c5fcc7a5627840f87c4553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371401
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-06-13 18:02:14 +00:00
Danny Tuppeny 1ea71b4b9b [analysis_server] Handle unexpected types in LSP experimental client capabilities LSP gracefully
Previously if you sent values in experimental capabilities that are different types to what we'd expect, in some cases we'd throw an exception and fail to initialize the server.

Since the experimental section is not specified (it's specifically for off-spec things) the behaviour of sending values should (IMO) be considered server-specific. However, reporting a useful message and continuing to function is clearly better than reporting a cryptic error and failing to initialize.

At least one client (`kak-lsp`) appears to be sending values in `"commands"` intended for the Rust LSP server which uses a different format to we're using (a nested Map where we use a List). This change will prevent the failure for them and instead report a warning. My recommendation is that their client is also updated to not send Rust experimental capabilities to non-Rust servers.

Fixes https://github.com/dart-lang/sdk/issues/55935

Change-Id: I8cba1aa3a5beebf884ff247180f809ffd33b3111
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 17:29:49 +00:00
pq 9e51c2fa74 quick fix for EMPTY_RECORD_TYPE_WITH_COMMA
(Also improves fix description for `EMPTY_RECORD_LITERAL_WITH_COMMA`.)

See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: I742506d8c1a77b10f99861aa84947f8d348916df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-13 17:05:54 +00:00
Konstantin Shcheglov 4e8af3bb56 DevX. Issue 54497. DeclaredVariablePattern in ForEachPartsWithPattern to final.
Bug: https://github.com/dart-lang/sdk/issues/54497
Change-Id: Ifa195d29a1a4db47fa12c221e6969ed0d8578a72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-13 16:57:51 +00:00
Brian Wilkerson 80ba2a9524 Produce completion locations where previously produced
There are many places where the code is producing a different location
than OpType is, but those can be handled is a separate CL.

Change-Id: Idea7529a3e64ddb25a9b15bb68f7537abd3d19e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371202
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-13 16:44:48 +00:00
pq 70f4e89ddf quick fix for EMPTY_RECORD_LITERAL_WITH_COMMA
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Ifee29c7623f3322d4a35534e1c2a00d1cd6b0b03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-13 13:02:45 +00:00
pq 5cc92cf696 quick fix for STATIC_SETTER_WITHOUT_BODY
See: https://github.com/dart-lang/sdk/issues/55917

Change-Id: Id3b704915c03b61d9ba778b96c6e6fc55e1ef3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-06-13 12:12:39 +00:00
Konstantin Shcheglov 78a0c7a5e1 DevX. Issue 54567. Support for joined cases in 'Convert to switch expression'.
Bug: https://github.com/dart-lang/sdk/issues/54567
Change-Id: Idb6cc7ecd88e1e9e3b14c6a54176c958bac36afa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-12 22:10:47 +00:00