Commit Graph

6410 Commits

Author SHA1 Message Date
FMorschel dbf87d8644 Improving string conversion
Closes https://github.com/dart-lang/sdk/pull/56723

GitOrigin-RevId: 802fda7efeace66f33a82fa939a3efac11064390
Change-Id: I6d4d3931e62b89265eb1d324856bed5b9febfe8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-09-25 21:11:17 +00:00
FMorschel a0374dd70c Fix create method/function inside conditional operator
Closes https://github.com/dart-lang/sdk/pull/56722

GitOrigin-RevId: 9a861d4078b326754b8855e833c52ede03f0e28d
Change-Id: Ia7535ff48c16836b0e7d3a32005051c7defc3766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-09-25 20:51:54 +00:00
Danny Tuppeny c8adf3da3f [analysis_server] Update color handling for recent Flutter Color class changes
In https://github.com/flutter/engine/pull/54714 the "int value" that was used for storing the color values for a Flutter color was removed and replaced with `double red, double green` etc.

The color computer used the `value` field so this stopped it from computing any colors for previews in LSP clients. No tests broke because the tests here use a mock version of the Color class that still had `value`.

This change updates the mock Color class to match the new Flutter implementation, and updates the computer to use the red/green/blue doubles instead of parsing from an int.

It also adds support for the new `Color.from()` constructor that was also recently added.

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

Change-Id: I3ff20bda0cc848e028822cfcb5a14e6a8f6934d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386802
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-25 16:27:51 +00:00
Parker Lougheed 46cd8b627c [linter] Move old lint details out of source
- Makes way for slowly replacing them with new "why" docs.
- Slightly reduces snapshot size of analysis server
- Colocates docs in the new linter/messages.yaml file.

Change-Id: I8708b8b55455a183ccfa5c9d8c21098ae0655b51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385304
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-09-24 23:06:34 +00:00
Fedor Shcheglov 9f4bb0d654 Issue 56559. Remove @override from private field, add to getter/setter.
Bug: https://github.com/dart-lang/sdk/issues/56559
Change-Id: I57e9c5e286af520499ddddeee5818f1c22a94ee8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-09-23 18:13:45 +00:00
pq 2c73635d00 [wildcards] fix ConvertToWildcardVariable to convert variable references
Change-Id: Ie9b9d03adf11bf2e18d5a3da6e28be8abf4eb53d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384943
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-09-23 16:53:11 +00:00
FMorschel 26a035d692 Fix remove-unnecesary-parentheses quick-fix false negative
Closes https://github.com/dart-lang/sdk/pull/56746

GitOrigin-RevId: 3e296b4b88b91d671e4e061ae8613f9b09d7f2f5
Change-Id: Ib174df2b3d825129c22eab71f2c7f38d88a66781
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-23 15:04:44 +00:00
Lasse R.H. Nielsen f24162c8bc Let unintended_html_in_doc_comments ignore DartDoc links.
A link of `... [List<int>] ...` is now considered non-HTML,
and doesn't trigger the lint.
This is how DartDoc interprets the text.

Change-Id: I974e0ace31c3d7bf5f57b854c7b887a95684158d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384840
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-09-18 14:22:11 +00:00
FMorschel 00a1608bd8 Add fix for use_colored_box
Closes https://github.com/dart-lang/sdk/pull/56702

GitOrigin-RevId: 1e043e03da0b43f7f7ab3365f16fe557689a712c
Change-Id: I7fff9c1d0f7c479890625b16b3beed449d504436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384662
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-09-17 18:37:54 +00:00
Parker Lougheed 4819bd09aa [analyzer/linter] Deprecate LintRule.details to avoid new usages
Change-Id: I3d03d5f06901e0a548020522387e8984507a7f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-13 18:13:26 +00:00
pq 86306b194e fix test expectation doc typo
Change-Id: I57aeac20269a2527e81822a550d483ab34064c6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-09-12 22:18:46 +00:00
Sam Rawlins b1416116b7 analyzer: rename most API references to 'plugins' to 'legacy plugins'
Change-Id: I56217045ff9d4da8a5a556cd709e0f63a507884f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384964
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-12 21:25:56 +00:00
pq 9d1c3c9d42 [parts] enable experimentsForTests for all LSP server tests
Change-Id: I213292c4392a1c54f4ecfa059033d405d2d7b73a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384826
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-09-12 16:18:20 +00:00
Ben Konyi 9f5246e8c6 Revert "[ CLI ] Don't disable DDS when --disable-dart-dev is provided"
This reverts commit 81b9957bdd.

Reason for revert: Breaking multiple configurations.

Original change's description:
> [ CLI ] Don't disable DDS when --disable-dart-dev is provided
>
> Fixes https://github.com/dart-lang/sdk/issues/56605
> Fixes https://github.com/dart-lang/sdk/issues/54841
>
> TEST=N/A
>
> Change-Id: I6a13afe5f51fe67d2366c6d87ae74473651e24c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383780
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Auto-Submit: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>

Change-Id: I5c6cb302d8160f19bad437341cdcd80bcc08d921
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384881
Reviewed-by: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-09-12 01:15:27 +00:00
Ben Konyi 6f1887a1f2 [ DDS ] Fix tests broken by https://dart-review.googlesource.com/c/sdk/+/383780
TEST=N/A

Change-Id: I50e12596ebb7dc687e4c3d408104e450c3e91c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384900
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-11 21:08:58 +00:00
Danny Tuppeny 0ed690798d [analysis_server] Replace URI fields in tests with getters to avoid having to set all paths twice
This is a minor refactoring to swap some fields for URIs to getters so that any tests that modify them don't have to set both a path and URI (or risk them being out-of-sync).

Change-Id: Ic3776d250f4cfd9b0f16a7fc578ab5e7f19e52a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384762
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-11 20:14:23 +00:00
Danny Tuppeny e7442b7066 [analysis_server] Add a semantic token modifier to wildcards
Also fixes top-level variable declarations to be treated as variables and not properties (see https://github.com/dart-lang/sdk/issues/55956).

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

Change-Id: I899ce4fc5950369acae70517d76a2830fe082731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384746
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-11 18:59:55 +00:00
Ben Konyi 81b9957bdd [ CLI ] Don't disable DDS when --disable-dart-dev is provided
Fixes https://github.com/dart-lang/sdk/issues/56605
Fixes https://github.com/dart-lang/sdk/issues/54841

TEST=N/A

Change-Id: I6a13afe5f51fe67d2366c6d87ae74473651e24c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383780
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-11 18:01:25 +00:00
pq c386f13a83 [enhanced-parts] Code Folding tests
Fixes: https://github.com/dart-lang/sdk/issues/56696

Bug: https://github.com/dart-lang/sdk/issues/56696
Change-Id: I20011f1c60bab29d8ed6e78be70b6f807dce03f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-09-11 17:33:51 +00:00
Sam Rawlins 5ee4eb52e6 DAS plugins: Add plugin package generator
This generator will be used create shared plugin package entrypoints from
plugin configurations.

Work towards https://github.com/dart-lang/sdk/issues/53402

Change-Id: If5c6aeb7bc7845311975928fba1cb9c8d273423c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-09-11 16:54:29 +00:00
Paul Berry cda2815bb1 Add UNREACHABLE_SWITCH_DEFAULT warning to the analyzer.
This warning is similar to the existing `UNREACHABLE_SWITCH_CASE`
warning, except that it warns if the `default` clause of a switch
statement is unreachable due to all the `case` clasuses fully
exhausting the switched type.

To make the implementation easier, I changed the API for the
`reportExhaustiveness` method in `_fe_analyzer_shared` (which is the
primary entry point to the shared exhaustiveness checker). Previously,
this method returned a list of `ExhaustivenessError`, where each list
element was either an `UnreachableCaseError` (indicating that a
certain case was unreachable) or a `NonExhaustiveError` (indicating
that the entire switch statement was not exhaustive). If the caller
passed in `false` for `computeUnreachable`, `UnreachableCaseError`s
would not be returned, so the returned list would either be empty or
contain a single `NonExhaustiveError`.

The new API renames the types for clarity:

- `NonExhaustiveError` becomes `NonExhaustiveness`, to highlight the
  fact that it's not necessarily an error for the switch's cases to be
  non-exhaustive; it's only an error if the scrutinee's static type is
  an "always exhaustive" type and there is no `default` clause.

- `UnreachableCaseError` becomes `CaseUnreachability`, to highlight
  the fact that it's not an error for a case to be unreachable; it's a
  warning.

Also, the new API adds instances of `CaseUnreachability` to an
optional user-provided list instead of returning a newly created list;
this allows callers to communicate that they don't need to see
`CaseUnreachability` information by passing `null`. This frees up the
return type to simply be an instance of `NonExhaustiveness` (if the
cases are not exhaustive) or `null` (if they are exhaustive). This
makes it easier for the analyzer to decide whether to issue the new
warning, because it doesn't have to dig around the list looking for an
instance of `NonExhaustiveness`.

The new warning has an associated quick fix (remove the unreachable
`default` clause). This quick fix uses the same `RemoveDeadCode` logic
in the analysis server that the existing `UNREACHABLE_SWITCH_CASE`
warning uses.

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

Bug: https://github.com/dart-lang/sdk/issues/54575
Change-Id: I18b6b7c5249d77d28ead7488b4aae4ea65c4b664
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378960
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2024-09-10 19:13:12 +00:00
pq 1bdb366d4d [enhanced-parts] test “Organize Imports”
Fixes: https://github.com/dart-lang/sdk/issues/56683

Change-Id: I6b6aae385d4313e551f7c110e1e2544cc418a5a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384308
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2024-09-10 17:23:40 +00:00
pq ecbf9ee568 [enhanced-parts] test "Sort Members" in a part w/ imports
Fixes: https://github.com/dart-lang/sdk/issues/56684

Change-Id: I259090327e82926d1c01dae1ce11b328e3f2e7cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384309
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-10 16:57:11 +00:00
Danny Tuppeny ffeadc947a [analysis_server] Fix sorting of different kinds of imports in DartFileEditBuilder.importLibrary
Previously any pending imports added by DartFileEditBuilder would just be sorted by their text ignoring the kind of import. If there were existing imports for dart, package, relative then they might be inserted in the right places, but if there were not (or not the right kind) of existing imports, they would be just be added in alphabetical order (rather than dart, then package, then relative).

This change extracts some of the rules for sorting directives from analysis_server's ImportOrganizer into analyzer_plugin/src so that they can be reused by the DartFileEditBuilder that lives there.

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

Change-Id: I6dc5476add2b7b1804080ffdc8270d0bb80597db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384284
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-10 14:43:58 +00:00
Fedor Shcheglov 4a7f9c87e2 Issue 56682. Add break for empty cases when converting if chain into switch.
Bug: https://github.com/dart-lang/sdk/issues/56682
Change-Id: Iafc1154801ec207152104b9b064f2b587a13ac4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384306
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-09 22:49:51 +00:00
Fedor Shcheglov bbc642e6c1 Issue 56371. Quick assist from switch to if statements chain without unnecessary break statements.
Bug: https://github.com/dart-lang/sdk/issues/56371
Change-Id: I826f6f8fa1e9b5123ff8aa1d637d5da1ff63a09a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383931
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-09-09 15:58:39 +00:00
Danny Tuppeny 80057b98d2 [analysis_server] Take prefixes into account when determining the visibility of completions
A prefixed identifier like `a.Foo` should not hide a prefixed identifier like `b.Foo` not an unprefixed identifier (and vice-versa).

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

Change-Id: I8be8b3260f2a9f4333d38bba7ffe309cd3817932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-09 14:42:29 +00:00
Fedor Shcheglov 4aaca0b4c0 Issue 56413. Consider prefer_int_literals in 'Wrap with Padding'.
Bug: https://github.com/dart-lang/sdk/issues/56413
Change-Id: I0e4aa2a53a2387caa4ad451e7033767c1b180436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-06 20:24:48 +00:00
Danny Tuppeny 40b9153fab [analysis_server] Fix semantic tokens/highlights skipping annotations on super parameters
+ treat super parameters that reference field formals as field references, the same as field formals themselves.

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

Change-Id: I5ea841a32445a141a3cf46d8662154f2e9950ebe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383580
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-06 14:34:59 +00:00
Konstantin Shcheglov 4855fed15b Parts. Report UNNECESSARY_IMPORT using the new tracking.
Change-Id: Ide8f003bdfb1c80f1e342d3742b538edfda6ad8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-05 22:16:21 +00:00
Honza Bittner 18466983ac feat: make remove widget work for slivers
Closes https://github.com/dart-lang/sdk/pull/56638

GitOrigin-RevId: 835dd143a7b56a9249d4d48da5de4253c57bee21
Change-Id: If0fd507b51a224770cf724568925fa895bfa3e20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-05 22:13:30 +00:00
Keerti Parthasarathy caa36cfe83 Add a MessageScheduler queue that all incoming messages to the analysis server go through.
Change-Id: I3770b5a1a8faa391fb35a5a1e3d2678dbc4fb3f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383703
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-05 20:45:59 +00:00
Danny Tuppeny 803537682f [analysis_server] Provide LSP ClientCapabilities to LSP handlers reflecting the calling client instead of always the server
Prior to this change, all LSP handlers would ask the server for the client capabilities when they would affect their output. For callers over DTD, this could result in the same requests getting different results depending on the capabilities of the editor.

This change adds LspClientCapabilities to the MessageInfo that goes along with each message (usually a request) and then passes in the servers clientCapabilities for requests originating from the editor client, and a fixed set of capabilities for requests that come from DTD.

Most handlers will now use the callers capabilities, however there are a few handlers that build edits to send to the editor (instead of _returning_ the edits), which will use the editors capabilities.

This is essentially a no-op for now, because we're just providing the same capabilities via a different route - but when we come to supporting LSP handlers over DTD (that are affected by client capabilities), they will get consisted results based on our fixed set of capabilities (which as of yet is probably incomplete and may be updated a little as that progresses).

Change-Id: I5bcef8c3ebb7b94c83d85e56a303333d302abdee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-09-04 17:04:46 +00:00
Konstantin Shcheglov 67c21f7b67 Migrate from 'import augment' to 'part' in analysis_server/.
Change-Id: Iac57024ab48ed389b4578bc0fb2a2e620533812b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383420
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-09-03 19:45:55 +00:00
Konstantin Shcheglov 957699fba9 Revert "Parts. Track used imports while resolving library files. #v2"
This reverts commit b3cdad286f.

Reason for revert: https://github.com/flutter/flutter/issues/154413 - there is a test in Flutter that expects UNUSED_IMPORT that we don't report anymore.

Original change's description:
> Parts. Track used imports while resolving library files. #v2
>
> TGP looks green.
> https://fusion2.corp.google.com/presubmit/668751751/OCL:668751751:BASE:669923082:1725204615406:830df8a3/targets
>
> Previous: https://dart-review.googlesource.com/c/sdk/+/382680
> Revert: https://dart-review.googlesource.com/c/sdk/+/382903
> Change-Id: Idbca23a13cf5c7490aa8bc859e21609c6241951e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383022
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I2825dae66db0b7eaef1b86511ce1eb9b958d8b20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383380
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-03 16:40:20 +00:00
Konstantin Shcheglov 2aa54ab42c Parts. Fix unnecessary_import before landing the reporting CL.
https://dart-review.googlesource.com/c/sdk/+/382901 will start
reporting it in more cases.

Change-Id: I3ae1d407f37a317f33cb98977b0e6eb08de75065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383221
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-03 03:51:29 +00:00
Sam Rawlins 94eef72b7d Move lint rule category mappings to messages.yaml
Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Ie15fbe4d442ced91540f7653888882691bbb4ec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-09-02 23:19:10 +00:00
Konstantin Shcheglov 8de1422a0e Parts. Deprecate Element.enclosingElement, use enclosingElement3.
Change-Id: Iadc4ed02d4bda3b882e65dc6f4d263a6a938e0fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-01 18:50:29 +00:00
Konstantin Shcheglov b3cdad286f Parts. Track used imports while resolving library files. #v2
TGP looks green.
https://fusion2.corp.google.com/presubmit/668751751/OCL:668751751:BASE:669923082:1725204615406:830df8a3/targets

Previous: https://dart-review.googlesource.com/c/sdk/+/382680
Revert: https://dart-review.googlesource.com/c/sdk/+/382903
Change-Id: Idbca23a13cf5c7490aa8bc859e21609c6241951e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383022
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-01 15:58:39 +00:00
Konstantin Shcheglov 70aed6a93c Revert "Parts. Track used imports while resolving library files."
This reverts commit 49c6679e4a.

Reason for revert: breaks google3

Original change's description:
> Parts. Track used imports while resolving library files.
>
> Change-Id: Ic23ec9ca49d93382449bfe2650089eb43099c3e4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382680
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

Change-Id: Ia954aea30c6ef61197ddaeca53a5179745c30908
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382903
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-08-30 13:56:36 +00:00
Danny Tuppeny a0411ae244 [analysis_server] Prevent duplicate completions for extensions for libraries that import them
Fixes https://github.com/dart-lang/sdk/issues/56320

Change-Id: I4645165857c082cb26ac09eb12df3106769fb25a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382821
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-08-29 17:11:33 +00:00
Konstantin Shcheglov 49c6679e4a Parts. Track used imports while resolving library files.
Change-Id: Ic23ec9ca49d93382449bfe2650089eb43099c3e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-08-29 16:19:11 +00:00
Danny Tuppeny d8376f191e [analysis_server] Include color hex codes in LSP completions to get color previews
VS Code will show color previews in code completion if there's a hex value at the start or end of the documentation (or a few other fields, but documentation seems lease intrusive here).

This change will compute and include the hex color if the client indicates it supports the Color completion kind.

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

Change-Id: I94a81993ce5ad95d8cdce2fd61dc7b139710a659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382604
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-08-29 14:36:42 +00:00
Danny Tuppeny ddab694633 [analysis_server] Add failing test for auto-import extensions
See https://github.com/dart-lang/sdk/issues/56320

Change-Id: I6a21ef528d6d67a34e7f845c6cb279f246fe2762
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-08-28 21:39:47 +00:00
Samuel Rawlins b3f31a0440 Revert "Reapply "analyzer: separate unused_element_parameter from unused_element""
This reverts commit b551690c56.

Reason for revert: flutter customer tests failing: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8738601049545714785/+/u/run_test.dart_for_customer_testing_shard_and_subshard_None/stdout

Original change's description:
> Reapply "analyzer: separate unused_element_parameter from unused_element"
>
> Fixes #49025. Fixes #48401
>
> This allows users to blanket ignore unused_element_parameter without
> ignoring unused_element. They are reported in distinct situations so it
> is valid to separate them.
>
> This reverts commit b888da751e.
>
> Change-Id: I8ea52fcdcb491c140c1283602d6911c939e78d50
> Tested: trybots
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381882
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: Ie0df2f4be45e5db2fa255dcf8c30ddf8408c155b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382420
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Matan Lurey <matanl@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-08-27 17:44:28 +00:00
Danny Tuppeny 8ca61608d8 [analysis_server] Add an allow-list for LSP methods exposed over DTD
Before exposing existing LSP methods we need to provide a way for DTD clients to always get the same format responses regardless of the client capabilities provided by the original server. Until then, add an allow-list for LSP methods that we can use to selectively enable specific methods that are not affected by client capabilities.

Change-Id: Ia1c994a50c9b94a91f4085c09f9d9d94c0fad79e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-08-27 16:50:15 +00:00
pq c371785d42 [wildcards] legacy navigation tests
See: https://github.com/dart-lang/sdk/issues/56567

Change-Id: I0abf861903e440f3bc6162e671c71d134786e8d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-26 23:05:57 +00:00
pq a4a146d3c4 [wildcards] legacy occurrences tests
See: https://github.com/dart-lang/sdk/issues/55681

Change-Id: I5426ef22d56f6c2ab92a2028969cebd867a676ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-26 22:59:09 +00:00
Fedor Shcheglov a5cfca1b48 Issue 56572. Fix suggesting extension methods on record types.
Bug: https://github.com/dart-lang/sdk/issues/56572
Change-Id: I47e4b07270843ffb53ab90963e04f01b3b105043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382261
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-08-26 21:18:56 +00:00
pq ee0b971dbd [wildcards] ‘go to super’ tests
Change-Id: I5ffdffe84356e3431d1c4e7b8b861ae812dbbe85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381884
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-08-24 00:07:00 +00:00