Commit Graph

501 Commits

Author SHA1 Message Date
FMorschel 6de0ef3d5f [DAS] Fix auto-complete update combinators
We already have a quick-fix that allows us to use the same existing import by editing the combinators. The auto-completer now should do the same.

Bug: https://github.com/Dart-Code/Dart-Code/issues/5238
Change-Id: I0f3a50299abb9890370a6c8934b49036f7e03196
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404525
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-03 11:15:57 -08:00
Konstantin Shcheglov 2946ea71d5 Macro. Remove more from analyzer/ and analysis_seever/.
Change-Id: Id5426cce73395d3d95657cf1e0b5f9d85fe3f574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-31 11:35:10 -08:00
Sam Rawlins f72576af3b analyzer_plugin: Introduce messages/types for plugin analysis status
There is no code in this CL that _uses_ the new AnalysisStatus
Notification or type, but landing it is important, so that I can test
plugins which will use the analyzer_plugin package from pub.

Change-Id: I31f835d5f7b8bda3781a6962d37f1f769b22852e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404702
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-01-16 13:26:09 -08:00
pq c988e32a56 [cq] remove unnecessary ignores
See: https://github.com/dart-lang/sdk/issues/35234

Change-Id: I4563df48df9d71332b3de6fabea9176e199c1ad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404202
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-13 15:05:28 -08:00
Konstantin Shcheglov 4be4ec7d36 Elements. Migrate AnalyzerConverter.
Change-Id: Ia3da05853e97e64899358bdc787c0226ba036bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403904
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 13:37:59 -08:00
Konstantin Shcheglov 75882f9bf7 Elements. Migrate CompletionTarget.
Change-Id: I3a7f4d13d0174ff282a1ead65616a8db685ef0d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 12:51:58 -08:00
Konstantin Shcheglov 26d91675f9 Elements. Migrate ElementSuggestionBuilder and related.
Change-Id: I3f282c1ec2f2ba277d9ae011b4723fa835e44c37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 12:19:03 -08:00
Konstantin Shcheglov d8fd208a79 Elements. Migrate test/src/utilities/change_builder/change_builder_dart_test.dart
Change-Id: If34018416b6aa115c0222fa71bfedb296fa665a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 11:44:31 -08:00
Konstantin Shcheglov 2766858fba Elements. Migrate lib/utilities/change_builder/change_builder_dart.dart
Change-Id: I0351cc1e4ecd88cf584e8a53f2fec7e2d1126c05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403706
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 09:47:11 -08:00
Konstantin Shcheglov 8785c4e000 Elements. Migrate lib/utilities/range_factory.dart
Change-Id: I218603ef0f3a9eae8bde3889cb22fa7f59000e38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403623
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-01-08 14:46:17 -08:00
Konstantin Shcheglov 8121b02725 Elements. Migrate test/support/abstract_context.dart
Change-Id: I75004a7f979315b838d2699a0dcdd8df13b2864d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403702
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-08 14:12:57 -08:00
Konstantin Shcheglov 810eeb4465 Elements. Migrate lib/src/dart/ast/element_locator.dart
Change-Id: I7b57a239cd21737292224d05b38b86a0dbd4643c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403642
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-08 13:21:29 -08:00
Konstantin Shcheglov a5468363c6 CQ. Remove unnecessary 'async' where no 'await'.
Change-Id: I58f56c098c9cec753325ab56d0aad37e1fde0ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403082
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-07 10:08:11 -08:00
pq e0fc77956b [element model] migrate import_library_element_test
Change-Id: I26235271301ef7691bd9559f57691e4e5f9d8ddc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401864
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-12-19 14:33:58 -08:00
Sam Rawlins dbf6008297 DAS: Support monospaced text (eg code snippets) in generated doc comments
We take any `<tt>`-wrapped text, and keep it in some "monospaced" /
"teletype" format. For dartdoc we put it in backticks. For Javadoc
we put it in `<code></code>`, which looks standard for inline text.

This corrects some erroneous doc comment reference-looking text
(`offsets[i]`) which is not meant to be a doc comment.

Change-Id: I1d77a02368e3cde158ce95d3b0095ba09e071370
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-12-17 12:24:58 -08:00
Sam Rawlins 7190cb0c3e analyzer: Use package language version to format generated files.
This fixes an issue of our code-generation scripts fighting the Dart
Format presubmit check.

Change-Id: Ib0dc77a4cd580c4f4fd077b48849984eefebc7e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400223
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-12 15:04:19 -08:00
Keerti Parthasarathy e01bbdfd1f Deprecate completions from plugins api.
Change-Id: I92737e2df4736672c93fc9a08eb7c90a41192afb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397882
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-12-02 21:10:21 +00:00
Sam Rawlins 9e86286b66 Tidy up ErrorProcessor and AnalyzerConverter
Some of the parameters noted can be required and/or non-nullable as
per our internal usage, but this is all public API, so I'm just leaving
a note.

Mainly just simplify the implementation of ErrorProcessor.getProcessor.

Change-Id: Idebcf4a2485029c914d495cabfa3a1e98824c72c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396360
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-11-20 17:49:24 +00:00
Jonas Finnemann Jensen d2d5de63a4 Avoid context confusion in ServerPlugin.analyzeFiles
Change-Id: Ib2500c17e4abe2a485fb8325134276f803113db4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388701
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-07 23:47:12 +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
Sam Rawlins bc58f69e53 analyzer: Move AnalysisOptionsImpl out of the generated directory
None of the code in AnalysisOptionsImpl or AnalysisOptionsBuilder is
changed.

Change-Id: I0d3253d80fdcd624c73720c35ece9d23a2582071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392180
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-28 21:03:33 +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
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
Sam Rawlins e29aa0cf3f analyzer: Convert applyOptions extension method into AnalysisOptionsBuilder builder.
Previously, the fields in an AnalysisOptionsImpl were primarily
arranged by an extension method, declared externally, called
`applyOptions`. It seemed very odd that this wasn't just a method on
AnalysisOptionsImpl; the "Impl" class is already private.

But it turns out that an AnalysisOptionsImpl is _mostly_ not mutated
in practice; the class wants to be immutable, with final fields.

In this change, I make AnalysisOptionsImpl mostly immutable, and
convert the `applyOptions` extension method, and all of its helper
code, into a builder class, AnalysisOptionsBuilder. While we don't
use a lot of builders in analyzer packages, this is a much more common
and idiomatic pattern for setting up complicated data, multiple values,
and then finalizing it all into an object that will not be changed
again during it's lifetime.

One big benefit of this refactoring is that most fields in AnalysisOptionsImpl are now final:

* sourceLanguageConstraint
* errorProcessors
* excludePatterns
* file
* strictCasts
* strictInference
* strictRawTypes
* chromeOsManifestChecks
* codeStyleOptions
* formatterOptions
* unignorableNames

Whereas before, they _all_ had to be mutable, as `applyOptions`, the
primary mechanism for setting up an AnalysisOptionsImpl, had to able
to write any field.

Other changes:

* Flip the instantiation of AnalysisOptionsImpl and CodeStyleOptions;
  now CodeStyleOptions is instatiated first, and AnalysisOptionsImpl
  sets itself as `codeStyleOptions.options`.
* Remove the private, deprecated, `applyToAnalysisOptions` function.

Change-Id: I6595d88aa5721e4f9a8b2b987482f9f43d27efd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390660
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-10-17 21:54:40 +00:00
Danny Tuppeny a79ab854f0 [analysis_server] Remove unnecessary pending imports for elements that are available from newer imports
When adding imports for elements, we could leave unnecessary imports because the first element is imported through one library, and then a subsequent element is imported through a library that _also_ includes the first element.

With this change, any time we add a new element import, we will check the existing pending imports to see if any of those can be satisfied by this new import, and if so map it over and check whether the old import is now unused by any element imports (and not an explicit import), in which case it can be removed.

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

Change-Id: I82b638dfd2a36a72e5c7c55cae73842907ea3896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-11 17:33:20 +00:00
Danny Tuppeny ffeadc947a [analysis_server] Fix sorting of different kinds of imports in DartFileEditBuilder.importLibrary
Previously any pending imports added by DartFileEditBuilder would just be sorted by their text ignoring the kind of import. If there were existing imports for dart, package, relative then they might be inserted in the right places, but if there were not (or not the right kind) of existing imports, they would be just be added in alphabetical order (rather than dart, then package, then relative).

This change extracts some of the rules for sorting directives from analysis_server's ImportOrganizer into analyzer_plugin/src so that they can be reused by the DartFileEditBuilder that lives there.

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

Change-Id: I6dc5476add2b7b1804080ffdc8270d0bb80597db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384284
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-10 14:43:58 +00:00
Danny Tuppeny 4636fbcc68 [analysis_server] Add a missing "break" to ChangeBuilder that could result in duplicate imports
Changes that add combinators to an import would also insert a duplicate import if they were not the last import, due to a missing "break" as they looped over the existing imports.

Change-Id: I3bf106a200be9ad102487f749df9fe4a9e89fb79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383260
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-05 16:51:58 +00:00
Danny Tuppeny 1fa3bd0c79 [analysis_server] Fix importLibrary() for empty prefixes
`DartFileEditBuilder._importLibrary says "If [prefix] is an empty string, adds the import without a prefix", however the handling of an empty string would not match with prefixless imports due to an equality check (null vs empty string).

There was already a correct check further down, so this change moves that check further up and removes the bad condition from the earlier check.

Change-Id: I6a3a38cf9cae23e0d5e07804ef262d515af741f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383322
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-04 17:59:38 +00:00
Konstantin Shcheglov 2aa54ab42c Parts. Fix unnecessary_import before landing the reporting CL.
https://dart-review.googlesource.com/c/sdk/+/382901 will start
reporting it in more cases.

Change-Id: I3ae1d407f37a317f33cb98977b0e6eb08de75065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383221
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-03 03:51:29 +00:00
Konstantin Shcheglov 8de1422a0e Parts. Deprecate Element.enclosingElement, use enclosingElement3.
Change-Id: Iadc4ed02d4bda3b882e65dc6f4d263a6a938e0fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-01 18:50:29 +00:00
Sam Rawlins 895093e9f9 Initial PluginServer implementation
This is the core implementation of the "plugin server" that will support the API described at https://docs.google.com/document/d/1T8P323DJxsc3YPzveNIaSKWFkrJp9ydTR4jp_XFb7XQ/edit?resourcekey=0-f8Ue29KMUizqXNGhATp1tg#heading=h.23fjh5hfm2is

This is heavily curbed from the ServerPlugin class at
`package:analyzer_plugin/plugin/plugin.dart`, but does not depend on it.
It depends on two concepts from the analyzer_plugin package: (1) the
protocol used for de/serializing requests, responses, etc. And (2) the
`PluginCommunicationChannel` class. This is also just a utility for
communicating between the analysis server and the plugin server.

This plugin server is capable of "registering" individual "plugins",
which allows plugins to register individual (maybe multiple) lint rules,
and individual (maybe multiple) quick fixes.

The plugin server for now only responds essentially to three requests:

* `ANALYSIS_REQUEST_SET_CONTEXT_ROOTS`
* `EDIT_REQUEST_GET_FIXES`
* `PLUGIN_REQUEST_VERSION_CHECK`

All files are analyzed during `handleAnalysisSetContextRoots`, and
quick fixes are calculated during `handleEditGetFixes`.

There are many TODOs, but the included test shows that this plugin
server can notify the analysis server of lint diagnostics to be
reported, and can respond to a query for quick fixes.

Change-Id: Ibc93332319220a2caf49d20ab480940041a15049
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-08-29 16:03:42 +00:00
pq 238f116757 enable experiments in abstract context tests
Follow-up from https://dart-review.googlesource.com/c/sdk/+/378566

Change-Id: I0208e875bef02291fc3b5bf91472093633a271fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378782
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-02 21:26:35 +00:00
pq 2ffa9d1433 [wildcards] ensure overridden signatures preserve wildcards
See: https://github.com/dart-lang/sdk/issues/56361

Change-Id: I0d37f8b3e034d123410151d3a82acdee5bc8fe9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378566
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-02 19:28:58 +00:00
Brian Wilkerson 80b0bda3de Convert the analyzer package to use the new location for mock packages
Change-Id: I097059764e999683564992b475fece4ebfb5a47b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372380
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 17:53:45 +00:00
Konstantin Shcheglov 1f3d1b6c81 QuickFix. Issue 55773. Flatten FutureOr() when convert to async.
Bug: https://github.com/dart-lang/sdk/issues/55773
Change-Id: I09653a5bce4c590fc95cbfb25eb3fbde1ffeb7c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369502
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-03 23:10:09 +00:00
Konstantin Shcheglov 9f6db2b92d CQ. Stop using File.createSource() in analyzer_plugin/.
This mixes layers, which I believe one of the ways that cause large
library cycles.

Change-Id: Ic21292f2d831229a3ba444abf3131c66ec9968d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-05-31 16:14:31 +00:00
Sam Rawlins 79faded296 analyzer: Touch up docs and impl of CorrectionUtils and EditBuilders
In this CL, I do not change the signature of any EditBuilder code, as
it is public analyzer_plugin API. I only change doc comments and a few
impl nits here and there, to make more modern or idiomatic.

This CL is isolated this way so that when I do a copy to the
analysis_server_plugin package, the moves will be smaller, readable
diffs (almost zero diff, just imports and things like that).

Change-Id: Ibc8a5ddb9a679278dd7223a3e2d868fe21c4acef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363881
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-22 21:44:49 +00:00
Konstantin Shcheglov 5543d88289 AE. Deprecate OnClause, use MixinOnClause instead.
Change-Id: I938a1ff4046851c46c6ae4cebdff25e05e88300f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-02 23:02:22 +00:00
Konstantin Shcheglov c5f876b7aa Augment. Use ExtensionOnClause in ExtensionDeclaration, make it optional.
Change-Id: I696ffd0b8e8f3bf9017b583d480313ec7c7753f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-02 16:12:00 +00:00
Konstantin Shcheglov 9efa956749 Legacy. Remove star types from analysis_server/ and analyzer_plugin/.
Change-Id: I174752bc6641bde70aaf44621dfddd43ad6c3070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-08 19:54:51 +00:00
Danny Tuppeny 28e926f0fb [analyzer]/[analyzer_plugin] Support change descriptions on SourceEdit
Previously, we only had descriptions of changes on a SourceChange. In order to support annotated edits over LSP for "Fix All in Workspace" we need to be able to track descriptions on each change within a file so that if we're fixing multiple different lints with a single SourceFileEdit they can be annotated/grouped in the UI.

In order to avoid every fix providing a description, ChangeBuilder has a field that allows recording the current change description and all builders created from it will use that description when creating their changes. This allows the BulkFixProcessor to set the description on behalf of each fix producer ensuring they all get descriptions (which is done in a follow-up CL along with Fix All in Workspace functionality).

Change-Id: Ie1c508056898bd4000a5505cf59a1e6d35d28da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-08 18:54:05 +00:00
Danny Tuppeny c6f9141dd2 [analysis_server]/[analyzer_plugin] Use specific Dart/YAML edit builders
+ add asserts to prevent using generic builders for Dart + YAML files.

When edits are mixed from multiple sources (such as multiple fixes via "dart fix") they must use the same kind of builders. The only way to ensure this is to force the specific kinds to be used.

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

Change-Id: Ia41b9cadd2b79ed9eabdc4f976c8071021d2e060
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355441
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-04 22:39:13 +00:00
Konstantin Shcheglov 14a1045f16 Legacy. Deprecate 'withNullability' in getDisplayString() methods.
Change-Id: I688f230f4189cd1fc600e4d34f07f339111c382d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350645
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-07 01:25:38 +00:00
Konstantin Shcheglov fe0e0775c2 Legacy. Deprecate LibraryElement.isNonNullableByDefault
Change-Id: I1b15c59960aa7eb4d27c221febc857a974bae738
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-06 01:19:09 +00:00
Danny Tuppeny 8d936d38fc [analysis_server]/[analyzer_plugin] Make all toJson/fromJson methods go through a central converstion for Path<->URI Strings
This change shouldn't change any current behaviour, but means all "FilePath" types in the legacy protocol spec will go through a (currently no-op) conversion. The server will be able to replace this conversion based on client capabilities in a future CL.

Because a lot of the generated classes are in analyzer_plugin, this also moves the ClientUriConverter class there.

`pkg\analysis_server\test\src\utilities\json_test.dart` contains tests that the toJson/fromJson methods go through the converter recursively (inc. map keys/values/etc.).

Change-Id: If5aec884070128eea594540fd25a9017ada86079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-01-30 16:58:25 +00:00
pq bc34c295ae final -> var for package:analyzer_plugin
Change-Id: I0e7cd26dcb0c7de1b4f7e19b66719d5a73670ce7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345824
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-01-12 22:37:40 +00:00
Greg Spencer e49f1ccbbe Fix the way that DartFileEditBuilder handles imports
It also handles imports a little better than it used to: it will replace an import that has the same URI and prefix with an updated one with appropriate show and hide combinators.

Bug: https://github.com/dart-lang/sdk/issues/54496
Change-Id: Ib53275f2d58c19085fe02cb83267c8dc0c23838b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344940
Commit-Queue: Greg Spencer <gspencer@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Greg Spencer <gspencer@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-01-12 19:30:12 +00:00
Sam Rawlins 5ddb91860b analyzer: Close the ReceiverPort in PluginIsolateChannel.close
Change-Id: I7442da58ba9e6810bacc6380999097a3d9674658
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-01-04 18:38:36 +00:00
Sam Rawlins 28ca02d3a0 Remove WithoutNullSafety tests in DAS and analyzer_plugin tests
Change-Id: I3ea9e767ff49b16a8dcdec5540a6b2d68f414930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337844
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-11-27 21:40:11 +00:00
Sam Rawlins 73ab31b98a analyzer: Move the Source class to be public API.
Deprecate accessing LineInfo, Source, or SourceRange via the
old library (pkg/analyzer/lib/src/generated/source.dart).
Migrate all SDK code to the new library.

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

Change-Id: Ic7c98a5820415c92a457f9fa2756351b05520cd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-14 17:10:37 +00:00