Commit Graph

2 Commits

Author SHA1 Message Date
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 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