Commit Graph

6878 Commits

Author SHA1 Message Date
Brian Wilkerson edce10b761 Add an assist to convert from a field formal parameter to a normal parameter
Fixes https://github.com/dart-lang/sdk/issues/60852

Change-Id: Iffc674e61b4df16e80ca71cfd18e12c548770b54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433220
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 12:33:34 -07:00
FMorschel 9d6c5d40d0 [DAS] Fixes "Go to declaration" for undefined new constructor
Fixes: https://github.com/dart-lang/sdk/issues/60773
Change-Id: I7ee7cec371fbf0d0f9de1a4fe2b946929ba80d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-06-05 12:08:44 -07:00
Danny Tuppeny 9df000075a [analysis_server] Exclude blocks/switch cases from Inline Values unless execution is within them
This prevents inline values showing up alongside code that didn't execute in conditional blocks. It does also mean they don't know up in conditional blocks that _did_ execute one execution has fallen out of them, but I believe this is the best we can do with the current LSP APIs (unless we try to track execution across requests, but that would probably be complete and not entirely reliable).

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

Change-Id: Ia1cf2437b76844ff0a6aeeb958d769c9523dc5dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433200
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 10:53:12 -07:00
Danny Tuppeny b8daa53fef [analysis_server] Don't rebuild contexts on deletion of an analysis root
This is a partial revert of ca9523058e (it removes the behaviour change and the test that verifies this, but leaves two additional tests that were added relating to roots that are created later).

If we rebuild contexts when a root is deleted, we may get stuck in a loop because we will again try to recreate the same (deleted) root, and then the watcher will close in a way that looks like a deleted folder, and we will repeat.

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

Change-Id: I10289160b341d273e8e409184a1c013c7fb9439d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 09:24:41 -07:00
Sam Rawlins b2beba242d analyzer: Convert callers of InheritanceManager3 to use InterfaceElement API
This includes all callers in analysis_server and analyzer_plugin. And
callers of `getOverridden4`.

Change-Id: Ia744f6c7260b445c6b1e02d3cf5515aaa9c7feeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432962
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 16:30:22 -07:00
Danny Tuppeny 8d36178a43 [analysis_server] Move support for locking requests to the scheduler
This removes the original `lockRequestsWhile` functionality of the LSP server which worked by pausing reading from stdin to instead pause the processing of messages in the scheduler.

Change-Id: I737e977adee11fe6fc70f44185cfaa22c22805da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 15:06:12 -07:00
Danny Tuppeny b1751e6871 [analysis_server] Update some tests to not required useLineEndingsForPlatform=false
Change-Id: I5eafe194465e20942ebea6989a75679d1a9bb866
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432980
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 08:45:59 -07:00
Danny Tuppeny 0f161e3ebe [analysis_server] Allow documentation preferences to be different between completion/hovers
For https://github.com/Dart-Code/Dart-Code/issues/4729 we added a configuration setting to let you control how much documentation was included in responses. The motivation here was to reduce the completion payload sizes when running in remote workspaces (Dart-Code would adjust the default setting if not explicitly set by the user based on the workspace kind).

However in hindsight, forcing no docs on Hovers just because we didn't want them in Completion requests was a bad choice, because these are individual requests where the payload size is less important and seeing the docs is useful.

So this alters the setting to accept a `Map` to allow you to have different preferences for each request that returns docs. Dart-Code will be updated to adjust the defaults accordingly (after this lands) so that Hover/SignatureHelp can default to `"full"` even in remote workspaces.

Work towards https://github.com/Dart-Code/Dart-Code/issues/5499

Change-Id: Ib64f762a0559c7afc7653fad9749fc208beee8b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431280
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 07:51:45 -07:00
Danny Tuppeny ca9523058e [analysis_server] Rebuild context roots if an analysis root folder is deleted
Change-Id: I79ada9184686f6f413ed7d732feea22cf39865bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238640
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-03 09:27:10 -07:00
Konstantin Shcheglov a10ce29c08 Elements. Add reference to ConstructorElementImpl2, write it.
Change-Id: I40ff802e9c78b2d74c19769da8339a947d23d7f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432540
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-03 08:57:59 -07:00
Kallen Tu 5f9c5da238 [analysis_server] Dot shorthands: Find element references tests.
Tests for Find References (Element) for dot shorthands.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: I7eee219022b974a8ab8a804e60a30964493a0a8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432124
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-06-02 13:48:51 -07:00
Konstantin Shcheglov 73a85ec195 Elements. Deprecate FragmentImpl.name
Next I will remove it completely.
And instead require `name2` as the constructor formal parameter.

Change-Id: Ib4afac3266fe36a7299d60a8b6d87c99349dd64c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432125
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-02 10:23:24 -07:00
Konstantin Shcheglov 63aa736da2 Elements. Add reference to MethodElementImpl, write it.
Change-Id: Iedfa3cb01749e527012e24a72539d591a3a0afbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431940
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-30 14:42:03 -07:00
Brian Wilkerson 2b59598def Display message scheduler information on the diagnostic pages
This adds a new page to the diagnostic pages that displays the current
state of the message scheduler (or rather the messages passing through
the scheduler) as well as the most recent history.

The next steps after this are to
- include this information (and library cycle information) in the
  generated report
- add this (and cycle) information to the analytics we're gathering

I put the new page in its own file, and would like to move existing
pages to separate files as well. Doing so might trigger moving some
files around in the directory structure in order to better organize
the code.

Change-Id: Ic4f0e72ffbadc1e39702f1f8f13850f5bd5814a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431947
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-30 11:52:59 -07:00
Kallen Tu 74f74d7157 [analysis_server] Dot shorthands: Document highlights tests.
Tests for documenting highlighting for dot shorthands. Tested with enums, classes, and extension types.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: I9b13dd8594ff8113ec9dbe97089688d893d2853d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431983
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-30 11:21:11 -07:00
Konstantin Shcheglov e724547892 Elements. Deprecate Annotatable.metadata2, use 'metadata' instead.
Change-Id: Ic4a7d8f19cb1793031951aadeb340e5dadf4744c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430261
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-05-30 11:09:40 -07:00
Kallen Tu 8f9cab4440 [analysis_server] Dot shorthands: Go to type definition tests.
Tests for `Go to Type Definition` for dot shorthands. Passing.
Part of the analysis server work.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: I265891c21ed1e3f0a01d1e75aa51df0265054392
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432000
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-30 10:39:49 -07:00
FMorschel f18bd99230 [DAS] Fixes comment references for enum constants
Fixes: https://github.com/dart-lang/sdk/issues/60760
Change-Id: I1a6dc74f1265ac4195f772a3e0374856008cbc6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430000
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-30 10:04:32 -07:00
Kallen Tu 009a6194b3 [analysis_server] Dot shorthands: Call hierarchy changes and tests.
Added work and tests needed for the call hierarchy to handle dot shorthands.

The element locator needed to be updated for the call hierarchy to work, so I updated that too.

Unit tests passing.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: Id61e6071c5ff008300f7bd25f762a14f22e47595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431701
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-29 13:35:13 -07:00
Kallen Tu 560bb8e0aa [analysis_server] Dot shorthands: Go to definition tests.
Tests with dot shorthand invocations, constructor invocations and property accesses for the go to definition feature.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: If8f7d85d273299d7a5c6c7cddaffc59cd41eb2fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-05-28 14:05:09 -07:00
Sam Rawlins eba91c5045 analyzer: Move RuleState into the public API
Work towards https://github.com/dart-lang/sdk/issues/50986

Change-Id: I32e1d9b6dbb0a6ef91569ae65100365f775ec0f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430544
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-28 13:28:26 -07:00
Danny Tuppeny d2c0f0ae16 [analysis_server] Support folding try/catch/finally blocks
Fixes https://github.com/Dart-Code/Dart-Code/issues/5201

Change-Id: I1790d3aa624d80ad0233216ca650d497f31c632b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431281
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-27 10:45:12 -07:00
Sam Rawlins 2dc94ee84a analyzer: Rename DiagnosticCode.errorSeverity to DiagnosticCode.severity
Change-Id: I244a96a940f82902a20e817fd13fe32026607ce3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-22 17:25:01 -07:00
Kenzie Davisson 10dd59c039 Add a DTD method to get all registered services.
This CL contains breaking changes for package:dtd and prepares both package:dart_service_protocol_shared and package:dtd for publish.

This CL also fixes https://github.com/dart-lang/sdk/issues/60757 so that DTD-registered services are sent over the `Service` stream upon initial subscription like what is done for client-registered services.

Change-Id: I619af816e64af01864c7ed9b98743c6691bf7e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429161
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-05-22 13:52:54 -07:00
Sam Rawlins f2d416b866 analyzer: simplify PackageConfigFileBuilder.toContent
This API did not exist (was not public) in analyzer 7.4.x, so is safe
to change in 8.0.0.

Change-Id: Ib4a06008b1cdf1be4f33dcb9036ea87b6d258067
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430041
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-22 10:58:49 -07:00
FMorschel f2776dfab1 [DAS] Fixes no parenthesis when inlining variables in literal expression
Fixes: https://github.com/dart-lang/sdk/issues/60761
Change-Id: Ide0f446712e5cda235e82bf69030bdc24c1441fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430001
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-21 10:13:31 -07:00
Danny Tuppeny 0f48263ac2 [analysis_server] Improve the performance of applying LSP edits in tests
This slightly improves the performance of applying edits in LSP tests. The previous code would sort the edits in reverse and then sequentially replace each edit into a string. With a large number of edits, both the string replacement and the subsequent rebuilding of LineInfo after each change could be quite slow.

With this change, we instead work through the edits forwards, appending the original text + new text into a StringBuffer to be combined once at the end.

Since most tests don't make large numbers of edits this only shaved a few seconds off the whole server test run, however when running a small benchmark of 20000 edits that Brian sent me recently, the time taken comes down from 42s (which hit the default test timeout) to 17s (which is not fast, but is faster).

Change-Id: Ia91937f4912b35ee1fe29f31157db3ef0e4bd79e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-21 09:01:05 -07:00
Sam Rawlins fb03a18f63 DAS: switch ConfigurationFilesMixin to use package getters
Change-Id: I4931f2b7598ea96313fb00963e5e154101d51c24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429829
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-21 08:41:38 -07:00
Sam Rawlins 4ef189a513 linter: Rename State to RuleState, and sub-classes
Change-Id: Id74c1a34e0a3154e1720d323bf4002aceb092dd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-20 15:52:54 -07:00
Konstantin Shcheglov 5d175fa43c Elements. Deprecate InterfaceElement.constructors2, use constructors.
Change-Id: I78faea1fdbc55e46cdb7fc0b187d12561736cec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429822
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-20 15:11:42 -07:00
FMorschel 37edff79b1 [DAS] Adds new Remove async assist
Fixes: https://github.com/dart-lang/sdk/issues/59814
Fixes: https://github.com/dart-lang/sdk/issues/23962

Change-Id: I8121da0106f4f81b93bfcdc0908b0977210fa3c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425602
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-05-20 12:56:40 -07:00
Danny Tuppeny d6cc4c3901 [analysis_server] Don't return the Fix All code action for legacy server
Currently the commands for Fix All are only supported for a real LSP server, so we shouldn't return a Source CodeAction that would try to run the command when running in the legacy server.

Change-Id: I3256ef5e19c3a45e7fc3f3ec726a59da30d3a30c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429642
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-20 09:30:09 -07:00
Danny Tuppeny 2a694349ef [analysis_server] Fix filtering of code actions to exclude mismatched kinds instead of throwing
No current tests hit this, but if you call verifyCodeActionLiteralEdits without a "title", you could trigger a failed expectation here that you should not - the mismatched actions should just be filtered out.

Change-Id: I6962c9f99a7a3051afcf3f76ad90945cd1381e0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429621
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-20 09:26:49 -07:00
Sam Rawlins 823908a435 Simplify ConfigurationFilesMixin
Work towards https://github.com/dart-lang/sdk/issues/55660

This mixin has some members that can be made private, and some that
can be removed.

Removing a `macro` parameter also simplifies things.

Change-Id: Id3b5d33ff66dde0c763499ff183943d72901d395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429440
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-19 12:44:59 -07:00
Alexander Aprelev 1159405ad4 Revert "[DAS] Trigger incompatible lint for included rules"
This reverts commit 261f8199af 

Reason for revert: it breaks flutter customer testing on hh and on the roller.


Original change's description:
> [DAS] Trigger incompatible lint for included rules
>
> Fixes: https://github.com/dart-lang/sdk/issues/60125
> Change-Id: Icc0b8efda0e7e915d7315a1c2e70c1a7a5093057
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419982
> Auto-Submit: Felipe Morschel <git@fmorschel.dev>
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

Change-Id: I0db90864092760efde1cb02cc792c1de14eabf2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429381
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2025-05-19 10:08:35 -07:00
Danny Tuppeny ee0a316495 [analysis_server] Suppress snippet support for Command CodeActions
We support a non-standard mechanism (https://github.com/rust-lang/rust-analyzer/blob/b35559a2460e7f0b2b79a7029db0c5d4e0acdb44/docs/dev/lsp-extensions.md#snippet-textedit) for having snippets on edits for Code Actions. This is only specified for edits returned from `codeAction` requests (and only implemented in Dart-Code for the same), so we should not return snippets when applying edits via `workspace/applyEdit` (eg. when code actions are returned as commands).

This prevents snippet markup being inserted literally into the editor if codeActions are executed over DTD (eg. from property editor).

Change-Id: I7882bffb8038671459e7487dc2e944020395f128
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-19 09:32:06 -07:00
Brian Wilkerson 0dd4a95b3c Display correct line and column offsets for context messages
The line and column offsets for the context messages were being computed
based on line information for the file in which the diagnostic was being
reported, which can be different than the file pointed to by the context
message. This ensures that we use the right line info.

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

Change-Id: I6dbc95bde5aeb1abc70d90767dc59082982a5a96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-19 09:23:59 -07:00
FMorschel 652a419fdb [DAS] Fixes completion for collection ifs and fors
Fixes: https://github.com/dart-lang/sdk/issues/60604
Change-Id: I55a8426ae54a92fb26fd5a04e3dc11c267c26acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428940
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-19 09:19:49 -07:00
Sam Rawlins e35e665259 analyzer_testing: convert all modifyFile users to modifyFile2
This also involves tidying up blaze_watcher_test, in order to
easily get back a File object from a helper method.

Change-Id: If9dc812dc3a97a205dee600b89c3e8490e9efcba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429201
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-19 07:11:23 -07:00
Sam Rawlins 750ecda6b3 Remove two underused methods from ResourceProviderMixin
Change-Id: I41f288f216e7db5a744d10a38074e104321e49f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-17 10:39:12 -07:00
FMorschel 261f8199af [DAS] Trigger incompatible lint for included rules
Fixes: https://github.com/dart-lang/sdk/issues/60125
Change-Id: Icc0b8efda0e7e915d7315a1c2e70c1a7a5093057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419982
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-16 17:31:21 -07:00
FMorschel 46348af8ab [DAS] Fixes Removes unused local variable with awaited expressions
Fixes: https://github.com/dart-lang/sdk/issues/60663

Change-Id: I290f29c3a07e2f20cfd6e78e87b5543fa8131a9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426380
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-16 15:54:59 -07:00
FMorschel 3c6af25d4a [DAS] Fixes auto-complete import combinator update for enum constants
Fixes: https://github.com/dart-lang/sdk/issues/60565

Change-Id: I9bd4740b48569afe86c4a7f02412f5e50e654bfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423621
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-16 15:52:51 -07:00
Sam Rawlins dfaf1514ea linter: discarded_futures: do not report on await-in-synchronous function
When a synchronous function body has an `await` expression, we report
an error. We don't need to _also_ report a lint.

The noted error, `CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT`, already
is associated with the "add async" fix. Reporting a lint when an error
is also definitely reported is just double reporting.

Change-Id: If6d260a01cc654c87897480996d3f6f4b61373dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-16 15:34:20 -07:00
FMorschel 5b4dc61717 [DAS] Fixes coloring for record fields access in extension
Fixes: https://github.com/dart-lang/sdk/issues/60625

Change-Id: Idce84fbdc9b58b2e91c2e40a058bf466e8d5fb65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426342
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-16 14:57:15 -07:00
FMorschel 52dc876ebf [DAS] Fixes extension instance member occurrences
Fixes: https://github.com/dart-lang/sdk/issues/60626
Change-Id: Ia1050fe54f9c2ff208092b00ecccce678b7e616a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424688
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-16 13:58:19 -07:00
FMorschel ade4bf824a [DAS] Fixes record extension field completion
Bug: https://github.com/dart-lang/sdk/issues/60625
Change-Id: I23e4a5a85dc15059c9b1e658fb2fc3f868fa91a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-05-16 13:43:09 -07:00
Sam Rawlins b40b806bee DAS: enforce unnecessary_async lint rule
Change-Id: I05c6fbcc5ea7dea37bb7a01a3492e5cd842d11ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428923
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-16 13:37:53 -07:00
Konstantin Shcheglov 78bc6da66c Elements. Deprecate InstanceElement.xyz2, use 'xyz' instead.
Change-Id: Ie12b7596b70c77fd2f08520a423eeaf3b6978326
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-05-16 10:24:25 -07:00
Sam Rawlins bd700772ff analyzer: move testing utilities to analyzer_testing package
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: Iae062d95e5cf3b94b540496242b3627268ac2612
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428844
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-15 16:28:50 -07:00