Commit graph

8130 commits

Author SHA1 Message Date
Konstantin Shcheglov dc01c56e94 [CMSR] Test when the agnostic refactoring updates multiple files.
Change-Id: Ia80d9e31db9d7ad17472aff0e5f5595bf43bc9ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310778
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-22 05:11:55 +00:00
Konstantin Shcheglov 7ecc57ac9e [CMSR] Split into separate files.
Change-Id: I45f1b13a2a025887ee7eb05179934f219097f67c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310776
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-22 01:19:08 +00:00
Marcin Wojnarowski 330106212a Retain surrounding comments in remove comparison quickfix for if-statement
Closes https://github.com/dart-lang/sdk/pull/52544

GitOrigin-RevId: 267e6378cc9a3f64a1a177ec69279ed1baa61b4a
Change-Id: Idb51e14b46708d8b44bc703a4681deea7ec8b42e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-06-22 00:26:27 +00:00
Konstantin Shcheglov 6a65dd0efe [CMSR] Check the second file for ConvertFormalParametersToNamed.
Change-Id: I07a477701939cf2f40c8eeb77faf5a2d38290a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310700
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-21 23:03:42 +00:00
Konstantin Shcheglov 1d9846b16f Remove ADD_NOT_NULL_ASSERT
We believe that it is not necessary anymore, with sound null safety.

Change-Id: I18741eafea1bd969139cdae3b94a294dde1b5abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310769
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-21 22:54:12 +00:00
Konstantin Shcheglov 55e7119183 [CMSR] Add new command to LSP, to convert selected formal parameter(s) to required named.
Change-Id: I7d86ccfe94cc960ea3a8204daf27f339c4ca767f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310764
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-21 22:06:44 +00:00
Konstantin Shcheglov 6a4f127831 [CMSR] Not available if external executable element.
Change-Id: Icf209c8cd844918a62195f8a024f0c0b8922f0d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310705
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 19:51:58 +00:00
Kallen Tu b8d8da0183 [analyzer] Refactor visitListLiteral to handle Constants.
Add CONST_FOR_LOOP error message to be clearer that for loops are not
allowed in const contexts.

visitListLiteral handles Constants.

Change-Id: I84465ecf4e1f044c256db45c723fac081b50a40c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306917
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-21 18:20:51 +00:00
Konstantin Shcheglov c3f3a00465 [CMSR] More checks for not allowed order of formal parameters.
Change-Id: Ida0380afb141873e75c27460b0804a8457c876e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310703
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 18:12:48 +00:00
Konstantin Shcheglov 67970cc613 Add failing tests for enum and 'if'.
Change-Id: I23187e0699df36c8a24d066a733382fe090e3b44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-21 17:57:29 +00:00
Brian Wilkerson bf62bc27bc Adjust the definition of coveringNode to favor identifiers
I would like to use `Selection` for code completion, but the current
definition of `coveringNode` too often favors the parent node over the
child node. This will effectively cause the cursor to bind more closely
to an identifier token than to other tokens, making it more useful for
code completion.

If we don't like this change for the general case, I can make these changes in a specialized `coveringNodeForCompletion`, but I'd rather not have two approaches.

Change-Id: I39e70f83ad44d50cec55a8bee1f7061dd83746fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-21 17:55:36 +00:00
Jens Johansen a0f71d4f6b [analyzer] Make benchmark report memory usage in bytes to make golem happy
Initial commit at https://dart-review.googlesource.com/c/sdk/+/276100
used kb because that's what was reported by the system.
I wasn't allowed to add that to golem though, and then I forgot about
it.
This CL changes it to bytes so it can hopefully by allowed into golem.

Change-Id: Ia7fae9ed47e6d237648e266c26f4a644f13571d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-06-20 06:07:48 +00:00
Konstantin Shcheglov 62f66ecef4 [CMSR] Initial support for constructors.
Change-Id: I2349eaf5dd59596bab1137e297fdf08873d79c1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310201
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-20 00:33:28 +00:00
Liam Appelbe 583da435e9 [analyzer] Support for RawVoidCallbacks
Pointer.fromFunction returns a native function pointer to a Dart
function, but has the restriction that the native code must invoke it
on the same thread as the isolate that created it. RawVoidCallbacks is
a new API that is similar to Pointer.fromFunction. It returns a native
function pointer that can be invoked on any thread, with the
restriction that the Dart function must return void. Under the hood we
forward the function args over a port to the target isolate.

We're not 100% settled on the name of the class, but the overall API
design won't change. I'll make sure to get the naming finalized before
submitting this CL. Doc with discussion of naming:
https://docs.google.com/document/d/1z9Rgahoid2AhC9JXwsDAEODvlJS6dvBHCbcGkOxv_ws/edit?resourcekey=0-TbdNiSL-fdwskla02QaPwg#heading=h.te70ikwelbw8

Bug: https://github.com/dart-lang/sdk/issues/37022
Change-Id: Iba98f6f803c52919b942fa054df1060991574c8c
TEST=ffi_async_callback_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-06-18 23:28:52 +00:00
Konstantin Shcheglov c24c41eeac Extract availability analysis from selection analysis.
Danny gave a good idea that checking for availability of a refactoring
should be cheap. Change method signature refactoring mostly satisfied
this, with one exception - we cannot compute formal parameters for
an ExecutableElement, because we need resolved AST to do this, and
the invoked method can be declared in a different file. We cannot
afford resolving other files while checking.

So, this CL separates availability checking, and preparing formal
parameters, postponing expensive opertions until the time when the
action is invoked.

Change-Id: Ic703d70717e41de304c9dbcef66cadb22c139ad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310041
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-18 20:51:16 +00:00
Konstantin Shcheglov fda8556438 [CMSR] Write existing extra named formal parameters and arguments.
Change-Id: Ibbd69140c7e46bca95dd72f99739eccd1984b2d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309828
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-17 05:20:27 +00:00
Konstantin Shcheglov 21cfe2ce61 Breaking changes for analyzer version 6.0.0
Change-Id: I792c3d66fb10ab779e2a5011b2909efa5738aba7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265183
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-16 16:31:27 +00:00
Keerti Parthasarathy fd4af5f0ff Wire up changeParameterType when running dart fix cli
Change-Id: I41e96ca4722faf746e18b193319d84ade0e08138
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309800
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-16 15:58:38 +00:00
Jens Johansen 5e08794bbf [analyzer] Plug "temporary leak" when starting new rebuilds before afterContextsCreated is called
If again and again editing, say, a `pubspec.yaml` with proper timing
there is a "temporary leak" that repairs itself once the analyzer
finishes (some time after the editing stops).

What happens is that old contexts are saved in the
`declarationsTracker` but eventually cleared in the
`afterContextsCreated` call.

In a test on Windows (on Linux I'd currently run into
https://dartbug.com/52703) I opened the entire "pkg" folder and edited
a `pubspec.yaml` file every 5 seconds.
The analyzer went from using something along the lines of 700MB of heap
to using around 2.5 GB of heap after 25 edits and 17GB (!) of heap
shortly before stopping at 250 `pubspec.yaml` edits.
After the editing stopped (and clicking the GC button in observatory)
the heap usage went down to ~650MB heap used.

This fixes the problem by clearing the `declarationsTracker` on the
`afterContextsDestroyed` call too. In the same test it stays at around
300-700MB of heap.

Possibly related to:
https://github.com/dart-lang/sdk/issues/48788
https://github.com/dart-lang/sdk/issues/52447

Change-Id: Ia38cc946a1f36fa8c5b6804f79cbc8dd96c21030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-06-16 06:42:41 +00:00
Konstantin Shcheglov a2c10f4fe7 Use latest linter.
Change-Id: I4701582dcc7e304295bb63768703a9513a3e6401
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309821
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-16 04:54:47 +00:00
Brian Wilkerson 3a870a3056 Fix another place where the plugin id leaks the path
Change-Id: I6a399917ec0bdfab74bea027b04a6d416eec3999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309824
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-15 22:49:57 +00:00
Brian Wilkerson 022fd17a62 Only include ids of plugins hosted on pub.dev
For extra safety I want to ensure that the plugin is hosted on pub.dev.

Change-Id: I7f2a2f4b85ad6263a97a0927653fb0b688c79224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309400
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-15 17:54:57 +00:00
Brian Wilkerson 1b7837fb52 Reduce the number of data-points reported for percentiles
Change-Id: Icbdc4895d7cc862caf6a40ce1738540a4becee69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-06-15 17:04:17 +00:00
Danny Tuppeny c1969260e8 [analysis_server] Validate server includes all used commands in ServerCapabilities
Change-Id: I03855b7528d8199ceb140b0f0c59dd21c025dc90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-14 14:54:56 +00:00
Kallen Tu 2700afa476 [analysis_server] Change mixin subtype diagnostic status to needsFix.
Bug: https://github.com/dart-lang/sdk/issues/52686
Change-Id: I2482c112ebe83733c084f99f30e75fff454f58f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308963
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-06-14 14:43:07 +00:00
Brian Wilkerson 802a139912 Stop using a file path as a plugin id
Change-Id: I14077207e3c7163aceeeaad7491aa4d7b8d852ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308965
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-13 21:33:17 +00:00
Konstantin Shcheglov 324cef773c [CMSR] Support for formal parameters selection.
Change-Id: I38beddf9eeb36615e11ae1375aac335c1a7a6d56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308966
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-13 20:58:39 +00:00
Konstantin Shcheglov e008654ba6 Add ConvertFormalParametersToNamed, a RefactoringProducer.
Bug: https://github.com/dart-lang/sdk/issues/45675
Change-Id: I611648a47bb59acd2db55e7cd77c2504ff83c4cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308841
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-13 19:29:08 +00:00
Konstantin Shcheglov 4478f7c97c Fixes for Selection.nodesInRange(), more tests.
Change-Id: Ie839c0180d33b196e323dd4f892d8ca671d3cea2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308600
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-13 16:15:29 +00:00
Kallen Tu b80d5479c1 [analyzer] Change error message for mixin subtypes of final and base types.
Add new diagnostics for mixin subtypes since they can only be 'base'.

Bug: https://github.com/dart-lang/sdk/issues/52686
Change-Id: I8e4d6830c5c735c5b42d7fbe78d197c9506bbf4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308806
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-06-13 16:00:21 +00:00
Konstantin Shcheglov d9e2f515ea Check the id of the formal parameter in update, and formal parameters vs. target.
Change-Id: I5f6d1f65386d385d470a7b1d0de3727c0f7788e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308843
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-13 15:52:28 +00:00
Konstantin Shcheglov 0704d96e8f Fix DAS completion benchmarks, after Flutter change.
After 73e1f23426 (diff-20c19d254b0a82027625f1246ba51cb2264bfabf105fe91d532c19e6a6d77478)

Change-Id: Ibcb0327aa71c8d0d9bda3af71cbec582acbdbd9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-13 15:52:18 +00:00
Konstantin Shcheglov a4ac770b44 Add List.stablePartition(), use in CreateConstructorForFinalFields.
See https://en.cppreference.com/w/cpp/algorithm/stable_partition

Change-Id: I1cf77ed7c057e4e42009ec4dd1d15ee2af7dd128
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308812
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-13 15:03:49 +00:00
Jens Johansen 5aee0f61b6 [analyzer] Clear watcher subscriptions to avoid leaking package:watcher data
Analyzer adds watchers to all root folders it has opened.
When editing, say, a pubspec.yaml file it ~starts over, cancels the
old subscriptions and creates new ones. It keeps references to the old
subscriptions too though.

This in turn leaks data.

On Linux internally in package:watcher it clears some stuff as it's
cancelled, but it doesn't on Windows, nor on Mac.

The means it can leak an infinite amount of `_Entry` classes,
and for instance in https://github.com/dart-lang/sdk/issues/52447 a
user has 40+ million of those classes.

Reproducing this I got to 40+ million too, at which point the
"Retained size" of all the `_Entry` objects was 7.39GB.

This fixes the leak by clearing the list.

Change-Id: I718e8edc81b763b66affa16c3b3f6d4b8a97fd1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-06-13 14:32:49 +00:00
Konstantin Shcheglov 015912a3f4 [CMSR] Fix a TODO for converting optional formal parameter into required.
Change-Id: I40c8c9dc6369fec382e0e650ebe01bed384d86b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308844
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-13 06:58:14 +00:00
Keerti Parthasarathy 879a0041eb Remove null assets, is checks.
Change-Id: I9713a585860674b19b78633b70898dbcb37db6ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308808
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-06-13 06:04:09 +00:00
Konstantin Shcheglov 1b1c133b61 Support for ArgumentsTrailingComma in 'Change Method Signature' refactoring.
Change-Id: Iadb60c3cd233044ab78ef8a36eba32616b1ca9c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308804
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-13 00:57:20 +00:00
Brian Wilkerson 0b5e50a48f Convert the completion documentation tests
I think this removes the no longer used test support classes, but let me
know if you know of any code I missed.

Change-Id: I42105b75862631e9f86458ebb7f47a6f8d9935ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308809
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-13 00:32:57 +00:00
Konstantin Shcheglov cd0a7e43fd Fix failing tests in ChangeMethodSignatureTest.
We allow missing named formal parameters and arguments, because
reordering them will not change the semantics. But we fail when a
positional formal parameter or argument is missing.

Change-Id: If3b3315407d2cf717aeaf1db219e6f1f84469224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308807
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-12 23:49:34 +00:00
Konstantin Shcheglov 379ab45f2c Support for private fields in CreateConstructorForFinalFields when using named formal parameters.
Change-Id: I246c8b9f9b5e26ad778648d2d5e12a952bc98395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308801
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-12 21:59:28 +00:00
Konstantin Shcheglov cdad8a99d3 Small renames and reorders for writeArguments()
Change-Id: I40490deb21cd6999ab741e422a8207f5b9ed02cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308802
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-12 21:21:53 +00:00
Konstantin Shcheglov c6372d8f5c Move FormalParameterReference hierarchy to framework.
Change-Id: If3dc2f14ca0d1dec41f8ed89dae5a37a8e4c6f2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-12 20:32:45 +00:00
Keerti Parthasarathy 131d999085 Copy of: Refactor AbstractCorrectionProducer to accept ParsedUnitResult
Change-Id: Ib845757cd638d223221be3494fb9085693333ac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-06-12 19:51:39 +00:00
Konstantin Shcheglov f75e26564e Issue 45675. 'Change Method Signature' refactoring.
Bug: https://github.com/dart-lang/sdk/issues/45675
Change-Id: I396228ec9306353b4bd269abedd3879d0c10a02f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-12 18:39:04 +00:00
Konstantin Shcheglov ed85426591 Inline SingleCorrectionProducer into CorrectionProducer.
It does not look to be used for anything else.

Change-Id: Iba283b93a84c2d1fe81685c07c8e81350759a48b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-12 16:11:18 +00:00
Konstantin Shcheglov 87cf921fec Use textual expectations for SelectionTest.
Currently the checks that we have are ironically both repetitive and
inconsistent. There are also tests that are not precise / demonstrative.

Change-Id: I1ad0de5b9fb982d8091e4f80a6e5c5ebbad0f418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308580
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-12 00:30:04 +00:00
Konstantin Shcheglov fdd628b831 Use getResolvedUnit(File) in AbstractContextTest.
Change-Id: Ic6237185b8a8c8b62de470490873703672a203e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308581
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-11 23:59:39 +00:00
Konstantin Shcheglov ecec8e70cd Remove DeclaredSimpleIdentifier and AstFactoryImpl.
Change-Id: Ifaf4d2c134a4be075afe75c3b8c841644b14da3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-11 23:51:37 +00:00
Konstantin Shcheglov 038fb2925f Include named super formal parameters into CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS_REQUIRED_NAMED.
This is convenient feature when building hierarchies of data classes.

Change-Id: Id4c7040e0515150661165079ad01d9d05e0c1185
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308541
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-11 22:38:43 +00:00
Konstantin Shcheglov fa5d596d6d Enhance CreateConstructorForFinalFields to suggest also required named formal parameters.
Change-Id: I64db6eb4ced756e7b261abaa0c8b058c98fdd5d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308522
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-11 15:25:40 +00:00
Danny Tuppeny e435063e09 [analysis_server] Listen for pub stdout/stderr before awaiting exitCode
On my Windows PC, the process never exits if we haven't subscribed to to the streams so this hands on awaiting exitCode (meaning the pub process never exits and the server never provides code completion for version numbers in pubspec.yaml).

Change-Id: I12a51d8fc50eee8c62d1ac1d4d51c9768a812ad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-10 17:41:27 +00:00
Konstantin Shcheglov edd17a8638 Merge AST interfaces into implementation library, re-export.
Bug: https://github.com/dart-lang/language/issues/3135
Change-Id: Icbc2a4e506e9e58c830b53f7aecce92189bb2d1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308402
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-10 16:57:59 +00:00
Konstantin Shcheglov 38546e90ab Pre-fix unreachable_from_main for instance members.
https://github.com/dart-lang/linter/pull/4441

Change-Id: I55afa6b7d78bc1114ce97c1b5bebcf7a8bca5b98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307975
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-09 22:39:27 +00:00
Konstantin Shcheglov 82e5b86ef6 More stylistic improvements for CreateConstructorForFinalFields.
Change-Id: I3775334f3adb59ffff880cd6d743295cf51eaaa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308247
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-09 21:50:17 +00:00
Danny Tuppeny f1e3bfcef5 [analysis_server] Check for bulk-fixable errors to skip resolution during bulk fix operations
Change-Id: I21a9fa4ed71839e7e196240c0bda31403cfea96c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-08 21:56:01 +00:00
Konstantin Shcheglov 26801b7d7e More clean up in AbstractContextTest.
Change-Id: Id1f3bd7dbd22c6bc8ae63fd04ee0c7231af69e02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308240
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-08 20:34:17 +00:00
Konstantin Shcheglov 1a98453d63 Issue 48474. Fix for renaming private methods, don't update other libraries.
Bug: https://github.com/dart-lang/sdk/issues/48474
Change-Id: I361c5d53826a2e8b97c5c5df9e14a0298b6fe424
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308165
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-08 20:27:08 +00:00
Konstantin Shcheglov 6055524426 Use File instead of String path in AbstractContextTest.
Change-Id: I30ea3f08f8954e4d642aaf070e0da313013ad153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308162
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-08 19:21:31 +00:00
Danny Tuppeny fde2b15e35 [analysis_server] [dart fix] Use existing server ByteStore to speed up checking for errors
On my Windows PC using the Flutter repo (running `dartdev fix` from source) I see significant improvements:

flutter/packages/flutter/: 45s -> 15s
flutter/: 5m 23s -> 33s

These projects are clean so have no fixable errors, the improvements may be smaller where there are fixable errors and a larger proportion of time is spent resolving libraries.

Change-Id: Ie48baaa4ff8916112dab6639ae4e824e5b646ea8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-08 19:18:32 +00:00
Ludi Zhan 4079a47cc4 [analyzer] Introduce a new annotation @visibleOutsideTemplate
The new annotation is intended to be used on members of class, enum or mixin to opt out the @visibleForTemplate visibility restriction cascaded from class- / enum- / mixin- level.

1. Throw warning if the annotation is added to a invalid target.
2. Update @visibleForTemplate diagnostics logic to opt out members annotated with @visibleOutsideTemplate.

Change-Id: Iec546fc7785cd45f39a1b2a2cc8849ef1cf9d04a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304825
Reviewed-by: Marya Belanger <mbelanger@google.com>
Auto-Submit: Ludi Zhan <ludizhan@google.com>
Commit-Queue: Ludi Zhan <ludizhan@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-08 18:47:15 +00:00
Brian Wilkerson f197c63616 Convert argument list contributor tests
Change-Id: I998bc7a23e83541b10c38596f66a7496fb3d9682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307974
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-08 16:33:47 +00:00
Konstantin Shcheglov 25dc2147bb Separate testFile and testFilePath in server tests.
Change-Id: Icc11f0c7f1642471cc01a0046e2a04801efba084
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307967
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-07 23:56:09 +00:00
Danny Tuppeny fb0b139358 [analysis_server] Improve performance of checking and running "dart fix"
Running the check for whether to prompt about "dart fix" in the LSP server with the whole Flutter repo open took around 45s before, and around 0.45s after. Almost all time was spent resolving libraries but now resolution is skipped for any libraries that don't contain fixable errors.

In my testing, "dart fix" (from source) didn't see any significant gains (around 46s down to around 43s for flutter/packages/flutter in my testing).

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

Change-Id: I0db63f5d54c7c262fe16aeb825f817cf526199c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-07 22:03:36 +00:00
Konstantin Shcheglov 692ef6be03 Add quotedAndCommaSeparatedWithOr and use for TransformSetParser.
Change-Id: Ie599d1e7b24efa137cb342392d278df051fbed33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307666
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-07 17:19:59 +00:00
Konstantin Shcheglov bdd145a39a Issue 52601. Extend 'Create constructor for final fields' to support enums.
Bug: https://github.com/dart-lang/sdk/issues/52601
Change-Id: I3e8dcc288864ca7c68992cb1218e66b2d34c5aa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307669
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-07 02:11:27 +00:00
Danny Tuppeny 3beb26c531 [analysis_server] Support iterative "fix all" through LSP
Fixes https://github.com/dart-lang/sdk/issues/47968.

Change-Id: I7e96199c971d98ef46715c87e7c0dbe6ffae49ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304340
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-07 00:32:00 +00:00
Konstantin Shcheglov 79b71c789f Use ParameterReference for ChangeParameterType.
Change-Id: Iad7f840d7342b4868529aea1e3767a79739dd18d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307662
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-06 19:34:20 +00:00
Konstantin Shcheglov 7071c65b8c Change TransformSetParser.singleKey() to avoid null asserts.
Change-Id: Idd01da5d024f661ef7ec1102d1f1adb1fdca3f41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-06 17:39:36 +00:00
Danny Tuppeny a3399e3616 [analysis_server] Add support for adding imports with show/hide + update Move to File
Change-Id: I5c732c969a9a89af76b82e60ac652cf00bb878bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306920
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-06 17:05:42 +00:00
Konstantin Shcheglov 526ce3aba4 Issue 52005. Convert non-exhaustive returning SwitchStatement to SwitchExpression when followed by throw.
Bug: https://github.com/dart-lang/sdk/issues/52005
Change-Id: I16bf21703e4404e805dbc40906be5936e95f102c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307510
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-05 22:44:53 +00:00
Konstantin Shcheglov 8d29829271 Use 'coveringNode' name in RefactoringContext, as it is in Selection.
Change-Id: I376463a748e1349f2c07c3547754c551134b085e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-05 20:49:58 +00:00
Brian Wilkerson 97ec9e95bf Convert imported reference completion tests
Change-Id: I288121d53e13ab998dfa1681754fc5a422e50766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307500
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-05 20:49:48 +00:00
Danny Tuppeny 29f121126b [analysis_server] Allow skipping slow benchmarks with env variable
These tests can be quite slow (around 90 seconds on my machine, out of 4-5 mins for a test run) but aren't actually testing a lot. Opting out of them when running all tests repeatedly makes things much faster.

The default is still for them to run, you need to explicitly opt-out to skip them.

Change-Id: Id1aff44f48e71059f6ca44ff17acbf3f86427d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-05 16:01:35 +00:00
Danny Tuppeny c739cbfd7b [analysis_server] Fix generation tests on Windows
The check normalises newlines from "actualContents", but "expectedContents" could also contain \r\n on Windows (at least it does for me), so this just normalises both.

The additional await/async is to prevent "Test failed after it already completed" warnings because this code is inside the call to test() (and not wrapping it, like the other .main() calls in the file).

Change-Id: Iac034efaf1a8a6dad4a21dc67a2dfdb74092dd22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-04 19:18:51 +00:00
Danny Tuppeny f984411eac [analysis_server] Fix split_multiple_declarations to use \r\n on Windows
Change-Id: Ifd94cd7aa425eae78c6d1eb0a814b6b868f68905
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307300
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-04 19:18:08 +00:00
Danny Tuppeny 2a705d8612 [analysis_server] Extract base server functionality from protocol-specific callbacks
This is just a refactor with no functional changes.

To simplify future work of supporting both protocols against a single server, this removes some common functionality out of each server into the base server (or in this case, some base callbacks that operate on the base server).

It's important when the server runs with both protocols that we don't accidentally duplicate any work, so stripping down the servers (and callbacks) to only the protocol-specific parts should make this easier.

Change-Id: I040368078b992d0c41bd8de10b09e38d3957f004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-06-03 18:33:15 +00:00
Parker Lougheed 25c0ae1c42 Link to dart.dev for linter rules
This allows more flexibility as we can configure the redirect overtime, compared to the GitHub hosted site which we have less control over. It could even redirect to the old linter site in the meantime if desired.

Contributes to https://github.com/dart-lang/linter/issues/4411 and https://github.com/dart-lang/site-www/issues/4498

Change-Id: I3512002cdf7f62c0338d67cec0d7091f1166479d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307000
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-02 18:26:13 +00:00
Konstantin Shcheglov 79e6783637 Typing tweaks for ExecuteCommandHandler.
Change-Id: I8d53e93eb619d9fcdb6bd884ef8eee421ae86af7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306905
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-01 22:03:58 +00:00
Danny Tuppeny 247ca91bb8 [analysis_server] Tweak "ignore diagnostic" text for file
This makes the text more different (and longer) than the "ignore for line" so at a glance it doesn't look like the items are duplicated (see https://github.com/dart-lang/sdk/issues/51959#issuecomment-1571536150).

Change-Id: Ib752c9a222bf82b1af80ab7060a26208b0bc9201
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-01 20:08:51 +00:00
Konstantin Shcheglov 255cf5a36e Issue 51995. Enable RenameToCamelCase for local variables when LintNames.constant_identifier_names is reported.
Bug: https://github.com/dart-lang/sdk/issues/51995
Change-Id: Ib72d75ce27cb8d1f49f7a8ac88af6a57d1ca8874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306670
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-31 20:51:19 +00:00
Konstantin Shcheglov dfb7e5098b Issue 52543. Support for 'remove comparison' fix for IfElement.
Bug: https://github.com/dart-lang/sdk/issues/52543
Change-Id: Ibeecc42db2135d507ed8f74f5a4888fb122b131f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306312
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-30 21:34:36 +00:00
Polina Cherkasova 41d77c0135 Remove signs '=' from autosnapshotting arg.
Signs '=' make initial parsing in analysis server failing.

Change-Id: I2187efa1d45bbfaddaf6248ade3f87775030141f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Polina Cherkasova <polinach@google.com>
2023-05-30 16:33:43 +00:00
Konstantin Shcheglov 8702f09502 Issue 49759. Keep only 2.19 tests in RemoveDuplicateCaseTest.
The corresponding lint is no-op in 3.0
https://github.com/dart-lang/linter/issues/3674

Bug: https://github.com/dart-lang/sdk/issues/49759
Change-Id: I24fd82240d8e94e763742c546ec2d4cf3c4df8cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-26 20:42:21 +00:00
Konstantin Shcheglov faa16fc565 Issue 52130. Fix 'Inline Local' refactoring inside SwitchPatternCase.
Bug: https://github.com/dart-lang/sdk/issues/52130
Change-Id: Ic84e4781e12dece3775fc0462b727a6a9b9c9906
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306125
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-26 19:38:48 +00:00
Konstantin Shcheglov 9fadf93ee3 When running LspServerClient, without '--no_dds', extract the DevTools line.
So that we don't attempt to process it as part of LSP.

Change-Id: I29a297e40f038ea48ef25a0af86c73a165fc17dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-26 18:00:31 +00:00
Danny Tuppeny 9745fbe70d [analysis_server] Log when fixes and assists are used
Change-Id: I989e55aa8501c9b768ee72ad76c9266e8b0d0253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305860
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-26 15:10:31 +00:00
Konstantin Shcheglov 7d138719ec Use OwnedFiles to track which files are owned by which driver.
So, we don't have to recompute it at every symbol search.
For Flutter repository, searching for 'ButtonStyle' is 40% faster.

SHA: 47fe150674
Description: before
  [mean: 56.4][stdDev: 1.471][min: 54.0][max: 61.0]

Description: own files
  [mean: 35.0][stdDev: 1.308][min: 33.0][max: 38.0]
Change-Id: Id497bf4117bdfafeeccd04601fd0198e22624c0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305843
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-26 00:42:12 +00:00
Brian Wilkerson c1243af736 Keep the completion tests sane by de-duping results
Change-Id: Ia3d179fff02b5418ef0a46c06469d2509fbc45bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305841
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-25 19:16:16 +00:00
Simone Stasi aafc857ede quick fix for avoid_multiple_declarations_per_line
This CL adds a quick fix for `avoid_multiple_declarations_per_line`. This fix work for var/const/final/late variables, both typed and untyped. The declarations are also correctly indented and comments between the declarations are kept.

Change-Id: Ic614e264a199405cc0b9ceaea55a27c848970cfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-25 17:54:59 +00:00
Danny Tuppeny 3054053e79 [analysis_server] Don't remove unused imports in "Fix All" if being run automatically on-save
Before this change, using fix-all-on-save in VS Code would also remove unused imports:

```
"editor.codeActionsOnSave": {
	"source.fixAll": true
}
```

This behaviour was a little inconsistent without iterative fix-all (it would not remove the imports if other fixes were applied). Iterative fix-all made it consistent, but this behaviour is not what many users want (for example if they'd temporarily commented out code).

With this change, imports will not be touched when using fix-all if it was invoked automatically by save. However, it's possible to retain the original behaviour by invoked listing the original fix, or (more efficiently) `source.organizeImports`) to run on-save:

```
"editor.codeActionsOnSave": {
	"source.fixAll": true,
	"source.organizeImports": true
}
```

Fixes https://github.com/dart-lang/sdk/issues/52046
Fixes https://github.com/Dart-Code/Dart-Code/issues/4561

Change-Id: If68a5d13c2c1c9a494be61872c942fca8a4dd35c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-25 17:24:09 +00:00
Brian Wilkerson 07fb9dff39 Convert most of the local reference completion tests
I'm not sure how to convert the doc tests. They're currently depending
on being able to set up some state in the server that I can't reach
from the new test framework. I'm guessing that I might be able to define
dartdoc comments that would populate the data structures in the same way,
but if you can think of an easier approach I'd love to hear about it.

Change-Id: I20afcf0865c1a45b682444f8bce8c4e3c7fdc45c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305782
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-25 17:08:10 +00:00
Jens Johansen fa20ed6ea3 [analyzer] Remove context name from report
In response to https://dartbug.com/48788#issuecomment-1561371880

Change-Id: I5454d71beab1b3be2c8c0724fea23f4aa98b2573
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305662
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-05-25 09:51:51 +00:00
Sam Rawlins 47fe150674 Bump linter to 27b46ce246204a2c0170a4bd5b23b94095e89a22
Change-Id: I15748475e9d96273c21be833e71924da111073ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305063
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-05-24 23:18:40 +00:00
Konstantin Shcheglov 4b281f2c0c Fix Windows bots.
After https://dart-review.googlesource.com/c/sdk/+/305143

Change-Id: I91ce7c5f5fabad3625588ea5aa8bc4d5b2a675d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-24 20:19:16 +00:00
pq 6177071590 prefer_final_in_for_each fix support for DartPatterns
(This is assuming https://github.com/dart-lang/linter/pull/4383 doesn't get reverted.)

Change-Id: I8c8fd8b0443170901bee7168f805a6dcf0ac1971
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-05-24 19:58:53 +00:00
Konstantin Shcheglov 89cb058276 Update import analyzer to prepare for NamedType refactoring.
To land before https://dart-review.googlesource.com/c/sdk/+/303280

Change-Id: I7f1a2442cca1081c083472da8ee22f1f10b028bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305363
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-24 19:34:58 +00:00
Konstantin Shcheglov 4d6c762b70 Add 'Convert to constant pattern' quick fix.
Bug: https://github.com/dart-lang/linter/issues/4195
Change-Id: I76eeaaa8d8c9508c10a81d1eecd0bc46c8c7d1f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305420
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-24 19:31:21 +00:00
Konstantin Shcheglov c09793ad87 Issue 50534. Quick fix for use_string_in_part_of_directives.
Bug: https://github.com/dart-lang/sdk/issues/50534
Change-Id: I3ddc32646a473f1c5f322a0ecaaa850f3c2e3089
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305143
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-24 17:14:37 +00:00
Konstantin Shcheglov 85f8fe8fd3 Issue 52137. Extend 'Remove unused local variable' to variables in list/map patterns.
Bug: https://github.com/dart-lang/sdk/issues/52137
Change-Id: I0602ab2f4a1c1a87e6e02a2e93d87d8e74ba4c44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-24 16:15:15 +00:00
Konstantin Shcheglov 71304ce543 Issue 52128. Support 'const UndefinedName()' in 'Create Class' quick fix.
Bug: https://github.com/dart-lang/sdk/issues/52128
Change-Id: Iea00b06b1635c6fbf1c0f4308bc7abcec61cf8bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-23 21:18:13 +00:00