Commit Graph

6633 Commits

Author SHA1 Message Date
Jake Macdonald e6df5493c9 support renamed parameters when adding super calls
Bug: https://github.com/dart-lang/sdk/issues/59745
Change-Id: I177e4f748954ddfea1b300085800c8c9a87bed3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408840
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-10 12:48:10 -08:00
Danny Tuppeny 3ded147e2e [analysis_server] Make format of LSP completion tests more consistent
No functional changes here, only formatting/code style:

- Remove additional intending from embedded code in some tests (which didn't match others in this file or the style of other tests in the server)
- Change expression-bodied-tests to block bodies where they're not on a single line

Change-Id: I2c15bbcf7b7accff85f34a4e9ad5afa3e0a0a221
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-10 10:27:40 -08:00
Keerti Parthasarathy 0246cc613f [Completion] Show enum constants when completion is in the declaration.
Fixes https://github.com/dart-lang/sdk/issues/56971

Change-Id: Ib33a58e774f5540c426f5d5ffb7a387414dcf9f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-02-09 22:41:31 -08:00
Jake Macdonald da2ffedc50 add test for adding super calls with multiple parameters
Bug:https://github.com/dart-lang/sdk/issues/59745
Change-Id: Ibaf6321f0ea6cf3046f360e91cf58faba7a16cb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408460
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2025-02-07 13:30:01 -08:00
pq c87b18581a [CQ] rationalize/unify test lint registration
Eliminates duplication and promotes hermetic tests (some were registering and failing to unregister test lints).

Bug: https://github.com/dart-lang/sdk/issues/60036
Change-Id: I9d0fe5fd610b51ce9000decbf75da2338ed87737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-02-07 13:09:28 -08:00
Danny Tuppeny a78fb5e47a [analysis_server] Fix semantic tokens for method tear-offs in object patterns
Fixes https://github.com/dart-lang/sdk/issues/59976

Change-Id: I75127a59670522ddfc6526d10bfe9844638fdd99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408001
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-07 12:24:25 -08:00
Kenzie Davisson 46a739ce20 Add quick assist for Wrap with ValueListenableBuilder
Change-Id: If4941d867fbdea687a12a043da240ceb981c758f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408401
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-07 10:47:31 -08:00
Jake Macdonald f4cfbf9cdc Update create function fix to create an async function for await expressions
Bug: https://github.com/dart-lang/sdk/issues/59990
Change-Id: I9e89089ca5c60bea190060bc0c8e869c7e78e32e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408361
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-06 14:25:39 -08:00
FMorschel 7559108945 [DAS] Tests for parameter highlights
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/60046
Change-Id: I5b57109e9459a8583fd543031f239174a71472cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-06 13:08:59 -08:00
FMorschel 07b7cfed07 New assist to add/edit hide at import for ambiguous import
Closes https://github.com/dart-lang/sdk/pull/56762

GitOrigin-RevId: af16e245090fa66e6212801cd862d809f5ede640
Change-Id: Ibbc49c36860ba6e58c45dfc40029e2375396c153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386020
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-05 15:49:35 -08:00
pq 466cc35c7e [CQ] correct options fix test docs
Change-Id: Ib87ca966872e7ea165d866a1c95fd8669b6852c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407622
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-04 09:05:03 -08:00
Sam Rawlins 2ac59922d2 DAS plugins: Support fixes to ignore diagnostics
Change-Id: I71ae995d1a4a94ecfeafd187c5674c41b6d928d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395702
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-02-04 08:24:23 -08:00
Brian Wilkerson 5454e70ce2 [migration] Rename utilities in protocol_dart.dart
Change-Id: I90c06dffcac98bc8ec6bb2a982a6825157eda56d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407620
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-02-03 16:32:40 -08:00
Brian Wilkerson 448f0d4080 [migrate] server/protocol_dart.dart
I didn't rename all of the functions because I thought it would be easier to review if I did it in two steps.

Change-Id: If765d56300374794dc9964f17002cfbe172e66b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407602
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-03 14:34:21 -08:00
Danny Tuppeny 4be9188379 [analysis_server] Support occurrences (Document Highlights) with different lengths
+ split unnamed constructors from classes

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

Change-Id: I42e7346b7c22348cf6424d15c5c35a24e31c85b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406822
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-03 12:05:53 -08:00
FMorschel 6de0ef3d5f [DAS] Fix auto-complete update combinators
We already have a quick-fix that allows us to use the same existing import by editing the combinators. The auto-completer now should do the same.

Bug: https://github.com/Dart-Code/Dart-Code/issues/5238
Change-Id: I0f3a50299abb9890370a6c8934b49036f7e03196
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404525
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-03 11:15:57 -08:00
FMorschel 1372538855 [DAS] Fixes import prefix go to definition (multiple)
R=keertip@google.com

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

Change-Id: Ida0cb58cdb4267af31a87a29862a3f4f2e28907f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405201
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-03 09:18:52 -08:00
Konstantin Shcheglov 2946ea71d5 Macro. Remove more from analyzer/ and analysis_seever/.
Change-Id: Id5426cce73395d3d95657cf1e0b5f9d85fe3f574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-31 11:35:10 -08:00
Sam Rawlins ca31648dbb Support 'new' analyzer plugins in dart analyze.
This change allows the LegacyAnalysisServer to understand when the
plugin isolate (if there is one) is analyzing or not. There are a few
primary concepts:

* The plugin isolate (PluginServer) notifies the analysis server, when
  analyzing all files in a context collection, and analyzing changed
  files, that it is analyzing, and later that it isn't.
* The NotificationManager tracks whether the plugin isolate is analyzing
  or not, based on the last status.
* The PluginManager tracks whether new plugins are initialized or not.
  This is determined by the work done by the PluginWatcher. If no
  plugins are configured, then plugins are declared to be "initialized".
  Otherwise, the AnalysisServer sets their status to be "initialized"
  after receiving the first status notification from the plugin isolate.
* The LegacyAnalysisServer now uses the additional "are plugins
  analyzing" signal, held in NotificationManager, and the "are plugins
  initializing" signal, held in PluginManager, to determine whether to
  notify the client that analysis is complete.


Change-Id: Ie2b6a6048f074d7a26d7d5d07622a17c30fcab96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405444
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-31 10:44:36 -08:00
Konstantin Shcheglov 6e17841614 Macro. Remove tests from analyzer/ and analysis_server/.
Change-Id: Iabe04d7ff8fe0cc9b605d0c18fd47591fd02d6bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406681
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-29 14:58:19 -08:00
Danny Tuppeny 204039cdf2 [analysis_server] Add "defaultValue" to EditableArguments API
This adds a new field "defaultValue" to the API response that contains the default value for a parameter.

Change-Id: Ief11da553d57871ad1e3fab54c731cbc98d674a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406000
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-29 08:00:26 -08:00
Chloe Stefantsova 11edab5264 [analyzer] Add correction for adding '?' before null-aware elements
Part of https://github.com/dart-lang/sdk/issues/56989

Change-Id: I487790e796a37679fd5fe1c9bc1e72ccb6248249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405520
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2025-01-28 23:06:04 -08:00
Danny Tuppeny ca2119e0a6 [anlaysis_server] Improve the error text/codes for property editor APIs
Change-Id: If3ad0fd11cc661e88104444afd14a5d79374cc1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-28 13:00:18 -08:00
Danny Tuppeny 8eb9bcd7f0 [analysis_server] Verify with/without documentChanges for EditArguments tests
The tests by default run with documentChanges (set in `setUp`), but it's possible LSP-over-Legacy clients won't support it.

Change-Id: I40c65f05127c88e15a43f16669f64675285955dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406002
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-27 12:54:48 -08:00
Danny Tuppeny 1ec4ea79fd [analysis_server] Include "get" or "set" in LSP override completions to distinguish them
Screenshot of how this looks here: https://github.com/dart-lang/sdk/issues/59929#issuecomment-2602188244

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

Change-Id: I220ee8facb96dbf31ee88868c8c44223de5e8406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405007
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-27 09:06:38 -08:00
Danny Tuppeny 8884a8b4ad [analysis_server] Make it easier to print protocol messages when running LSP-over-Legacy tests
This moves the existing `debugPrintCommunication` flag out of `test/lsp` into `test/` and passes it to the `MockServerChannel` to simplify printing protocol messages for LSP-over-Legacy tests (similar to what MockLspServerChannel already does).

Change-Id: Ic5fa6309e8de01ce0c624584ad6eb653ced90698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406021
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-01-27 08:47:42 -08:00
Danny Tuppeny 0d90ccc2ec [analysis_server] Use unique request IDs in tests to avoid flaky tests
Some of the LSP-over-Legacy tests were intermittently failing because the test did not correctly wait for the `setClientCapabilities` request to complete.

The reason for this was that it used the ID `0` (from `_newRequestId`) but so did `setAnalysisRoots`. If the timing was right, the second request would appear to complete when the first did (because the response had id=0) and the test would start before the capabilities had actually been set (and since the test reads them directly off the server, they would be incorrect).

This moves the `_nextRequestId` field down into a base class and updates the helpers for requests like `setAnalysisRoots` to use it too.

Change-Id: Ice44191aad39c7ea81c40e501827557fe563e3d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-24 09:26:38 -08:00
FMorschel a0db69f182 [DAS] Considers factory keyword on constructors auto-complete
R=keertip@google.com

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

Change-Id: I47c51bc521f97398ae19a8d124e836baadfdabd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405200
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-01-24 08:45:46 -08:00
Chloe Stefantsova b0813fb9e2 [analyzer] Add trailing comma test for null-aware elements
Part of https://github.com/dart-lang/sdk/issues/56989

Change-Id: Iad92a1144374ba24cc5b228f7e4b58c6329c8fbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405380
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 23:32:01 -08:00
Danny Tuppeny ecf74c5c54 [analysis_server] Add widget name + documentation to EditableArguments
Change-Id: I8b8424b77ff1f9683934c64636a9f56097be870f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405123
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 15:48:23 -08:00
Danny Tuppeny 1165528f9f [analysis_server] Improve the formatting of inserted arguments
This improves the formatting of inserted arguments by including newlines and indentation if an invocation spans multiple lines.

Change-Id: Idef4602ee9ac9f145879a4628190ec44f87a0018
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405122
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2025-01-22 15:15:31 -08:00
Danny Tuppeny 199d50aab1 [analysis_server] Check for applyEdit support before handling EditArguments
If we get an editArgument request (usually via DDS), we should verify the connected editor supports edits and return an explicit message if not.

Also adds a `setUp()` declaration to `SharedTestInterface` so shared tests can set client capabilities instead of them being duplicated in each test class (and moves the same for ApplyEdit tests to this).

Change-Id: Ie6a85620b3b53663ce92e55d93e3aefcaf4dc980
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 15:15:19 -08:00
Danny Tuppeny 154b473cdb [analysis_server] Fix missing dartdoc references in Library comments
Fixes https://github.com/dart-lang/sdk/issues/59946

Change-Id: I3b8558f72b6cc932f2c87ee4f2e993c5584907a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 13:00:30 -08:00
pq 26f220614c [fix] fix unnecessary_ignore eol ignore corrections
Change-Id: Ifdae16f0a401d28322796b3fecc2e575896fca37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405246
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-22 09:46:56 -08:00
Sam Rawlins 6c5fe06d70 DAS plugins: Add an SDK constraint to generated pubspec
Change-Id: I98765c019d5e41b347b11b874165e3de0e381002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-01-21 10:30:20 -08:00
FMorschel 667730a0b5 [DAS] Fixes import prefix highlighting
R=scheglov@google.com

Fixes: https://github.com/dart-lang/sdk/issues/59942
Change-Id: Id5c971f040dc2dcdddde6e36055e9045eb4b2aef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404925
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-01-20 10:11:52 -08:00
Danny Tuppeny dd9a061f4e [analysis_server] Enable "EditArgument" request to work over the legacy protocol
+ move all related tests to a shared mixin so they run for both servers.

Change-Id: I853e8f24948c07fdde2a5d6a64ddc65962357b6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404841
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-01-18 10:59:08 -08:00
Danny Tuppeny b908274b8c [analysis_server] Minor refactors to enable running EditArgument through legacy server
This is some minor refactoring to support the next CL that will enable the EditArgument request (the one that actually edits arguments, not the one that gets the list of arguments) over legacy.

It moves some code for sending LSP reverse-requests through the legacy server from test code into the actual server (and fixes that they weren't correctly wrapped in the 'lsp.handle' protocol classes) and updates the tests to use the shared interface ready.

Change-Id: I06492138645538072fb12f2fc2d424e214f8055b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-18 10:06:46 -08:00
pq 54981a484b [fix] add remove_comment producer and ignore bulk fixes
Change-Id: I0e86531a84860488d79905e4a43719465f3e7fce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-17 14:30:59 -08:00
Danny Tuppeny 95f0052267 [analysis_server] Add tests for unversioned documents for EditableArguments
The legacy protocol does not currently version documents, so this adds some additional tests for that.

The tests are in the Legacy class and not the shared class because in LSP versions are not optional for opening/changing documents (they are optional in some of the other APIs, but not for open/change).

Change-Id: I7e75b813025b3f67ed143e1b3a8b717224bfa80f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404820
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-01-17 11:50:22 -08:00
pq fa2f2ddf91 [fix] add remove_ignore correction producer
Change-Id: I48ed5c612492e79e1b42ffd8e1522e960981fe63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-16 13:22:20 -08:00
Danny Tuppeny 93621ccfc1 [analysis_server] Move all EditableArgument tests to a shared mixin and run for legacy
This moves all tests (without any changes) to a shared mixin, and then applies that mixin to the original test class. It also adds a new test class for LSP-over-Legacy, meaning the tests will now run for both protocols.

There are two failing tests when using LSP-over-Legacy so they are overridden with `@FailingTest()` temporarily.

Change-Id: I8c7efcf8f5d85d874b3483f4f3953d4d8b68a31a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-01-15 12:30:26 -08:00
Danny Tuppeny 549a78500a [analysis_server] Add a shared test interface to simplify sharing tests between LSP, LSP-over-Legacy
This is refactor extracted from an upcoming change (to make property editor tests run against both servers) to make that change smaller and easier to review.

There are some existing shared tests that run for both LSP and Legacy servers, but they currently do not touch much server API (one is for DTD and one tests reverse-requests). Migrating other tests (such as EditableArguments) requires some additional API be the same between the different test/server base classes.

This change adds an `abstract interface class SharedTestInterface` to serve as a common interface for methods that shared tests need to use that have different implementations between LSP and Legacy. For example, updating the overlays in an LSP-over-Legacy test needs to use the Legacy APIs for updating the overlay and not the LSP ones (so we can't just use the LSP methods like we would for calling something like getHover for LSP-over-Legacy).

It also:

- adds some new futures to the LSP test base to match the behaviour of the legacy one (wait for in-progress analysis)
- replaces the shared mixins with real base classes that implement the shared interface (for ex. `abstract class SharedLspOverLegacyTest extends LspOverLegacyTest implements SharedTestInterface`) to make it easier to create shared tests
- renames `sendLspRequest` to `sendLspRequestToClient` to make it clearer what direction this method is for

Change-Id: I070c2c005b11b9afd8a87aa22b04972a9dde2320
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404680
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-15 12:28:45 -08:00
Danny Tuppeny fb3255dd9e [analysis_server] Add support/tests for reverse-requests for LSP-over-Legacy
This adds shared tests for sending workspace/applyEdit reverse-requests that run for both the LSP and Legacy servers.

It involved moving some code out of the base LSP test onto mixins to be used by LSP-over-Legacy tests and I extracted some mixins that can be used in tests to provide a common interface to both servers for writing shared tests.

Change-Id: I8c6d09f220b2593680547311a4fce66013f86e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-15 07:33:38 -08:00
Danny Tuppeny a0b6a489f3 [analysis_server] Allow legacy clients to set LSP capabilities in setClientCapabilities
This adds a new field to the existing (legacy) setClientCapabilities parameters that accepts an LSP ClientCapabilities.

This will allow a legacy client to indicate that it supports things like the `workspace/applyEdit` reverse-request.

Change-Id: Ia3b75c701f1699c92f902e058daec4844ce664fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404106
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-14 08:56:41 -08:00
Danny Tuppeny 9b71817072 [analysis_server] Fix duplicate reporting of some LSP type parsing errors
Parse errors for spec types were being reported twice - once by the containing object (in canParse()), and once by the nested canParse() call for the nested type.

This skips reporting the error for nested calls to a canParse() method, which will always report the error itself.

Change-Id: I03e4a9638fd6a3fc77eac918f6fd16def93327d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404105
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-14 08:56:41 -08:00
pq c988e32a56 [cq] remove unnecessary ignores
See: https://github.com/dart-lang/sdk/issues/35234

Change-Id: I4563df48df9d71332b3de6fabea9176e199c1ad5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404202
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-01-13 15:05:28 -08:00
Konstantin Shcheglov 8bbe6fbdfe Elements. Report analyzer_use_new_elements without any txt file, add file ignores.
Change-Id: I13125f93a6633563ed6853a622bd9fec045bfc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403923
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-10 15:20:59 -08:00
Danny Tuppeny 6a1f9ed029 [analysis_server] Insert new arguments before last child/children arguments
Usually when adding arguments, we'd always put them at the end. However there is convention (and a lint) for putting child/children last - so if the arguments in the last position are child/children, we should insert before them.

Change-Id: Ia0e0cd6b10f16cef30aa0cfe4fdedecc223f08c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403584
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-08 18:03:34 -08:00
Danny Tuppeny e9a6d62fa4 [analysis_server] Return EditableArguments in parameter order
Originally we put those with arguments first so that in the property editor they'd be at the top. However the results in the order changing if you add/remove them, and across widget instances.

Returning them in source order keeps the consistent (and allows the "more important" ones to be at the top), though nothing prevents having a different sort (or an option to change it) on the client side.

Change-Id: I4808f0cb2ae5fcbb6d5496aa736528e60ac7c935
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403582
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-08 17:39:44 -08:00