Commit Graph

7749 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
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
Brian Wilkerson 0404c6cd08 Add some message scheduler data to the collected report
Change-Id: I086b741a90955a2753efbabdf1c3cb321de98ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432903
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-06-04 15:08:20 -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
Sam Rawlins 47f7c4fb87 analyzer: expose canBeConst and computeConstantValue as public API
Work towards https://github.com/dart-lang/sdk/issues/50986

These utilities are used by a handful of lint rules, and the analysis
server, which makes me think they could be offered as public API.

Change-Id: I12415c2b86ca6fb96b03def4a304da73c6fb4cae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430300
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-04 11:02:17 -07:00
Sam Rawlins 508c35b6f0 linter: unawaited_futures: narrow the reported range, matching discarded_futures
Change-Id: Id8a361a352e409df0a8c9cc9fa73a9f7b5e52c3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431365
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-04 09:26:31 -07:00
Keerti Parthasarathy 25b99786d1 [Completion] Fix for adding duplicate keywords like 'dynamic' when in a declaration.
Change-Id: If8e35edd5ee136b0d272f1ea43a705cf04540bbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432821
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 08:31:37 -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
pq d150bcb97c [das] legacy server support for analytics checking
Fixes: https://github.com/dart-lang/sdk/issues/60853

Change-Id: I3a14c209482b47dc8228c678793e23cf91295fd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432780
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-03 12:56:12 -07:00
Sam Rawlins 31f8f4b522 analyzer: Make various AnalysisRule classes and their dependencies public
This is a big CL; no code is really "changed." We basically move 3
components into the public API, which can all be reviewed concisely
in the `api.txt` file.

* The AnalysisRule classes: `AbstractAnalysisRule` (which is good to
  make public as a lot of the public API is specified and documented
  here), `AnalysisRule`, `MultiAnalysisRule`.
* The Pubspec classes, available for linting pubspec files:
  `PubspecDependency`, `PubspecDependencyList`, `PubspecEntry`,
  `PubspecEnvironment`, `PubspecGitRepo`, `PubspecHost`, `PubspecNode`,
  `PubspecNodeList`, `PubspecVisitor`.
* The `RuleVisitorRegistry` class. This class is needed by analysis
  rule authors, and is part of the public API of AnalysisRule.

Change-Id: Ib1803180de9469f4ff39cf1778f96787f5f74b14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432363
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-03 11:09:32 -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
Brian Wilkerson e12e916041 Fix a bug on the diagnostic pages
This was introduced when I changed the ids of some of the pages.

Change-Id: Ia0dc4a49fcabb02782a0e037779a29a55f5deb7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432560
Auto-Submit: 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>
2025-06-02 15:54:18 -07:00
Sam Rawlins a5520d07cb analyzer: Expand BlazeWorkspacePackage.isInTestDirectory to include 'testing'
This changed definition is required for google3, in order to support
using `WorkspacePackage.isInTestDirectory` over the `inTestDir`
extension getter.

Then remove linter's export of the `inTestDir` extension method, and
instead rely on WorkspacePackage in lint rules.

Change-Id: I81fc6a27ca8f19f71a8b915edb3968d5d43262ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431943
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-02 11:17:53 -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
Brian Wilkerson 5df7479633 Reorganize the status/diagnostic pages
I moved several classes out of `diagnostics.dart` into their own
libraries under `pages`. I also moved one of the singling files into
`pages`. Several other sibling pages were moved to `utilities`. In the
process I needed to make a couple of methods public rather than private.

There are no functional changes.

I was going to split out the rest of the classes from `diagnostics.dart`
and `pages.dart` but I haven't yet decided whether they should all go
into a single directory or whether they should be in two directories.
The classes in `pages.dart` appear to be classes appropriate for any
web site generating code while those in `diagnostics.dart` are specific
to this web site, but it isn't clear to me that the abstraction is
helpful given that we only have one web site to build.

Change-Id: Iff968bc3bfb654db24e896cb1ae0ced9bc6333fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-02 08:06:50 -07:00
Sam Rawlins 28fc6346eb analyzer: Move RuleContext and RuleContextUnit to public API
Change-Id: I9cca5ee27e623bfa5b878bb0277f5e12e84a745b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431982
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-30 15:42:10 -07:00
Brian Wilkerson 2c0fad24ff Normalize the diagnostic pages
This normalizes the names of the classes to match the label displayed to
the user (to make it easier to find the class that needs to be updated).

It also normalizes capitalization in titles and the formation of the
page ids.

This is a precursor to splitting the page classes out into separate files.

Change-Id: I571bfaf23057f2366274e4b853412c8756151f65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432121
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-30 15:23:01 -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
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
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
Sam Rawlins 41ac971d8a analyzer: rename Lint*Context classes
For the analyzer plugin APIs, these classes should not have the word
'Lint' in them, as they are used for all analysis rules, whether they
report lints or warnings.

* LinterContext                    -> RuleContext
* LinterContextWithParsedResults   -> RuleContextWithParsedResults
* LinterContextWithResolvedResults -> RuleContextWithResolvedResults
* LintRuleUnitContext              -> RuleUnitContext

I'm open to better names for these. Some of these suffer from a
chain-of-nouns name (a "RuleUnitContext" is a Context for a Unit for
a Rule). So we could go with "UnitContextForRule" and "ContextForRule"
or other ideas like that.

Only RuleContext and RuleUnitContext will be public API.

Change-Id: I5550736beaba7e39b36e7b5584ca6d023aa4d02b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431703
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-29 11:49:29 -07:00
Brian Wilkerson b5e12ecaff Replace use of NodeLocator2 in CorrectionProducer
This is the last use of NodeLocator2 outside of the analyzer package
itself that I'm aware of (at least in our code base).

Change-Id: I57ba74571d60e820c60e2ca3d8d17e9374597073
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431440
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-27 21:03:43 -07:00
Keerti Parthasarathy 797b076edb Check for visisbility only once when adding completions for element members.
Change-Id: Icc482b005407262afe746d066971bb071a5e4508
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-05-27 18:05:41 -07:00
Brian Wilkerson 785b38ed5b Convert remove-dead-code to use nodeCovering
Change-Id: Ie91e56708dce7a5cce352a06f239ca3b29a4eb12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431340
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-27 11:00:09 -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
Keerti Parthasarathy eb9cc6f5c9 Remove duplicate logic in KeywordHelper
Change-Id: I32e7643f785228b99961e50bc2380bdcdffca1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430881
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-23 13:32:00 -07:00
Sam Rawlins b0b74b2810 Rename some loose ends w.r.t. "errorSeverity"
Change-Id: Id68fcd8bbbe45a95a294fd557ee4556c2af5c4c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430548
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-23 10:36:28 -07:00
Brian Wilkerson 2545c3eb31 Remove three more uses of NodeLocator2
Change-Id: I3e8fba0516bb0988ca0794991e980157dacb7231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430860
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-23 10:22:17 -07:00
Brian Wilkerson 816b974c15 Report the number and sizes of library cycles
Reported in the report created by the diagnostic pages.

Change-Id: I44de39b8388101d8ef5c5d0ecd5d50c1a1f559cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430600
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-22 17:27:20 -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
Brian Wilkerson b55b2bb092 Refactor the performance reporting support
This CL contains no functional differences; it just reorganizes the code.

I expect to be adding data to the collected report, and I decided that
it would be better to break the massive method up before doing so in
order to improve overall readability.

I also wondered whether we might want to structure the data in a similar
way. For example, the top-level map could have entries corresponding to
each of these methods, each of which has a value that is a map
containing the data collected by that method. I don't know whether this
would make the output easier to read or whether the current form is
depended on anywhere, but it's something to consider for the future.

Change-Id: Id0ef3c2f64b00ea58069c496e7c485c7b3f163c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430560
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-22 14:06:00 -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
Sam Rawlins 87f5185577 analyzer: Rename NodeLintRegistry to RuleVisitorRegistry, provide alias
Work towards https://github.com/dart-lang/sdk/issues/50986

Change-Id: Id0053b4721ca0517e315d5118ae48839dfaa3027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429465
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-22 10:03:19 -07:00
Sam Rawlins e4810025ad Remove RuleState type hierarchy with an enum and condensed constructors
Change-Id: I07ee606b00467b8113f1722dba21b8c16cfe85b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-22 09:53:18 -07:00
Sam Rawlins 7a4c651eb3 analyzer: Rename 'errorCode' parameters in ErrorReporter
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I4a3d320585967a4d2e8cbed430d2a67aa3f905fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430040
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-21 16:12:59 -07:00
Sam Rawlins f16cd980ce DAS: Deprecate CorrectionProducer.inheritanceManager
Change-Id: Id1772d47617a98ffc15d700a9bd7de58a04d745e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430020
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-21 14:42:21 -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
Sam Rawlins 61c3582420 DAS: Migrate from InheritanceManager3 in corrections
Change-Id: I2adf06ba0a1b19c233bd54f5116e6f63c62b1fd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429720
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2025-05-21 07:15:30 -07:00
Sam Rawlins e68d688abd DAS: Migrate from InheritanceManager3 in completion code
Change-Id: I097889fb2baaf71e99d765bcc076f1091383fbb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429580
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-21 07:13:22 -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
Sam Rawlins 9c6c7c5a25 DAS: Migrate away from InheritanceManager3 in feature_computer.dart
Change-Id: Ibee348643560a4ee079d53dfb2f65880de3c8354
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429464
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-20 08:30:30 -07:00
Sam Rawlins 540efbbb5d analyzer: Extract some public API from WorkspacePackage
Fixes https://github.com/dart-lang/sdk/issues/60725

Change-Id: I63e79075d6538810ddc518e96b5bb7430e55496b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428564
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-19 16:24:19 -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