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>
While fixing the doc comments for DartSnippetProducer.addImports, I
saw that it references two methods only found in the subclass,
FlutterSnippetProducer ("Adds public imports for any elements fetched
by [getClass] and [getMixin]").
It turns out that the `addImports` method and the `requiredElementImports` are only needed in the subclass,
FlutterSnippetProducer, so I just moved them over. Now the doc
comment references resolve correctly.
Change-Id: Id90e8257b4096308b8cd3ce19b14708ca1b5e365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
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>
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>
This class had a few methods which only pertain to the resource provider
and can just be extensions on ResourceProvider. They also have the
exact same impl! So one can redirect to the other.
Change-Id: I3a0433304adba1b71f69d0a4afc8a44515a23d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405600
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
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>
The types of the following members of `CollectionLiteralContext` are
all changed to use `TypeImpl` rather than `DartType`:
- `elementType`
- `iterableType`
- `keyType`
- `valueType`
To reduce the number of casts that need to be added, some field types,
getter types, method return types, and method parameter types are
changed to `Impl` types in the following classes, mixins, and
extensions:
- `BodyInferenceContext`
- `ElementsTypesMixin`
- `ErrorDetectionHelpers`
- `ExecutableMember`
- `ExtensionMemberResolver`
- `ExtensionsExtensions`
- `ExtensionsExtensions2`
- `FormalParameterElementMixin`
- `FragmentedFunctionTypedElementMixin`
- `FunctionTypeImpl`
- `GenericFunctionInferenceTest`
- `InstantiatedExtensionWithMember`
- `InterfaceTypeImpl`
- `InvocationInferrer`
- `LeastUpperBoundHelper`
- `LowerBoundTest`
- `MethodMember`
- `NotInstantiatedExtensionsExtensions`
- `NotInstantiatedExtensionsExtensions2`
- `ParameterElementExtension`
- `ParameterElementMixin`
- `ResolverVisitor`
- `StringTypes`
- `TypedLiteralResolver`
- `TypeSystemImpl`
- `TypeSystemOperations`
- `_BoundsTestBase`
- `_InferredCollectionElementTypeInformation`
- `_NotInstantiatedExtension`
- `_ParamInfo`
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: I7a5f7c411e81b829be205f1919c933f8f874e5ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405404
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
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>
The types of `TypeAnnotationImpl.type`, and the fields that override
it, are changed from `DartType?` to `TypeImpl?`. Also, the type of
`TypeAnnotationExtension.typeOrThrow` is changed from `DartType` to
`TypeImpl`.
To reduce the number of casts that need to be added, the following
changes are made in parallel:
- An additional extension `TypeAnnotationImplExtension.typeOrThrow` is
added; this has the same behavior as
`TypeAnnotationExtension.typeOrThrow`, but it doesn't require a type
cast.
- Some field types, getter types, method return types, and method
parameter types are changed to `Impl` types in the following
classes:
- `AstRewriter`
- `EraseNonJSInteropTypes`
- `ExtensionTypeErasure`
- `FreshTypeParameters`
- `FullInvocationInferrer`
- `FunctionExpressionInvocationResolver`
- `FunctionReferenceResolver`
- `FunctionTypeBuilder`
- `InstanceCreationInferrer`
- `InvocationExpressionInferrer`
- `InvocationInferrer`
- `NamedTypeBuilder`
- `NamedTypeResolver`
- `ResolutionReader`
- `TypeAliasElementImpl`
- `TypeAliasElementImpl2`
- `TypeImpl`
- `TypeParameterElementImpl`
- `TypeSystemImpl`
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: I7f753508b53f6744677fd18f66858d70eb974093
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405221
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>