Commit Graph

742 Commits

Author SHA1 Message Date
Danny Tuppeny a31be9beba [analysis_server] Provide DocumentLinks for packages in Pubspec.yaml
Having quick links to pub.dev in pubspec.yaml is a long-standing request, but all of the API options to implemented it seemed bad.

However I was recently made aware that DocumentLinks (which we use for the Flutter example links) support HTTP links and this turns out to be a perfect fit (credit to https://github.com/orestesgaolin for the idea).

Links are built based on the kind of package, so `git` and `hosted` packages will be built accordingly (I special-cased GitHub SSH links but don't know if this could be generalised for other Git-hosting services). We use PUB_HOSTED_URL as the default base for standard Pub packages.

Packages that don't have URLs (such as `path`, `sdk: x` or other unknown kinds) will not produce links.

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

Change-Id: I1c9e704f67736bbc451866a9e10f7928e2246c7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409660
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-02-20 09:36:01 -08:00
Konstantin Shcheglov 7964d55940 Elements. Migrate TopLevelDeclarations.
Change-Id: I9bdcf6ac8c26bfa2eb50de8efd8c2a3a3538403a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-14 14:46:37 -08:00
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
FMorschel 1372538855 [DAS] Fixes import prefix go to definition (multiple)
R=keertip@google.com

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

Change-Id: Ida0cb58cdb4267af31a87a29862a3f4f2e28907f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405201
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-03 09:18:52 -08:00
Danny Tuppeny 154b473cdb [analysis_server] Fix missing dartdoc references in Library comments
Fixes https://github.com/dart-lang/sdk/issues/59946

Change-Id: I3b8558f72b6cc932f2c87ee4f2e993c5584907a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 13:00:30 -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
Keerti Parthasarathy 70e77158e6 Elements. Migrate lib/src/utilities/completion/optype.dart
Change-Id: I46f1f2e6de31d2583b21c3f96699e85e0b4feab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403840
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-13 22:04:10 -08:00
Konstantin Shcheglov 8bbe6fbdfe Elements. Report analyzer_use_new_elements without any txt file, add file ignores.
Change-Id: I13125f93a6633563ed6853a622bd9fec045bfc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403923
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-10 15:20:59 -08:00
Konstantin Shcheglov 2de8b5efb0 Elements. Migrate lib/src/utilities/navigation/navigation_dart.dart
Change-Id: Ia3a98eaa939c5efcf62d8f2c3490e92ee731ab6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403905
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-09 14:07:07 -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 4356eacd87 Elements. Migrate lib/utilities/completion/suggestion_builder.dart and required.
Change-Id: I6331e3f620bdaaec2a618aa0f6651099bdc606c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403921
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-09 11:25:58 -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 31d8adf1f3 Elements. Migrate lib/src/utilities/change_builder/change_builder_core.dart
Change-Id: Id73d6b493ad2e07d21324dbb354fe6fed758ca09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403740
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-08 14:59:17 -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
Danny Tuppeny 3557eb4a26 [analyzer] Remove Element2.location
The completion code was no longer using this (we use `ElementLocation2` directly in the completion handler now), and the navigation check was just to ensure we didn't include MultiplyDefinedElements in navigation results.

Change-Id: I8412ec60d3d56386a7ced3d78c3a7428313df5d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-22 12:55:56 -08:00
Danny Tuppeny 922ad1b95e [analyzer/analysis_server] Migrate navigation to new element model
Change-Id: I5cb132de15e103c5fdba22e7033317ee2013f886
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399106
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
2024-12-19 04:55:11 -08:00
Konstantin Shcheglov 6494efb192 Elements. Use identical() to compare ElementImpl(s).
Change-Id: Idbe935bc6ae333d9940d8ea53ad44011eff237ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401384
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-18 14:25:00 -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
Konstantin Shcheglov 82c47897e9 Elements. Migrate DeclarationHelper.
Change-Id: I4558c53ba01d19ca3db8ae9903b3759bf3393b9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399022
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-12-06 05:10:58 +00:00
FMorschel 06caa3fa11 [DAS] Adds new import with show option
R= srawlins@google.com

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

Change-Id: I3acb03cc6d9a5f8bc1ebaf590a45ac5ee10388f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396564
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-12-02 18:54:59 +00:00
Brian Wilkerson cc99ae937a Migrate convert_getter_to_method and convert_method_to_getter
Change-Id: I550022d206f0043789551280b35a1768557cfe61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396625
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-11-21 23:11:16 +00:00
Sam Rawlins 046c968b14 DAS plugins: minor adjustments regarding the PluginIsolateChannel
It looks like PluginCommunicationChannel.listen cannot do anything
with `onError`, so don't pass anything as if it did.

See ReceivePort.listen docs as well: https://api.dart.dev/dev/latest/dart-isolate/ReceivePort/listen.html

Change-Id: Iaaf1169a1f05774f63bdcea4c91a82dfb9e47227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396526
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-20 19:36:02 +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
Konstantin Shcheglov 359aa743ff Elements. Add LibraryElement2.uri
We used it often enough, and the question "what is the URI of the library" makes sense.

Change-Id: I58baebd7b32154ae7a2f90770e4edcade8a49a63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-15 21:52:00 +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
Sam Rawlins 73443c8603 DAS: Generated protocol 'enums' can be real enums
File sizes are reduced:

```
analysis_server_client's protocol_common.dart    - 132k -> 102k (-23%)
analysis_server_client's protocol_generated.dart - 453k -> 433k (- 4%)
analysis_server's        protocol_generated.dart - 528k -> 509k (- 3%)
analyzer_plugin's        protocol_common.dart    - 139k -> 108k (-22%)
```

Change-Id: I8018f1d09e053c9d3df340ba31cdb07cbd29acf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-07 17:27:18 +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
Konstantin Shcheglov a868303290 Elements. Remove FragmentName, inline as name2 / nameOffset2.
Change-Id: If238cd71867501a39e243261228d137f925db1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-01 18:56:26 +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 15ab56922e Elements. Make more Element2.name nullable.
For example `MethodElement2.name`, for code:

```
class A {
  () {}
}
```

Change-Id: Id023d6641d2d3685bf8e2d381aab055365e687d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391207
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-22 17:16:29 +00:00
Konstantin Shcheglov d23029054e Elements. Remove Fragment.name/nameOffset, use name2 instead.
Change-Id: I36ab124af49c0bd8b85c8ede9c3918dbfdc518a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390812
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-18 23:14:46 +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
Konstantin Shcheglov d8e378e4e1 Elements. Migrate FlutterConvertToStatefulWidget.
Change-Id: Iaacb9e2ccc908c64528ae7e6ee48c7094076b7d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389264
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-10 01:35:30 +00:00
Konstantin Shcheglov bfaf99ad93 Parts. Stop using LibraryOrAugmentationElement in analyzer_plugin/.
Change-Id: Ie6cef4384699d8b5ca8b6877d6cfe7881d554d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388662
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-10-07 18:21:40 +00:00
Konstantin Shcheglov 13a052e0e7 Parts. Deprecate LibraryElement.libraryImports
Change-Id: I9e3455fda9943123cc0aa0d95617f532bcec670f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-04 18:41:14 +00:00
Konstantin Shcheglov 3c5bdb63cf Elements. Migrate CreateMethod.
Change-Id: I7e631dd63baf74060a94bd413f5ccdd527fd21f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387352
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-30 16:56:50 +00:00
Konstantin Shcheglov 87076710e4 Elements. Migrate ConvertClassToMixin.
Adds element2 helpers to `DartEditBuilder`.

Change-Id: I3bf7123cf15f9023f81c2b7ffcb9a7753b4ecdd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387100
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-26 19:15:50 +00:00
pq a6714ffdff a few new formatter migrations
See: https://github.com/dart-lang/sdk/issues/56685


Change-Id: Ifa7fbbc7aff7c5fd96b02cafe0da76b22a33b1e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386824
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-25 21:12:17 +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
Konstantin Shcheglov d90bb7321a Parts. Remove support for library augmentations.
Change-Id: I04f076ea6917bd4597b79c75db16207ccf387c9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383702
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-05 22:21:33 +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
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
Konstantin Shcheglov b2bf4d33fe CQ. Mark NamespaceCombinator sealed.
Change-Id: I6a31db055276863435fc4e5c2e8811046de2378b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379679
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-08-09 19:49:08 +00:00