Commit Graph

6485 Commits

Author SHA1 Message Date
Sam Rawlins e66a8a4fa3 analyzer plugins: parse version and path keys in YAML
This enables plugin sources to be specified in one of three ways:

* as a YamlScalar, like `plugin_name: ^1.2.3`
* with a 'version' key, like `plugin_name:\n  version: ^1.2.3`, which
  allows diagnostic configurations to be alongside.
* with a 'path' key, like `plugin_name:\n  path: foo/bar`, which
  allows diagnostic configurations to be alongside.

We introduce a PluginSource with a `toYaml` method to convert the
values back into YAML for the generates pubspec. We update
PluginPackageGenerator to use PluginSource.toYaml.

Change-Id: Ic5f372f0339edd6aa638dd9b568a83f41a023b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 19:41:00 +00:00
Robert Nystrom 732b07a42b Roll dart_style into the SDK.
I'm still chasing down a couple of google3 failures, but this is ready for review so that I can get it approved and land it once the last couple of failures are fixed. Here is who I think should review what:

athom@ for:

- DEPS

johnniwinther@ for:

- pkg/_fe_analyzer_shared
- pkg/front_end
- pkg/kernel

brianwilkerson@ for:

- pkg/analysis_server
- pkg/analyzer_plugin
- pkg/analyzer_utilities

kenzieschmoll@ for:

- pkg/dartdev

pquitslund@ for:

- pkg/linter/lib/src/lint_codes.g.dart

If you're not the right person, feel free to summon someone else.

Most of the changes here are re-running code generators that auto-format the code they generate. The changes are:

Roll in the latest dart_style commit:

- DEPS

Manually updated these test expectations to expect the new style:

- pkg/analysis_server/test/lsp/format_test.dart
- pkg/analysis_server/test/services/refactoring/agnostic/change_method_signature_test.dart
- pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
- pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
- pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
- pkg/analysis_server/test/src/services/refactoring/convert_selected_formal_parameters_to_named_test.dart
- pkg/analysis_server/test/src/services/refactoring/move_selected_formal_parameters_left_test.dart

This was auto-generated by something, but I'm not sure why it thinks there is a diff:

- pkg/analyzer_plugin/doc/api.html

Updated to require a version of dart_style that accepts a language version in DartFormatter():

- pkg/analyzer_plugin/pubspec.yaml

Updated to always use the latest language version (and thus new style) when invoking the formatter:

- pkg/analyzer_utilities/lib/tools.dart

Manually updated the formatting in the code templates so that they matched the formatting expected by the tests, which implicitly format using the latest language version:

- pkg/dartdev/lib/src/templates/...

The rest are all generated files that are formatted so re-generated using the new style:

- pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
- pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
- pkg/analysis_server_client/lib/handler/notification_handler.dart
- pkg/analysis_server_client/lib/src/protocol/...
- pkg/analysis_server/lib/protocol/protocol_generated.dart
- pkg/analysis_server/test/integration/support/integration_test_methods.dart
- pkg/analysis_server/test/integration/support/protocol_matchers.dart
- pkg/analyzer_plugin/lib/protocol/...
- pkg/analyzer_plugin/test/integration/support/integration_test_methods.dart
- pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
- pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
- pkg/analyzer/lib/src/dart/error/...
- pkg/analyzer/lib/src/error/codes.g.dart
- pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
- pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
- pkg/analyzer/lib/src/summary/format.dart
- pkg/analyzer/lib/src/wolf/ir/ir.g.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_000_1.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_001_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_010_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_100_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/simple/...
- pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
- pkg/front_end/lib/src/codes/cfe_codes_generated.dart
- pkg/front_end/lib/src/util/parser_ast_helper.dart
- pkg/front_end/test/parser_test_listener.dart
- pkg/front_end/test/parser_test_parser.dart
- pkg/front_end/testcases/...
- pkg/kernel/lib/src/coverage.dart generated
- pkg/kernel/lib/src/equivalence.dart generated
- pkg/linter/lib/src/lint_codes.g.dart

Change-Id: Ice0141b763e63b84f54692cd19a442a0719673c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391263
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-06 18:42:25 +00:00
Keerti Parthasarathy c30f961f13 Delete unused code - RuntimeCompletionComputer
Change-Id: I4fd027998ce4f9fa847df2ddd0773c3a476e766a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393701
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 12:59:00 +00:00
FMorschel 9d340db3e6 Fixes import prefix hover text as code
R=srawlins@google.com

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

Change-Id: I37fa39f385dd26dfcf55c024b9ca331ec83381f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-05 18:10:19 +00:00
FMorschel 6eda5e2019 [DAS] Fixes add const for final variables and lint
R=srawlins@google.com

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

Change-Id: I75dd2c0063ea5d3a6ebbf4afb734d2cb5d98c1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392860
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-11-05 15:48:00 +00:00
Chloe Stefantsova 8a1c0203b4 [analyzer] Handle null-aware elements in code completion
Part of https://github.com/dart-lang/sdk/issues/56989

Change-Id: Id02c049d0afb5cb6c3f1d94ee5bebf7ca532e2e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392902
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-05 10:57:28 +00:00
Chloe Stefantsova 523ab95e64 [analyzer] Add call hierarchy tests for null-aware elements
Part of https://github.com/dart-lang/sdk/issues/56989

Change-Id: Ifd09b47fbb83519277fc6968a8edf8cdcdf76d6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393321
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-11-05 06:45:08 +00:00
Konstantin Shcheglov 4f6b07c25e CQ. Remove available declarations.
Bug: https://github.com/dart-lang/sdk/issues/55281
Change-Id: Ie8d2a7f3d5ea9408320312d49eb67561ca463289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393480
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 21:30:08 +00:00
FMorschel d5e19c60b7 Fix for completion inside late final fields
R=paulberry@google.com

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

Change-Id: Ib1a5ca0c27df2d19bca36f7385c30b02811c2e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393043
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 16:34:58 +00:00
FMorschel 5e6a681445 Fix hover import prefix
Fixes https://github.com/dart-lang/sdk/issues/32735

Change-Id: I6830b61fe554065f9ec6e87f2ac24dfaffd67f35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
2024-11-01 14:16:58 +00:00
Sam Rawlins 1033027175 Tidy some legacy plugin code
* Update comments to be modern and reference "package config files"
  rather than "packages files"
* Remove commented out code that we aren't going to uncomment.
* Rename PluginFiles.packages.
* Simplify `PluginManager._computeFiles` to use less nesting, and use
  early `throw` statements, rather than storing data in local
  and choosing late whether an exception should be thrown with the
  stored data.

Change-Id: I7d5da0e299962d8887f2222137478a2fd96671b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-31 19:12:30 +00:00
FMorschel df520c9ee3 [DAS] Import library with prefix
R=srawlins@google.com

Fixes https://github.com/dart-lang/sdk/issues/55863
Fixes https://github.com/dart-lang/sdk/issues/41515
Fixes https://github.com/dart-lang/sdk/issues/24338

Change-Id: I8b8457488b55a468d4b3c6d34efffc7436a2ff18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389780
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-31 16:57:03 +00:00
Danny Tuppeny ca0cfad6bd [analysis_server] Add occurrences/document highlights for type aliases
Fixes https://github.com/dart-lang/sdk/issues/56994

Change-Id: I0721603b7b019ab09614265e412d3b9e76d26ad9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392660
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-30 20:27:54 +00:00
FMorschel 006caad390 [DAS] Inline enclosing else block assist
Fixes https://github.com/dart-lang/sdk/issues/56924

Change-Id: Ib697e7b29671331f4e5b87a2472e3be60f89ffa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391021
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 19:47:38 +00:00
FMorschel a40403e0fb [DAS] New assists for wrap with Expanded/Flexible
R=pquitslund@google.com

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

Change-Id: I34a697d914e3a480105a4388d77178a96425893a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390622
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-30 17:26:18 +00:00
Samuel Rawlins 81f4b71293 Reland "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b3f31a0440.

Reason for revert: Customer tests are now disabled.

Original change's description:
> 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>

Change-Id: Icbe69690e83daecc5a0649d2f632ffc33ba6394c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-10-30 16:56:16 +00:00
FMorschel 9612b71707 [DAS] Update combinator - Use aliased import fix
R=scheglov@google.com

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

Change-Id: I1354e3cde559229d5167a27e51efb6d030e5f8bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 16:10:11 +00:00
Danny Tuppeny 37af167cc5 [analysis_server] Fix missing semantic token modifiers for dynamics
This removes `_addIdentifierRegion_dynamicLocal` and just inlines the region kind into the existing variable/name methods, that way the modifiers are still applied without having to duplicate them in `_addIdentifierRegion_dynamicLocal`.

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

Change-Id: I7f39ec828c916de0fb99d8c71baa78a2f690c94b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392582
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-30 15:31:14 +00:00
Danny Tuppeny 56fc83656a [analysis_server] Fix occurrences highlighting for prefixed identifiers
Fixes https://github.com/dart-lang/sdk/issues/56981

Change-Id: I817625962b5a4975ec5f597ab147fe7312cdf06f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392580
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-30 15:27:39 +00:00
Danny Tuppeny 97dafd74f5 [analysis_server] Consider sort_constructors_first lint when sorting
Fixes https://github.com/Dart-Code/Dart-Code/issues/4934

Change-Id: Ic6c739a2aaf6f62ecf0c2488a32f90c3f19738a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-29 20:04:49 +00:00
Keerti Parthasarathy e573f64f48 Create LSP CompletionItem from CandidateSuggestion, bypassing the SuggestionBuilder.
This eliminates the step of converting CandidateSuggestion to legacy completion item and then into LSP completion item. Also makes use of the SuggestionCollector to sort and truncate suggestions.

The utility functions/methods are in completion_utils.dart, these are based on the code in mapping.dart, modified to use CandidateSuggestions.

Change-Id: I1e44a5318575eeb3b89803e20a082f98b7bedd41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392082
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-29 15:16:43 +00:00
Sam Rawlins 97871aeab5 analyzer: Use less AnalysisOptionsImpl
In many cases, AnalysisOptions is sufficient.

* ResolvedCorrectionProducer will be public API for someone writing an
  analyzer plugin; it should not expose an AnalysisOptionsImpl. Luckily
  the only need for the Impl, today, is in the "ignore diagnostic" fixes
  so we can cast in there. (We could also expose the `file` and the
  `unignorableNames` fields.)
* Some other spots only cast in order to access one of the 'strict'
  fields, but all of those have been made public.
* AnalysisOptionsImpl.enabledLegacyPluginNames can be made final.
* Many other users don't need AnalysisOptionsImpl, or only need it to
  pass it to other code that _does_ need it. In many of those cases it
  makes sense to look at an object as an AnalysisOptions, and let the
  code that needs a field from Impl to do a cast.

Change-Id: I3640934fb9d93c9b95f15a22457af604e420c7a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-29 14:22:58 +00:00
Danny Tuppeny 12d9554c5b [analysis_server] Don't treat non-existent files the same as empty files when checking if didOpen changes content
This code assumed `driver?.fsState.getExistingFromPath(path)?.content` would be null for files that didn't exist, but actually we can get a `FileState` with `exists=false` and an empty string for `content`. We should not consider this equal to an empty file that was just opened.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5269
Fixes https://github.com/dart-lang/sdk/issues/55318

Change-Id: I4334a002ef0fb9ff3a9423568faa6e0735369022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392142
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-28 19:07:44 +00:00
Danny Tuppeny b1e740f316 [analysis_server] Migrate Overrides + DocumentationComputer
`DocumentComputer` currently makes use of `asElement2` to allow callers to still pass `Element`s so they can be migrated in separate CLs.

Change-Id: I44c49782498899d377defb90a8cd3813288c169e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391662
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-28 15:59:24 +00:00
Sam Rawlins 155a64c1b7 DAS plugins: Allow plugin rules to be disabled by default
This bumps the Registry class to be able to take "rules that are enabled  by default" and "rules that need to be explicitly enabled", "lint rules" and "warning rules". Next is to improve the classes.

Add parsing for the top-level `plugins` section, and
`PluginConfiguration` class to hold this data, and
`get pluginConfigurations` on AnalysisOptions.

Rename `parseLintRuleConfigs` to `parseLinterSection` to align better
with the other functions in engine.dart.

Rename `_ruleConfigs` function to `parseRulesSection`.

Change-Id: Ib93b7548bfb13cc94381971a5a2780a5dc81e9f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-28 01:42:02 +00:00
FMorschel b2bc791c81 [DAS] Convert related to cascade fix
R=scheglov@google.com

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

Change-Id: I64d81aaeb5286508e9b03869fd34fc592b0870e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-24 18:07:14 +00:00
Danny Tuppeny 93fda3ea7d [analysis_server] Use the correct language version for formatting in the LSP server
Fixes https://github.com/dart-lang/sdk/issues/56941

Change-Id: I675e732ceba98ab88904906c8076e805fcc9ca2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391663
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-23 23:52:13 +00:00
FMorschel 10db3de794 [DAS] "Update library import" edit hide
R=srawlins@google.com

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

Change-Id: I2d16e18a3644333f57f77c1b2ead86c8734c2cd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390630
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-23 16:50:27 +00:00
Konstantin Shcheglov 3af9430ebf Elements. Separate Element2.name from Element.name by renaming to 'name3'.
They were intersecting at ElementImpl and Member(s).

This will unblock updating implementations to make them nullable.

Change-Id: Ic9907eaa0ef08c096839f212668fa1e3d92bbf3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-23 15:53:40 +00:00
Konstantin Shcheglov 5899918bda Elements. Migrate ImportAnalyzer and its tests.
Change-Id: Ief9f299769000f4fb6b23354e58c68b2579b0518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-22 17:12:30 +00:00
Konstantin Shcheglov e9d03a04d6 Elements. Update FindElement2 to work with elements, not fragments.
Related to: https://dart-review.googlesource.com/c/sdk/+/390812

No more `Fragment.name2` uses in `FindElement2`.

Change-Id: Idb5e766f4ced1b63bb2154d6fb1bdf5582011d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390633
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-21 19:44:53 +00:00
Parker Lougheed 32d3c4460f [analysis_server] Account for late keyword in convert to getter assist
Change-Id: I421ec8c9393ba1f602eee98010f9e5b6114dd7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391060
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-21 15:22:55 +00:00
Honza Bittner ec6dfd4019 fix: joining if-cases
Closes https://github.com/dart-lang/sdk/pull/56920

GitOrigin-RevId: 4e9075cacc6d4af73775aae1d42ee6fde4377b4e
Change-Id: I8873082cc993de8b65191d02537f8199dd4fc68c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390632
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-21 15:04:57 +00:00
FMorschel 2552905b39 [DAS] Organize imports fix, remove unused shown name
R=pquitslund@google.com

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

Change-Id: I9b8a27fa17273171a7384ef8c2df05b3aa6ff5c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390668
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-18 20:08:45 +00:00
Brian Wilkerson 2c960d5d4f Add access to FindElement2 in the test framework
Change-Id: I8a0def9df469a8e629e67e5c8cbd343bd076f74e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390925
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-18 20:00:40 +00:00
pq 2f2cf79664 [server] bump SDK constraint; wildcards FTW!
Change-Id: I35b68be178eb5518f12520dfd523162b0eb3428d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-16 21:28:20 +00:00
pq 7dd74af455 [cq] move elideTo tests
Change-Id: If96dc644d1c8ba443413a0ec514c87d020ae6b6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390582
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-16 18:26:26 +00:00
pq fe66b2d525 [cq] move flutter extension to analyzer
Making this available in analyzer will allow me to de-dup a bunch of similar logic in the linter...

Change-Id: Id9991eb3b3a11fed4eff596302beffb814ba86bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-16 17:24:56 +00:00
Samuel Rawlins dac5fa8567 Revert "lint rule: Remove the avoid_null_checks_in_equality_operators rule"
This reverts commit 5572900016.

Reason for revert: broke the assorted_layout_widgets customer tests.

Original change's description:
> lint rule: Remove the avoid_null_checks_in_equality_operators rule
>
> Fixes https://github.com/dart-lang/linter/issues/5063
>
> Change-Id: I85a3c9e1a568d55ce1e21d0f1fee4ce1c83292f4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389300
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>

Change-Id: I3ff1448088f4d5163dc66f6e181a97302c4d137a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390300
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-10-15 20:25:28 +00:00
FMorschel 96ab3c1e44 [DAS] Consider two lint rules when converting forEach to a for-in loop.
R=keertip@google.com

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

Change-Id: I7188b3c8fee661623ea57158cc3cd0bf601b9fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-15 17:09:15 +00:00
Sam Rawlins 5572900016 lint rule: Remove the avoid_null_checks_in_equality_operators rule
Fixes https://github.com/dart-lang/linter/issues/5063

Change-Id: I85a3c9e1a568d55ce1e21d0f1fee4ce1c83292f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389300
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-14 20:57:04 +00:00
Brian Wilkerson f77b5c19a3 Migrate snippet support
Change-Id: I4bcfc81ab75dd484753fe8a322c449326098539c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-14 18:21:29 +00:00
Parker Lougheed aa6f85ccc3 [analysis_server] Don't suggest removed lints during completion
Change-Id: Ibe05a2683045e6b94852f9e3157a1048949dbd44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389782
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-14 15:08:39 +00:00
Sam Rawlins 9baaa5f141 Reland "analyzer: Write out qualified extension names in error messages"
This is a reland of commit 10c1d883df

This includes a fix in listener.dart to not null-assert on an
element's name (`element.name!`). This fixes a problem in google
internal code.

Original change's description:
> analyzer: Write out qualified extension names in error messages
>
> Fixes https://github.com/dart-lang/sdk/issues/56269
>
> Change-Id: I025966fd4aa3d7c5b71175321f21f95e8c41f086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388580
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I6c20cf023af26b2d3b0fe9d8193f5e067719da8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389587
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-11 20:08:31 +00:00
Danny Tuppeny 2bd91e8e58 [analysis_server] Rename some LSP types to match upcoming LSP 3.18
In the upcoming LSP 3.18 spec, many types that were previously inline literal types with no names (that resulted in us auto-generating names) have been made real types with names.

In order to reduce the size of the change when LSP 3.18 arrives, this change renames some of our existing types to match the new names that they will get with LSP 3.18.

There are no functional changes here, I simple added the names to the rename list (removing any redundant values that were previously being renamed differently), regenerated the code, and then updated any remaining references (in non-generated code) to those types to match.

Change-Id: Ic556ce6e52ba94a8d42099371be18288230cd5ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-10 15:08:41 +00:00
FMorschel 88113a2b9f Fix errors when type is future of required type
R=scheglov@google.com

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

Change-Id: I03664df4f3fe3464344079f37a2ea00fa881fffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-10 14:24:40 +00:00
FMorschel 74804fd092 [DAS] Add fix for swapping division operators when undefined
R=pquitslund@google.com

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

Change-Id: Ifb8822f98483e68afa21b3a5a49045149604fa55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388074
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-09 21:00:13 +00:00
Danny Tuppeny 7088dc4a00 [analysis_server] Ensure progress notifications are sent for new interactive refactors
Fixes https://github.com/Dart-Code/Dart-Code/issues/5235

Change-Id: I538f62631b5dc972cb3395ccbaf8a24d6accb5d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-09 19:36:15 +00:00
Danny Tuppeny 75d15bbfa3 [analysis_server] Support formatter page width from analysis_options in legacy protocol
This adds the same support previously added to LSP to the legacy protocol.

As with LSP, the value in analysis_options overrides the explicit argument (since the expectation is that the user has not specifically chosen this value for this file, but rather as a default for the project/globally).

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


[analyzer] Add support for "formatter" in analysis_options + use page_width in LSP

This adds support for validation + completion for `formatter/page_width` in analysis_options, and uses this value in preference to the client-supplied value in the LSP server.

It does not yet add support for the legacy protocol, and there are a few questions in https://github.com/dart-lang/sdk/issues/56864#issuecomment-2399289974.

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

Change-Id: Ic2be00087f78eb62c409dbc8f558d2f24b521f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-08 17:31:46 +00:00
Danny Tuppeny 5d84439f5d [analyzer] Add support for "formatter" in analysis_options + use page_width in LSP
This adds support for validation + completion for `formatter/page_width` in analysis_options, and uses this value in preference to the client-supplied value in the LSP server.

It does not yet add support for the legacy protocol, and there are a few questions in https://github.com/dart-lang/sdk/issues/56864#issuecomment-2399289974.

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

Change-Id: I7844e3abd1191beb9cc24197bbc8aa7c9e9ad4fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388822
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-08 16:37:54 +00:00