558 Commits

Author SHA1 Message Date
Konstantin Shcheglov be4df1a869 API. Add Folder.getFile/Folder, deprecate getChildAssumingFile/Folder
This aligns names with ResourceProvider.getFile/Folder.

Change-Id: I30383ef1fa6f7cbe60b187338e25b8ca75806730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-06-11 07:46:21 -07:00
FMorschel d29da25302 [DAS] Fixes occurrences for declaring parameters
Fixes: https://github.com/dart-lang/sdk/issues/63124
Change-Id: Ie94f23da1c47d393124491c37a6098ac66c581b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/497103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: FMorschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-05-07 08:03:26 -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
Danny Tuppeny c3cc1d53a3 [analysis_server] Add test for hover with factory()
This was recently updated for `new()` but didn't handle `factory()`.

Change-Id: I8a75dcbfa7d5454e0758f0ff8f2ca1bb7bd5ddfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-03-02 08:44:08 -08:00
Brian Wilkerson 6225aade99 Add tests for hover and primary constructors
The previous set of tests missed two cases:
- a primary constructor with a private named parameter
- constructors introduced by `new`

The latter had some bugs, which are fixed in this CL.

Change-Id: I872a3948dd1b0f791dbea1354c8377e83048e618
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484227
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-27 21:18:20 -08:00
Danny Tuppeny 8d983debe0 [analysis_server] Update call hierarchy for factory keyword
+ fix some typos

Change-Id: Ic4f05cc57130657445f3c2f5312998d018f56a8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-25 08:59:41 -08:00
Danny Tuppeny 0b2961da1f [analysis_server] Update Go-to-Definition for factory keyword
Change-Id: I76b23e549d20a0716df6b43b091976e54774f922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483541
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-25 07:53:36 -08:00
Danny Tuppeny 2a375317f4 [analysis_server] Deprecate HighlightRegionType.BUILT_IN and always use KEYWORD
Change-Id: I86ff7edc2b4de5910b19f6bdb0d4422b7546897a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482820
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-23 07:44:32 -08:00
Danny Tuppeny f06562cbda [analysis_server] Tweak handling of factory keyword without type names in constructors
Change-Id: I4d162ef66300caa07fd64f7de338c6ed1df04fc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-19 13:13:10 -08:00
Danny Tuppeny c9ded6a356 [analysis_server] Support constructor "new" keyword in semantic tokens / highlights
Change-Id: Idceb8a2e34262336d90b968a16222b0584dd3f76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481961
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-19 11:33:53 -08:00
Danny Tuppeny 940b1bdbe7 [analysis_server] Expand LSP document highlights tests to cover everything occurrences tests does
My intention is to decouple LSP's Document Highlights from the legacy Occurrences implementation. Some recent changes (and one potential upcoming change) were complicated by the differences in the protocol so a separate implementation would be easier.

Along with that, IntelliJ doesn't use occurrences from the server, so it will be easier to deprecate and remove the legacy implementation if LSP is not reliant on it.

As a first step, this adds versions of all tests from `test\analysis\notification_occurrences_test.dart` that didn't already have equivalents in the LSP tests to ensure LSP still has full coverage if the implementations become separate.

Change-Id: I6b45358c812bdad8ca9611d22a27fb31027443a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478369
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2026-02-10 12:18:39 -08:00
Robert Nystrom 89273802d9 More analysis_server tests for private named parameters:
- Hovers
- Occurrences (both legacy and LSP document highlights)
- "Go to Type Definition"
- Outlines

They are mostly working OK. There are a couple of corners that aren't
exactly what I'd expect but probably aren't worth fixing. I added TODO
comments on the relevant tests to explain.

I'm still going through the rest of the checklist but I figured I'd send
out one batch.

Bug: https://github.com/dart-lang/sdk/issues/61644
Change-Id: I9d0fe7052e8b8c726b90d9ed7795be9be23c125e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478483
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-02-05 13:11:32 -08:00
Danny Tuppeny f26dd29dea [analysis_server] Add tests for occurrences/documentHighlights for primary constructors
Fixes https://github.com/dart-lang/sdk/issues/62582

Change-Id: I7206fc7540cd02e45bf80ca6d2cd6ebd6eb2a772
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478600
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-02-05 10:53:47 -08:00
Danny Tuppeny e1928bc20f [analysis_server] Support primary constructors in Go to Super
Change-Id: I4038b5ef499215a45633da2ab96760b8b05feb8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-02-02 12:48:16 -08:00
Keerti Parthasarathy 930e5fdaa7 Add hover support for primary constructors
Change-Id: I3ec1f577dc8d469d8c4c415927f0ff5ee4c5f5f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-01-28 14:52:20 -08:00
Danny Tuppeny 1864ef2053 [analysis_server] Add "extends" to syntax highlight primary constructor tests
This was left out of the tests originally due to a crash at https://github.com/dart-lang/sdk/issues/62396 which is now fixed.

Change-Id: Ie1d95dba9a24a04decad269c41f6b4247191875c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473320
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2026-01-23 10:15:17 -08:00
Danny Tuppeny eb174b33a7 [analysis_server] Support primary constructors in navigation
Change-Id: I2182d58e792eae85c60ff145196c90affcb32085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-01-22 09:00:39 -08:00
Danny Tuppeny 6eb9a1fc1e [analysis_server] Update syntax highlighting + semantic tokens for primary constructors
Change-Id: Ia47a868cf82dac8be197db9aa272d159790d6641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472563
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2026-01-15 09:42:19 -08:00
Konstantin Shcheglov a135929050 DeCo. Stop using isSynthetic in analysis_server/, analyzer_plugin/, linter/.
Change-Id: I0764ad0bde41d97a98d9eb5b088b50b4eb69155f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465982
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-12-03 14:42:54 -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
Konstantin Shcheglov 0349520b98 DeCo. Migrate everything to new AST.
No more flag, always parse into the new AST, always visit new AST nodes,
always return them as child entities, parent-child structure reflects
the new AST.

So, use `namePart` and `body` where possible. Deprecate previous
properties.

This is still de jure a breaking change, because `parent` of deprecated
properties changes. De facto this required very few changes in google3.

Once this CL lands, I will publish `analyzer 10.0.0`, migrate everything
to new properties, delete deprecated properties, and publish `analyzer
11.0.0`.

Maybe deprecate `NamedCompilationUnitMember.name` and migrate to
subclass specific `name` or `namePart` properties before publishing
`analyzer 10.0.0`. This part is not breaking per se.

* Deprecations in `ClassDeclaration`:
  * Properties `leftBracket`, `members`, `rightBracket` are deprecated, use `body` instead.
  * Properties `name`, `typeParameters` are deprecated, use `namePart` instead.
* Deprecations in `EnumDeclaration`:
  * Properties `leftBracket`, `constants`, `members`, `rightBracket` are deprecated, use `body` instead.
  * Properties `name`, `typeParameters` are deprecated, use `namePart` instead.
* Deprecations in `ExtensionDeclaration`:
  * Properties `leftBracket`, `members`, `rightBracket` are deprecated, use `body` instead.
* Deprecations in `ExtensionTypeDeclaration`:
  * Properties `leftBracket`, `constants`, `members`, `rightBracket` are deprecated, use `body` instead.
  * Properties `constKeyword`, `name`, `representation`, `typeParameters` are deprecated,
    use `primaryConstructor` instead.
* **Breaking Change:** While the deprecated members mentioned  above still exist in the AST,
  their parent nodes have changed. This means that code  relying on specific parent-child
  relationships for these nodes might break.

Bug: https://github.com/dart-lang/sdk/issues/61701
Change-Id: Ic48104da8b029c9b454bbd2336574b7823025565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461841
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-11-17 08:57:36 -08:00
Sam Rawlins 68d44b88c1 DAS: Make many protocol constants lowerCamelCase
Change-Id: Ibe3ae38d2afe00a125ed43034625924d4e989755
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461241
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-12 09:14:29 -08:00
Sam Rawlins be3237e3ec analyzer_testing: deprecate MockPackagesMixin.addPedantic
Change-Id: I377e054a9abb167f7208f27067c905ff5947897c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-11-07 14:38:12 -08:00
Konstantin Shcheglov 27b7410505 Issue 61914. Fixes for FunctionReferenceImpl and PrefixedIdentifierImpl function, when prefix is not in scope.
Bug: https://github.com/dart-lang/sdk/issues/61914
Change-Id: I331cdb812e5bfe890e2f9d05c87cb4e9582d08b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460205
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-11-07 08:35:29 -08:00
FMorschel c54692d00f [DAS] Fixes import prefix occurrences on constructor invocation
Fixes: https://github.com/dart-lang/sdk/issues/61803
Change-Id: I313064a26e48f05c6c1408c24911dc77f8b9fad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457220
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-10-24 09:52:41 -07:00
Konstantin Shcheglov ad73b67f0d CQ. Fix NPE in DartUnitOccurrencesComputerVisitor when unresolved import prefix.
Saw a crash in logs:

  Null check operator used on a null value

  package:analysis_server/src/domains/analysis/occurrences_dart.dart 253:32  DartUnitOccurrencesComputerVisitor.visitImportPrefixReference
  package:analyzer/src/dart/ast/ast.dart 13353:15                            ImportPrefixReferenceImpl.accept
  package:analyzer/src/dart/ast/ast.dart 16897:19                            NamedTypeImpl.visitChildren
  package:analyzer/dart/ast/visitor.g.dart 474:10                            GeneralizingAstVisitor.visitNode
  package:analyzer/dart/ast/visitor.g.dart 687:50                            GeneralizingAstVisitor.visitTypeAnnotation
  package:analyzer/dart/ast/visitor.g.dart 456:40                            GeneralizingAstVisitor.visitNamedType
  package:analysis_server/src/domains/analysis/occurrences_dart.dart 282:11  DartUnitOccurrencesComputerVisitor.visitNamedType
Change-Id: I2b06026dad093187c74b4e1b6c7371aaf648a480
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456121
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-10-20 16:32:15 -07:00
Danny Tuppeny 0941ee70a0 [analysis_server] Add navigation regions for declarations of enums, extensions, typedefs, mixins
This allows Ctrl+Click on the declarations to fall back to Find References in VS Code, which is consistent with other declarations names.

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

Change-Id: Ic6b9de6597fa52dcb79e8f8ea946943e9101ca44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454081
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-10-10 10:38:49 -07:00
Danny Tuppeny d664846f86 [analysis_server] Change highlights tests to use line:col instead of offsets
This allows them to run with normalized line endings.

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

Change-Id: Ic569407a29a1b6f9c2add20c28c6070cff544bf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-10-08 14:09:59 -07:00
Konstantin Shcheglov b1aed87de1 Fine. Always produce errors for changed files.
Change-Id: Ia9ba02fe660d54a91c4d36a1ba5c2661e8395633
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453842
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-10-08 10:19:43 -07:00
Danny Tuppeny 6be105bb24 [analysis_server] Normalize test sources in base class
This adds code to normalize file contents in `PubPackageAnalysisServerTest.newFile()` so all tests using this base class normalize their source newlines by default (this ensures we run with \r\n on Windows, regardless of the git settings always using \n in this repo).

A flag `useLineEndingsForPlatform` allows option out of this, and any tests that currently fail in this mode set this in their setUp - with the exception of a few that were just trivial fixes.

This will make it easier to fix the remaining tests (by looking at code that does `useLineEndingsForPlatform = false`, deleting it, then fixing those tests).

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

Change-Id: If05bc5f7fe3007151c1290831157b6a62d6bf651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449880
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-09-16 19:37:19 -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
FMorschel c14b6eb81c [DAS] Adds lints for boolean literals to analysis server packages and fixes occurences
Bug: https://github.com/dart-lang/sdk/issues/59789
Change-Id: I3287ab55a1b3048c5cbf7f820563fbbd5a292512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445920
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-08-28 10:29:10 -07:00
Sam Rawlins cc28d8ca3d DAS: Remove AnalysisServer.supportsPlugins
I'm not sure of the history of this static final field, but it is not
commented, nor are there any hints of the value changing. It can just
be removed.

Change-Id: I310511fb63000a728f21a96c40b34f8d8798b366
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446281
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-08-21 13:28:59 -07:00
Sam Rawlins 1e7cb9dfed analyzer: Change the mock SDK Enum class to declare index and _name as concrete
This allows us to write enums in the mock SDK (which is currently broken). This will allow me to land such an enum in the SDK, in
https://dart-review.googlesource.com/c/sdk/+/445403.

This diverges from the actual Dart SDK implementation of the Enum class
and the _Enum class. I think this is an acceptable divergence; these
classes hardly ever change, and the changes will be easy to follow
when they come, however many months or years from now.

Change-Id: Ia6ff3803415af8c251dbee330a218f2618395cc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446141
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-08-20 11:35:13 -07:00
Konstantin Shcheglov fd33d9eae8 Elements. Use 'value' as the name of the formal parameter for a synthetic setter.
```
According to Gemini:
There is a very strong and widely followed recommendation.
The formal parameter for a setter in Dart should be named value.
```

So, it makes synthetic setters consistent with manually written setters.
These names sometimes are show in UI, e.g. in hover.

Change-Id: I4b53314aae63dce267906856d98a16ec22d38097
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441827
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-07-23 08:55:49 -07:00
Fedor Shcheglov c957029739 Add tests for most displayString() methods.
Significantly improve test coverage of `display_string_builder.dart`.

Fix an error involving a missing space when reading the enclosing
fragment of a local variable declaration.

Change the formatting of `ConstructorElement` to print only the type and
not the name to avoid duplication, as they were the same.

Change the formatting of `TypeAliasElement` to just print the name of
the aliased type, rather than the whole aliased element - as this rarely
provided useful information.

Change-Id: Ie1e4a3649063c2b3662ef7bd21327c17a5b1456b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441082
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-21 11:02:14 -07:00
Fedor Shcheglov 5e057f9895 Change display_string_test to reflect new element model.
Delete `getDisplayString()`

Remove most `displayString()` overrides from `ElementImpl's` subclasses.

Add more precise `appendTo()` for most `ElementImpl` subclasses.

Change-Id: Ic955721f0698d2472a6bf56e7955490e8ccf4eaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439544
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-14 12:49:29 -07:00
Konstantin Shcheglov c0bca2c210 Elements. Build all fragments first, then build elements.
Main changes:

1. Separating `FragmentBuilder` and `ElementBuilder`. I removed
`augmentation.dart` and its builders, because now it is implemented in
the new `ElementBuilder`.

2. Fragments are not given actual `Reference` objects anymore, there
might be some in the current state, but I will go over this in the
future and remove them completely.

3. Writing and reading elements also happens in two stages: first
fragments, then elements. Each fragment in the summary is given unique
ID, and during writing / reading elements we use these ID to locate
fragments and create elements around them.

4. Lazy loading of `ClassElement` members is simplified and generalized,
could be potentially applied to any `InstanceElement`. Maybe use also in
mixins, which are used somewhat often in Flutter.

5. There are slight changes to tests, mostly to the better, sometime a
bit reordering, a couple of new tests.

There is some dirty code added, especially around patching types for
getters, setters, and their fragments. I plan to clean this in future
CLs as I move toward better implementation, and from using fragments
where this is wrong.

Change-Id: I1e4bf2a3b7ff45f1dba133797e85cd70aa729c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-06-18 11:16:28 -07:00
Danny Tuppeny b0d4ab8ef9 [analysis_server] Move test/integration to integration_test
This was mostly a rename/move of the folder (and the analysis server updated all references), but I also had to:

- add `integration_test/analysis_options.yaml` to import from `../test` to get the same lint ignores
- update paths of exclusions in `verify_sorted_test.dart`

By moving all of the tests that start the server out-of-process out of test, we can:

1. Use "dart test" to just run the faster tests ("dart test test") and get functionality of the pkg:test runner (for example running tests concurrently and JSON output)
2. Allow VS Code to spawn different debug sessions for the "test" and "integration_test" folder, which means we can use a `preLaunchTask` to trigger compilation of the analysis server from source whenever running integration tests (avoiding having to compile manually, or run from source in a way that compiles a new server for each test suite)

Change-Id: I37cc03dc32d08c5b51a2eab79f6338bb079b32ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434801
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-17 12:54:41 -07:00
Kallen Tu beca727904 [analysis_server] Dot shorthands: Syntactic and semantic highlighting.
Added additional logic for handling highlighting for dot shorthands.

New semantic tokens and highlights tests passing.

Bug: https://github.com/dart-lang/sdk/issues/59836
Change-Id: I2e242732aade9471675731473532d6d3c6558281
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433102
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-11 12:16:41 -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
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
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
Sam Rawlins 3021cc4913 analyzer: Move PackageConfigFileBuilder to public API.
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: I3df2cd374f6b3ef9e027f0e07c748be6ea21ebb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427586
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 10:57:55 -07:00
Danny Tuppeny 57c414868e [analyzer] Fix exception searching synthetic parameters
This fixes https://github.com/dart-lang/sdk/issues/60005 caused by `source!` by instead handling the null. However, it leaves navigation still not-working for these synthetic parameters (see failing tests).

Change-Id: I793130a9533ccf97b523a50d74375ebf6dead7e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-06 09:43:01 -07:00
FMorschel 5d27e4f5bf [DAS] Fixes occurrences for extension and type parameters
Fixes: https://github.com/dart-lang/sdk/issues/60449
Change-Id: Ie862deea3d3d37890f1f610c7c83509fe82b2a40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419423
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-04-02 11:28:40 -07:00
Brian Wilkerson d6eca31417 [cq] Support use of TestCode in more tests and clean up refactoring_test
Change-Id: I2b939042654fcc8a1b97edf5644769669ffa45e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-03-27 13:30:31 -07:00
FMorschel 8bf801f8f7 [DAS] Fixes pattern variable with multiple declarations highlight
Bug: https://github.com/dart-lang/sdk/issues/60398
Change-Id: Ifd7c29db38bb2ee048d2b7d0de1e050e1e3e9bc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417964
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-27 11:09:09 -07:00
Konstantin Shcheglov 1a9a35f67c Elements. Start removing AugmentableElement.
Change-Id: I6bbbe2336b6abaca88b9bea3defd74ed790dbaa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414661
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-03-10 15:32:42 -07:00