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>
analysis_server_plugin package
This package is being developed for the second incarnation of Dart Analyzer plugins. It is in an intermediate state, and a few things must be kept in mind during this phase of development:
- This package is not to be published on pub yet. We will flesh out a stable API befoure the first publish.
- In order to support the above point, no pub-publishable code can depend on
this package. At no point can we introduce a dependency from a package
like
analyzeroranalyzer_pluginto this package. If we did so, then at the next time we published that package to pub, we would need to publish this package to pub. No. In short, I think what this means is that only theanalysis_serverpackage can depend on this package.
Migration of code between packages
As part of the design of the new Dart Analyzer plugins, much code will shift around, in a few directions.
-
analysis_serverpackage toanalysis_server_pluginpackage: The API of the new Dart Analyzer plugins focuses around two primary concepts: lint rules and quick fixes. Quick assists may be chosen as a third important concept. Lint rule code has typically lived in theanalyzerpackage, and does not need to move. (It's presence in theanalyzerpackage could be deprecated in favor of this package, but it is not important for the implementation.)Quick fixes, however, have only existed in concept, and interface, and API, in the
analysis_serverpackage. That code needs to move to this package in order to be used in a Dart Analyzer plugin.A move from the
analysis_serverpackage to this package is not a breaking change. -
analyzer_pluginpackage toanalysis_server_pluginpackage: Care is being taken to decide where Dart Analyzer plugin code will live and how it will be published. It is not decided yet what the ultimate package API will be. Some code from analyzer_plugin may move to this package.A move from the
analyzer_pluginpackage is a breaking change. Extreme care must be taken. -
analyzer_pluginpackage toanalysis_serverpackage: There will be many components of the analysis server that currently live inanalyzer_plugin, because they were necessary for the first version of Dart Analyzer plugins), but are not part of the new Dart Analyzer plugins. These components can be moved safely back into theanalysis_serverpackage.In terms of priority, it is not crucial for such code to be moved out of the
analyzer_pluginpackage. It can live there indefinitely, and theanalysis_serverpackage can continue to depend on code from theanalyzer_pluginpackage, as shipped in the SDK.A move from the
analyzer_pluginpackage is a breaking change. Extreme care must be taken.