Commit Graph

1173 Commits

Author SHA1 Message Date
Brian Wilkerson 916afe3219 Suggest fields from declaring parameters in completions
This was preventing suggesting fields from declaring parameters
everywhere.

Closes https://github.com/dart-lang/sdk/issues/63537

Change-Id: I552f85275c6a1aebaa4a50af88d661bc7e3d6492
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511040
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-06-11 11:09:54 -07:00
Paul Berry afcfbbeba8 Migrate developer experience packages to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the packages owned by the developer experience
team to use the new constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) bumping the
packages' SDK constraints to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Since this change requires bumping SDK constaints to `3.13.0-0`, it
was only performed on packages that are *not* published on
pub. (Packages that *are* published on pub should remain on lower
language versions until at least after the stable version of 3.13 is
released, so that we don't block users on the stable channel from
receiving updates to those packages.)

Change-Id: Ibb4daebafd239da58251e838ea6a3f336a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505046
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
2026-05-27 14:52:58 -07:00
Brian Wilkerson 1e1ecd8b41 Fix code completion before keyword in constructor
This fixes an exeception when code completing before the `new` or
`factory` keyword in a constructor and the type name is not explicitly
used. The exception prevents any suggestions from being returned, so
it's fairly serious.

Change-Id: I2f5028812ee1945ac9635f55953fb800b19a48c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505620
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-22 10:25:06 -07:00
Konstantin Shcheglov e20704c3b0 CQ. Move PackageConfigFileBuilder to analyzer_testing.
Move PackageConfigFileBuilder into the analyzer_testing public API and
deprecate the copy exposed from package:analyzer. The builder is only
used by test infrastructure, so keeping it in analyzer_testing makes the
ownership clearer and avoids exposing test-only utilities from analyzer.

Update the builder API to accept a rootFolder instead of a rootPath.
This lets callers pass the resource-provider folder directly, so the
generated rootUri is derived from the same file-system abstraction that
created the test files. This avoids accidentally passing POSIX paths
where resource provider paths are required, such as on Windows.

Update existing test utilities and callers to import the new library and
pass Folder objects. Remove the production analysis server dependency on
the builder by emitting the temporary plugin package config JSON
directly.

Change-Id: I46b14710626e0d6d5884afcdc5a05b23077acfc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499081
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-29 13:18:35 -07:00
Konstantin Shcheglov 6cd3938741 Breaking changes for analyzer 13.0.0
https://github.com/dart-lang/sdk/issues/62799
https://github.com/dart-lang/sdk/issues/62944
https://github.com/dart-lang/sdk/issues/63002
https://github.com/dart-lang/sdk/issues/62970

Looks mostly green in google3: https://fusion2.corp.google.com/presubmit/901021300/OCL:901021300:BASE:901308428:1776439417713:37cd1695

Change-Id: I44754a48f66a0b58851d7c20fcfa61f7fb1b555a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488624
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-17 23:06:25 -07:00
Konstantin Shcheglov e7c6654312 Augment. Allow abstract top-level variables.
Permit `abstract` on top-level variable declarations when the
augmentations feature is enabled. Previously the parser always reported
`abstract` as extraneous at the top level, which rejected valid syntax
and dropped the modifier before later stages could see it.

Thread the abstract token through top-level field parsing, record it on
`TopLevelVariableDeclaration`, and pass it through the front-end
builders. Reorder the field callback arguments so `augment` precedes
`abstract`, matching the augmentation grammar for incomplete top-level
variables and keeping the parser, listener, and outline plumbing
consistent.

Change-Id: I680414a746b707d483e485702685c95f28a9c9ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/494564
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-14 16:12:24 -07:00
Danny Tuppeny 931a3ff671 [analysis_server] Fix type name for constructors from type aliases in completion
We were adding constructors to completion for type aliases, but not using the type alias in the completion, which mean a lot of duplicates against the target class (see https://github.com/Dart-Code/Dart-Code/issues/6003).

I don't know if this got lost in one of the completion refactors, as there didn't seem to be support in `ConstructorSuggestion` for this, so I've added an `alias` field to it to override the name.

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

Change-Id: I06c073b1a9cae012c5bdf0fb8a3aa22f8fed728c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/491880
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-04-02 13:27:09 -07:00
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00
FMorschel 72c417c133 [DAS] Fixes dot shorthand completions when feature is disabled
Fixes: https://github.com/dart-lang/sdk/issues/61983
Change-Id: Id5901b1094e2d9b18bc2ab3c279ddc94f6063eb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472020
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-04 10:51:41 -08:00
FMorschel 7b782cb298 [DAS] Fixes closure suggestions in returns
Fixes: https://github.com/dart-lang/sdk/issues/62791
Change-Id: Ie8cbdd28e52ca9d7199198b4f3396d31ec503baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-03-04 10:30:51 -08:00
Brian Wilkerson 2be889b59f Update completion to suggest new in class-like bodies
Primary constructors introduces the ability to use `new` in place of
a class name in a constructor. The previous changes to code completion
missed this, but this CL causes `new` to be suggested at the beginning
of a member.

Change-Id: I56ac6d3d8649e55de264f6e4f91b4c5db2e37c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483322
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-24 11:45:39 -08:00
FMorschel c1b38fd690 [DAS] Makes the defined parameters not show as suggestions on constructors
Fixes: https://github.com/dart-lang/sdk/issues/62326
Change-Id: Id5436cf281eb596bf673da717a21d8e0df96ddf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474680
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-01-21 12:33:59 -08:00
FMorschel 44cb72e0bb [DAS] Fixes some completions in argument lists for required keyword and related
Bug: https://github.com/dart-lang/sdk/issues/62326
Change-Id: If3174c62cc9ba0889c139fe773bc782f12275a7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474240
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2026-01-20 11:33:19 -08:00
FMorschel 0a421ad409 [DAS] Fixes dot-shorthand completions for private types
Fixes: https://github.com/dart-lang/sdk/issues/62416
Change-Id: Ie8a4080866e0b95cde4f2267604f115350230e29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473300
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-16 11:03:54 -08:00
FMorschel 44fbfa987f [DAS] Fixes dot-shorthand completion for ParenthesizedPattern
Fixes: https://github.com/dart-lang/sdk/issues/62408
Change-Id: Idcf437a7af46d6ee804becd968446005b18df7fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473060
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-15 09:51:33 -08:00
FMorschel b58ce6cba1 [DAS] Fixes completion between nullable cascade dots
Fixes: https://github.com/dart-lang/sdk/issues/62397
Change-Id: I3ce51142e5e81196107d295fc7123c93086ac7cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472920
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-01-14 08:51:12 -08:00
FMorschel fb419269bc [DAS] Fixes dot shorthand completion for if case and &&/|| operators
Fixes: https://github.com/dart-lang/sdk/issues/62381
Change-Id: If8e161d37caf9e8c561cb28e42ae2cbe4ac7fada
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471780
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-12 11:29:02 -08:00
Fedor Shcheglov 884817d52d Fix case and default not appearing as suggestions inside a switch statement that contains elements
Change-Id: Ib9a2f6ec583efee33566e17cc54ce1484cf87dbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/470080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-12-30 13:01:50 -08:00
Konstantin Shcheglov 23a903e9ae DeCo. Build extension type primary constructors like regular ones.
Previously, the AST builder enforced strict constraints on extension
type primary constructors during parsing, often discarding or
transforming invalid parameters (e.g., multiple, optional, or named
parameters) to force a valid representation field structure. This
limited recovery and resulted in inaccurate element models for invalid
code.

This change updates the AST builder to parse and build elements for the
primary constructor's formal parameters exactly as written. The
validation logic ensuring a single, positional representation field has
been moved to `ErrorVerifier`.

To maintain the invariant that an extension type has a representation, a
synthetic "recovery" representation field is now added to the element
model if the parsed parameters do not provide a valid one.

Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: I37b7eaf2c085db6317b2c2b0bf35ff31423f9738
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465180
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-19 07:38:31 -08:00
FMorschel 850a760078 [DAS] Fixes dot-shorthand completion for annotations
Fixes: https://github.com/dart-lang/sdk/issues/62260
Change-Id: I3439237fd02c66600908190caeb07e1b0c4bfa7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-17 08:59:27 -08:00
FMorschel 275581bca1 [DAS] Fixes completion for switch expression pattern after when
Fixes: https://github.com/dart-lang/sdk/issues/62210
Change-Id: I42a3d6f3f93a8ecc8f4b866d89119a6cc49bd3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467160
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-12-16 09:07:37 -08:00
Brian Wilkerson 4dd879a477 Stop suggesting final in parameter lists
This stops completion from suggesting `final` outisde a primary
constructor's parameter list when the feature is enabled. When the
feature is not enabled, it won't be suggested anywhere. I did that
because in the same release this CL is for we'll produce a warning if
`final` is used, and it seems unhelpful to suggest adding code that will
have a diagnostic associated with it.

Change-Id: I2f8ad2d92ea0641e2212c89d01aa23921b39b3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468401
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-16 07:17:29 -08:00
Brian Wilkerson ba35276ae2 Add completion support for primary constructors
This adds completion support in the class header. Support for completion
in the body will be added in a separate CL.

Please look carefully at the tests to ensure that there aren't holes in
the coverage.

Change-Id: I189f25fbb90f43b4d8993622d5eb025d3160bef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467920
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-12-15 11:31:17 -08:00
FMorschel 420ac4d329 [DAS] Fixes completion for != for dot-shorthand
Fixes: https://github.com/dart-lang/sdk/issues/62216
Change-Id: I35e4884dd0d0db9a27b824ead4ea0232de8171dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467320
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-12-10 08:12:28 -08:00
Robert Nystrom 611a8b1d2c Test that code completion works with private named parameters.
Change-Id: I8d2cac86d686c0270d7da895c470fcc1b8b9b095
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466283
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2025-12-08 13:34:22 -08:00
FMorschel eaf3d32b7d [DAS] Fixes dot-shorthands completion for enum constant creation
Fixes: https://github.com/dart-lang/sdk/issues/62168
Change-Id: I435835016e5c213deab3f9979dd554d06cd40fa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466140
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-12-04 14:22:49 -08:00
FMorschel 5b10311309 [DAS] Fixes completion for core function and suggestions of true/false
Fixes: https://github.com/dart-lang/sdk/issues/40703
Change-Id: Ib4fe7e11c95c3d5c199241aded12a041631a6d88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-12-04 11:27:49 -08:00
Danny Tuppeny 0cdf92fdd7 [analysis_server] In super constructor invocations don't suggest names of super parameters
Fixes https://github.com/dart-lang/sdk/issues/61930

Change-Id: I3c3616cd40e706dd1dfba8db54e39d168ea5fc38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/463620
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-11-21 08:24:13 -08:00
Sam Rawlins 6910a34b0a DAS: Correct calculations of whether an element is deprecated
I missed examining these use cases when I introduced the other
Deprecated constructors. But this leads to some UI bugs (like hover and
suggestions showing strikethrough) and relevance bugs in DAS.

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

Change-Id: Ief71c4d70d57f989aaf5c2d7159f418d706d6a03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462742
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-18 13:22:11 -08:00
FMorschel e4cec87683 [DAS] Fixes argument completion for dot shorthands invocations
Bug: https://github.com/dart-lang/sdk/issues/61969
Change-Id: Ie109e6bdf657ccbc02510da912087d2babf3806e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462081
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-11-14 07:42:38 -08:00
FMorschel e94ccebe8a [DAS] Fixes completion for pattern destructing
Fixes: https://github.com/dart-lang/sdk/issues/61920
Change-Id: I7a2baa3a075b6416ab34031c8bb13e99db726671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460142
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-11-06 15:36:20 -08:00
Kallen Tu 562e907e4c [analysis_server] Dot shorthands: Completion for ==
Add code completion for dot shorthands and the `==` and `!=` operators.
We use the LHS static type as the context type for the RHS dot
shorthand.

Bug: https://github.com/dart-lang/sdk/issues/61872, https://github.com/dart-lang/sdk/issues/59836
Change-Id: Icf44f1e0fdd030984228aa72e5087318278d73f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-10-31 14:22:40 -07:00
FMorschel 9e2d8a2780 [DAS] Fixes completion for dot-shorthand in FutureOr<T> and for switches
Bug: https://github.com/dart-lang/sdk/issues/61872
Change-Id: Ie3cfab513b409f7c12d5d920839a4d9076172580
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Kallen Tu <kallentu@google.com>
2025-10-31 12:11:25 -07:00
FMorschel 5825a34da3 [DAS] Fixes regression in completion for unnamed parameters in closures
Fixes: https://github.com/dart-lang/sdk/issues/61518
Change-Id: Ia190a35188d2e9cf67fd7a6e75580cbcf2f9c6a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-10-28 13:57:39 -07:00
FMorschel 4fa9e872f8 [DAS] Fixes completion of private members from different libraries
Fixes: https://github.com/dart-lang/sdk/issues/61799
Change-Id: I51743a44e73eaaf77ddd04df1838045b47844c4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457100
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-10-24 09:00:00 -07:00
Sam Rawlins a15ffc35e8 Remove mock library async2
I believe this was necessary when dart:core started exporting Stream
and Future from dart:async.

That was back in Dart ~2.1 or so. We can remove this logic.

Change-Id: I9c1343bfa256e040bdc366bd2c7e825e84bcc655
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456803
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-10-23 14:25:57 -07:00
FMorschel b15fb0ee61 [DAS] Fixes FunctionType.call completion
Bug: https://github.com/dart-lang/sdk/issues/61319
Change-Id: Id757b79f46bacb071ccf60f08080c621229313e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451544
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-10-22 11:09:39 -07:00
FMorschel 99be510768 [DAS] Fixes completion for other static members when at the end of constructor name
Fixes: https://github.com/dart-lang/sdk/issues/61722
Change-Id: Ib45542198b09df7aa7e57f311c603b626fc0dbb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455160
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-10-16 09:58:17 -07:00
Danny Tuppeny 5a85b72f1b [analysis_server] Enable line ending normalization in completion tests
See https://github.com/dart-lang/sdk/issues/60234

Change-Id: I8d0bf709c05dfbc54f94e939599b75aebd0f09ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453520
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-10-10 07:42:56 -07:00
Danny Tuppeny a6f6bed49d [anaysis_server] Switch completion tests from element offsets to line numbers
The element offsets here are used only to differentiate elements (to check for correct shadowing) so exact positions are not necessary and line numbers will do. This removes offsets that would change if the tests are run with different line endings based on the current platform.

Only one test had two elements on the same line, so I've wrapped the code to keep the test valid.

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

Change-Id: I64fc4b28c34873429f554861e530630b3aedc26b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-10-09 16:43:21 -07:00
Danny Tuppeny 05f2c44a3d [analysis_server] Switch selections in tests to markup instead of hard-coded numbers
See https://github.com/dart-lang/sdk/issues/60234

Change-Id: I39c9382acecd16d50d4af098fe5f19d49e024ef6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-10-09 15:24:44 -07:00
Sam Rawlins dabcb98c6b DAS: Avoid overriding a field in AbstractWildcardTest
The `allowedIdentifiers` field in AbstractCompletionDriverTest is not
overridden in other tests' instead other tests call the setter.

To avoid a violation of `overridden_fields`, we do the same in this
test.

Also fix spelling of 'WildCard' to 'Wildcard'.

Change-Id: I7848597cd4b19c573a089f398526721637671e4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453106
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-10-08 14:30:01 -07:00
Konstantin Shcheglov 602bd276d8 Issue 61676. Fix sorting by relevance in SuggestionCollector.
Bug: https://github.com/dart-lang/sdk/issues/61676
Change-Id: I713a664f4399bee9baa52a1f69b02483acc9f344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-10-03 11:14:31 -07:00
Sam Rawlins 33f664940a Bump DAS to use Dart SDK 3.9.0
Change-Id: I04bc285d822a657adb5573c6de3eb38655ab0fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448232
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-09-03 12:56:29 -07:00
Kallen Tu 9342bac2d9 [parser/analysis_server] Dot shorthands: Code completion for 'const .'
Parser and analysis server changes for adding code completion for `const .^` where `^` is the cursor location.

I modified the parser to handle recovering when we were parsing a dot shorthand constructor invocation that was incomplete.

Added analyzer tests, code completion tests, and frontend parser tests.

Fixes: https://github.com/dart-lang/sdk/issues/59836
Change-Id: Ia200ebd9149658d7563c4942afd749c262c52dc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446987
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-09-02 08:37:48 -07:00
FMorschel 6c3da17346 [DAS] Fixes values suggestion without enum name
Fixes: https://github.com/dart-lang/sdk/issues/61161
Change-Id: I6938d0ce60aaf50e71e4f1df644217f0344a89d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444441
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-08-28 17:30:32 -07:00
FMorschel cc06466ef2 [DAS] Fixes completion not showing abstract class with alias declared above it
Fixes: https://github.com/dart-lang/sdk/issues/61244
Change-Id: I0c569653ee9040d8ff0d22135d9be09e7ba4d58d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444701
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-08-26 13:17:42 -07:00
Kallen Tu c5eba84538 [analysis_server] Dot shorthands: Code completion for methods and constructors.
Update code completion to handle completing static methods and (non-const) constructors.

Additionally, I noticed that we weren't suggesting any completion for extension types? I added the case for it and a few tests.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: Ib677cd99e51b8a641aa1bfbad5ffc8a8cbdc38c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-08-05 15:36:57 -07:00
FMorschel 4480ea63a6 [DAS] Fixes void completion on for in iterable position
Bug: https://github.com/dart-lang/sdk/issues/61134
Change-Id: I5ce02226f705e5bce5148494d81435c9eb96aad4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443631
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-08-05 11:42:04 -07:00
Danny Tuppeny db2fad7eca [analysis_server] Update setState + closure completions to use the correct line endings
+ update completion tests to always use normalized code

Change-Id: If6e2f838f23c8cdbb0590a7e408d51897d8b4a46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-04 16:16:01 -07:00