Commit Graph

6367 Commits

Author SHA1 Message Date
Danny Tuppeny ddab694633 [analysis_server] Add failing test for auto-import extensions
See https://github.com/dart-lang/sdk/issues/56320

Change-Id: I6a21ef528d6d67a34e7f845c6cb279f246fe2762
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-08-28 21:39:47 +00:00
Samuel Rawlins b3f31a0440 Revert "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b551690c56.

Reason for revert: flutter customer tests failing: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738601049545714785/+/u/run_test.dart_for_customer_testing_shard_and_subshard_None/stdout

Original change's description:
> Reapply "analyzer: separate unused_element_parameter from unused_element"
>
> Fixes #49025. Fixes #48401
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> This reverts commit b888da751e.
>
> Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
> Tested: trybots
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: Ie0df2f4be45e5db2fa255dcf8c30ddf8408c155b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382420
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-27 17:44:28 +00:00
Danny Tuppeny 8ca61608d8 [analysis_server] Add an allow-list for LSP methods exposed over DTD
Before exposing existing LSP methods we need to provide a way for DTD clients to always get the same format responses regardless of the client capabilities provided by the original server. Until then, add an allow-list for LSP methods that we can use to selectively enable specific methods that are not affected by client capabilities.

Change-Id: Ia1c994a50c9b94a91f4085c09f9d9d94c0fad79e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-08-27 16:50:15 +00:00
pq c371785d42 [wildcards] legacy navigation tests
See: https://github.com/dart-lang/sdk/issues/56567

Change-Id: I0abf861903e440f3bc6162e671c71d134786e8d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-26 23:05:57 +00:00
pq a4a146d3c4 [wildcards] legacy occurrences tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I5426ef22d56f6c2ab92a2028969cebd867a676ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-26 22:59:09 +00:00
Fedor Shcheglov a5cfca1b48 Issue 56572. Fix suggesting extension methods on record types.
Bug: https://github.com/dart-lang/sdk/issues/56572
Change-Id: I47e4b07270843ffb53ab90963e04f01b3b105043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382261
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-08-26 21:18:56 +00:00
pq ee0b971dbd [wildcards] ‘go to super’ tests
Change-Id: I5ffdffe84356e3431d1c4e7b8b861ae812dbbe85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381884
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-24 00:07:00 +00:00
pq 9d916f4fdc [wildcards] ‘document highlights’ test
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I3297ede2b7dea1247ab8f2b6e8c972acac53c4c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381885
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-24 00:03:17 +00:00
pq 4f4ba74d8b [wildcards] implementation marker tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I29afe39dd293e2e9da67791ad92f3d6d8356493e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381807
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-23 23:58:58 +00:00
pq 63ccfe81be [wildcards] hover tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I58630feb6e8b35b00d90d20c305a2f0ca9b37e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382042
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-23 23:55:14 +00:00
pq f8471fbd7e [wildcards] type definition tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: Ib264ddfa2937e6c7fe1a0189a79255b137426bba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381944
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-23 23:50:27 +00:00
pq 2df7d1a751 [wildcards] find reference tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: Ia1f8cc08d7a79fe66fce9ac108543cb2a6aebd34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381943
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-23 21:38:39 +00:00
Sam Rawlins b551690c56 Reapply "analyzer: separate unused_element_parameter from unused_element"
Fixes #49025. Fixes #48401

This allows users to blanket ignore unused_element_parameter without
ignoring unused_element. They are reported in distinct situations so it
is valid to separate them.

This reverts commit b888da751e.

Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
Tested: trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-23 20:49:01 +00:00
Danny Tuppeny da414c2957 [analysis_server] Allow passing a DTD URI to the analysis server so it can provide LSP functionality to DTD clients
This adds a new request `dart/connectToDtd` that lets a client pass a DTD URI to the server. The server will connect to DTD and provide a subset of LSP methods (those that are currently available over LSP-Over-Legacy, minus the `connectToDtd` method itself) to DTD clients.

This works for both LSP and Legacy servers, and the shared tests run against both (where for legacy, the `dart/connectToDtd` request uses the LSP-over-Legacy support).

This is not currently behind a flag, however it won't do much on its own because no clients will make this request. Once we're happy the functioanlity is good we can either agree an SDK version number for IDEs to gate calling this method on, or we can expose a flag in server capabilities (and some equiv for legacy) so the client knows the functionality is available.

Change-Id: I911d37745a1b2685249dd88e4b152c3196ba627c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379303
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-08-22 20:43:41 +00:00
Danny Tuppeny 337ad11aca [analysis_server] Don't create additional analysis contexts for sub-folders of folders with plugins enabled
This fixes a bug in c0c697bebe where a folder with no analysis_options would be treated as if it had no plugins enabled, which inside a parent that did have plugins would look like plugins changed, and create an additional context.

Change-Id: I48a14ca92519e6798c6ca58cab6966c7996dc257
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381860
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-08-22 14:39:46 +00:00
Danny Tuppeny c0c697bebe [analysis_server] Create context roots where plugins are enabled
Fixes https://github.com/dart-lang/sdk/issues/56475

Change-Id: I3e8da83a6fea07482faba4d86aa3db6c6ce8df4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381481
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-08-21 16:21:30 +00:00
Danny Tuppeny a76ff6b2cf [analysis_server] Add failing tests for analyzer plugin issue
This adds failing tests for https://github.com/dart-lang/sdk/issues/56475.

If this CL is applied to the 3.5 release and the `singleOptionContexts` flag set back to `true` (matching 3.4 behaviour), the tests will pass. Each package in both tests will get its own context root (because they have analysis_options to enable the plugins) and each one will read the correct plugins that are enabled.

However if `singleOptionContexts` is `false` (as shipped in 3.5) or this code is applied to bleeding-edge (where the flag is gone, but behaves the same as `false`) both tests fail as follows:

`test_sentToPlugins_inNestedPackages_withPackageConfigs` fails because we read the child analysis_options for the root and try to incorrectly load plugins from the root (and include duplicates and allow more than one plugin):

```
  Expected: {
              'package1': ['plugin1'],
              'package2': ['plugin2'],
              'package3': ['plugin1']
            }
    Actual: {
              'home': ['plugin1', 'plugin2', 'plugin1'],
              'package1': ['plugin1', 'plugin2', 'plugin1'],
              'package2': ['plugin1', 'plugin2', 'plugin1'],
              'package3': ['plugin1']
            }
```

`test_sentToPlugins_inNestedPackages_withoutPackageConfigs` fails because we now only have a context root for the root which enables all plugins from the children:

```

  Expected: {
              'package1': ['plugin1'],
              'package2': ['plugin2'],
              'package3': ['plugin1']
            }
    Actual: {
              'home': ['plugin1', 'plugin2', 'plugin1']
            }
```
Change-Id: I12f45eeb5c1848352af26ac3fdb690e51833c22a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381460
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-08-20 20:13:57 +00:00
Paul Berry 045d26bc74 Make unnecessary_breaks apply to default clauses
Fixes https://github.com/dart-lang/linter/issues/5061.

Change-Id: Ia5b9db3921d1d3aa95e19bc88cd3b4cde666d919
Bug: https://github.com/dart-lang/linter/issues/5061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380285
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-08-20 18:15:47 +00:00
pq 622c9b5254 [wildcards] LSP definition tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I733947154352f887896e48b96ead34d8e8159fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381307
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-20 17:40:48 +00:00
pq 6413386f29 [wildcards] improve _ type param handling
See: https://github.com/dart-lang/sdk/issues/56361

Change-Id: Ic3be09014afc095490d9332bd124843b5a65e1cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381385
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-20 17:07:33 +00:00
pq 325c1293b6 [wildcards] inlay hint tests
See: https://dart-review.googlesource.com/c/sdk/+/381306

Change-Id: I47c481d7c770d6674687f72478f739a93a6d3e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381306
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-19 22:21:57 +00:00
pq 37bda88ce7 [wildcards] organize imports test
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: Iedffc92f6650fc6bd57672bad94c83acd54d26a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-19 22:17:41 +00:00
Keerti Parthasarathy 51bc97c22b Add a test to bulk fix processor to check for no exceptions when parsing yaml.
Change-Id: Ibfd800dfcd3f6640cd10eeffc398fb332956d1ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380079
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-19 15:04:30 +00:00
Paul Berry eb887c28bf Fix dead code removal when multiple cases share a body.
Fixes https://github.com/dart-lang/sdk/issues/56485.

Bug: https://github.com/dart-lang/sdk/issues/56485
Change-Id: Idea150d9b00bdf90ecff184da14ecbdbe5902a30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380901
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-08-16 14:19:28 +00:00
Sam Rawlins fbf62c12c2 DAS: Add assist to remove digit separators from number literal
Fixes https://github.com/dart-lang/sdk/issues/56467

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I711d0d483db0e61f907c884e33fb7511168dde2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380686
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-16 00:43:38 +00:00
Sam Rawlins f60b5bd855 DAS: Add digit separator tests for highlighting
Work towards https://github.com/dart-lang/sdk/issues/56188

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I852c9fe2301c297b8e5ae5b3157153774eaca740
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-08-15 01:00:16 +00:00
Halil Durmus 840729a90a [analysis_server] Show library documentation when hovering over unnamed
library directives

Closes: https://github.com/dart-lang/sdk/issues/53476
Change-Id: I33a8e0ebd3ed7999eba71985fabb90c17444bde6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-14 21:53:52 +00:00
Sam Rawlins 9d61a359d4 DAS: add some tests for digit separators in DocumentColor feature
Work towards https://github.com/dart-lang/sdk/issues/56188

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Id3d56ad5870208e15e89ad014a668a1e659b7d75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-08-14 21:38:48 +00:00
Sam Rawlins 5a7b16ba4c DAS: introduce some assists that add digit separators to number literals
Work towards https://github.com/dart-lang/sdk/issues/56467

Thw two assists do the following:

* Add a digit separators every 3 digits in a decimal int, a decimal
  double, and a scientific notation double.
* Add a digit separators every 2 digits in a hexadecimal int.

No assists are introduced which remove digit separators.

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I0920fb279285963c33a78d9288317213739ae83b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-14 20:22:47 +00:00
Konstantin Shcheglov 2c77c6749d Parts. Use macro generated parts, not library augmentations.
Change-Id: Id661f8bfc884f24056d49af048b5cb5c3c742812
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380211
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-08-14 20:04:21 +00:00
Erik Ernst eaabb3f8ab Add toString and hashCode as obvious, make int non-obvious
Change-Id: I5a83ba3e8d53972d00a16922cd681c0f330855f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380500
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-14 15:56:18 +00:00
Martin Kustermann b888da751e Revert "analyzer: separate unused_element_parameter from unused_element"
This reverts commit c1976b097d.

Reason for revert: It seems this change caused failures on Flutter
HHH bot. Example log can be found at [0]:
```
| lib/src/super_reader/super_reader.dart:615:14: Error: Final field 'showDebugLeaderBounds' is not initialized.
| Try to initialize the field in the declaration or in every constructor.
|   final bool showDebugLeaderBounds;
|              ^^^^^^^^^^^^^^^^^^^^^

```
Looking at the sources it seems that may be related to the
`// ignore: unused_element` analyzer directive:

```
   602	/// A [SuperReaderDocumentLayerBuilder] that builds a [SelectionLeadersDocumentLayer], which positions
   603	/// leader widgets at the base and extent of the user's selection, so that other widgets
   604	/// can position themselves relative to the user's selection.
   605	class _SelectionLeadersDocumentLayerBuilder implements SuperReaderDocumentLayerBuilder {
   606	  const _SelectionLeadersDocumentLayerBuilder({
   607	    required this.links,
   608	    // ignore: unused_element
   609	    this.showDebugLeaderBounds = false,
   610	  });
   611
   612	  /// Collections of [LayerLink]s, which are given to leader widgets that are
   613	  /// positioned at the selection bounds, and around the full selection.
   614	  final SelectionLayerLinks links;
   615
   616	  /// Whether to paint colorful bounds around the leader widgets, for debugging purposes.
   617	  final bool showDebugLeaderBounds;
```

So tentatively reverting this CL.

[0] https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8739650477551803313/+/u/Run_customer_testing_tests/stdout

Original change's description:
> analyzer: separate unused_element_parameter from unused_element
>
> Fixes https://github.com/dart-lang/sdk/issues/49025
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> Tested: Presubmit CI
> Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
> Change-Id: I4844a6a0e0a67cd5e37ed8735b1526e174deb950
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378500
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: Ibbba75fe56601c7c4b5535c9142cf94c2dd80b91
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380460
Commit-Queue: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-08-14 08:05:37 +00:00
Sam Rawlins c1976b097d analyzer: separate unused_element_parameter from unused_element
Fixes https://github.com/dart-lang/sdk/issues/49025

This allows users to blanket ignore unused_element_parameter without
ignoring unused_element. They are reported in distinct situations so it
is valid to separate them.

Tested: Presubmit CI
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I4844a6a0e0a67cd5e37ed8735b1526e174deb950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-13 12:12:13 +00:00
Erik Ernst 5b7c600d8b Implement the lint 'specify_nonobvious_local_variable_types'
This lint is the complement of 'omit_obvious_local_variable_types'
in that it flags every declaration that does _not_ specify the type
of a local variable, when it has an initializing expression whose type
is not obvious (defined as in 'omit_obvious_local_variable_types').

Change-Id: If80a961e47fed0412d0ea0bac5ac010e26fea7bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-08-13 09:43:49 +00:00
Konstantin Shcheglov 4cea10fbf0 Parts. Report PART_OF_NAME when Feature.enhanced_parts is enabled.
Change-Id: I85925218b37a7cb65a7b50da6cc968155fd4789e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380043
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-12 20:11:06 +00:00
Parker Lougheed 1f4f0d386a [linter] Generate lint codes from messages file
Change-Id: Id4f7ee5843a4063d1e527c1566847d88b355c614
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373725
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-08 19:24:30 +00:00
Konstantin Shcheglov 191996280a Parts. Switch from LibraryOrAugmentationScope to LibraryFragmentScope.
Change-Id: I6f8dd9a6c79afa6471a39cd56d0a24808555f569
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379662
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-08 18:22:52 +00:00
Sam Rawlins 093d867a0c analyzer: Remove DIVISION_OPTIMIZATION hint
This is replaced by the use_truncating_division lint rule.

Work towards https://github.com/dart-lang/sdk/issues/50796

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Ied034267f4f8e5ea70ed0b4a21c39e88c88240ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378574
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-08-03 02:47:41 +00:00
pq 4ec57e26b6 [wildcards] catch clause completion tests
See: https://github.com/dart-lang/sdk/issues/56361

Change-Id: I681e3b5ebfd2dcce3f377b8d45a492d44bf058a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378569
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-02 22:32:14 +00:00
pq 3b09a49ce5 [wildcards] ensure bound __ underscores are suggested in completions
See: https://github.com/dart-lang/sdk/issues/56361

Change-Id: Ia1b1a0fef17fb68f476d2ade96a0b5761152336b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-02 17:17:59 +00:00
pq 6b16fab819 [wildcards] completion suggestion support
See: https://github.com/dart-lang/sdk/issues/56361

To follow, a bunch of tests to make sure `__`, `___`, etc are not incorrectly getting special cased.

Change-Id: I3d35a5344e09011460c074fdd43eccdac452a8ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-02 14:51:14 +00:00
pq 60c0933f34 [wildcards] completion tests
See: https://github.com/dart-lang/sdk/issues/56361

Change-Id: Ib69a64b17a890c6cec0e1bddfd25f6fa7834b1cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378620
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-01 21:21:39 +00:00
pq 10cbc8f9b3 [wildcards] ensure signatures with wildcard params have types
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: Ibbb2771cea0311a6bf2145f663efff07f2f97d31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-31 21:16:49 +00:00
Sam Rawlins ed622c5300 DAS: Move FixInFileProcessor to analysis_server_plugin
Also move the top-level `computeFixes` convenience function.

The `computeFixes` function is the main entrypoint that various code
uses to, well, compute all fixes with a FixProcessor and a
FixInFileProcessor. In order for plugin code to call `computeFixes`,
we need that function and FixInFileProcessor in the
analysis_server_plugin package.

Work towards https://github.com/dart-lang/sdk/issues/53402

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Id5f02864762eeefb92055a3534e91b60b76dfeb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-31 19:16:27 +00:00
Danny Tuppeny 1e64108971 [analysis_server] Fix == overrides being truncated in LSP
The LSP completion mapping currently does some manipulation of values to fit better into the different fields LSP supports (to improve formatting and filtering). The code that splits the label on `=>` was also matching `==` in overrides but should not.

This is a simple fix to the regex to solve the issue, although longer-term (or at least if we see other issues as a result of this manipulation) this logic should be pushed up to the source so we have reliable fields and don't need to split things this way.

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

Change-Id: I056489df5aba417cab9162e027eb97579f71756b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-31 17:37:10 +00:00
Danny Tuppeny 5c064b125a [analysis_server] Handle token differences like GT_GT_GT vs GT,GT,GT when minimizing edits from the formatter
This generalizes the code that was handling `[`+`]` being replaced with a single token for `[]` to support arbitrary substitutions (and in both directions) to handle where GTs can be moved by the formatted (usually because of differences in wrapping of type parameters).

Change-Id: Ia7d75637fa5506a33db1e91111ab3b7fc060f3ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377647
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-31 14:26:49 +00:00
Danny Tuppeny f657b8b344 [analysis_server] Support "Go to type definition" for identifiers declared in "for in" loops
Fixes https://github.com/Dart-Code/Dart-Code/issues/5205

Change-Id: I9d28708c2df87771ab4d25786827fcd9dc91819d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-07-30 22:59:29 +00:00
Sam Rawlins 34ad8e075e Move FixProcessors and registeredFixGenerators to analysis_server_plugin
These two are needed in the shared package so that plugins can run
CorrectionProducers. They go in 'src' because plugin developers do not
need to see this code.

Work towards https://github.com/dart-lang/sdk/issues/53402

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Iee5b5dd063d5b0a9b00c58b91a3e50328c8b5fc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-07-30 21:17:13 +00:00
Konstantin Shcheglov 57392e8324 CQ. Put TreeStringSink into analyzer_utilities/ to reuse.
Change-Id: I7a1a3e6bc42830b842060fd778a6265ed614f9f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-30 20:32:24 +00:00
Danny Tuppeny c18b84d6d2 [analysis_server] Fix handling of "Do not show again" on Dart fix prompt
A recent change to support in-editor "dart fix" changed the switch expression here in a way that the handling of "Do not show again" no longer matched and apparently this case had no test 😔

This fixes the check and adds the missing test.

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

Change-Id: I4fe182824a103d77b88e3a84d941f722f071f117
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377940
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-30 19:58:57 +00:00