895093e9f9
This is the core implementation of the "plugin server" that will support the API described at https://docs.google.com/document/d/1T8P323DJxsc3YPzveNIaSKWFkrJp9ydTR4jp_XFb7XQ/edit?resourcekey=0-f8Ue29KMUizqXNGhATp1tg#heading=h.23fjh5hfm2is This is heavily curbed from the ServerPlugin class at `package:analyzer_plugin/plugin/plugin.dart`, but does not depend on it. It depends on two concepts from the analyzer_plugin package: (1) the protocol used for de/serializing requests, responses, etc. And (2) the `PluginCommunicationChannel` class. This is also just a utility for communicating between the analysis server and the plugin server. This plugin server is capable of "registering" individual "plugins", which allows plugins to register individual (maybe multiple) lint rules, and individual (maybe multiple) quick fixes. The plugin server for now only responds essentially to three requests: * `ANALYSIS_REQUEST_SET_CONTEXT_ROOTS` * `EDIT_REQUEST_GET_FIXES` * `PLUGIN_REQUEST_VERSION_CHECK` All files are analyzed during `handleAnalysisSetContextRoots`, and quick fixes are calculated during `handleEditGetFixes`. There are many TODOs, but the included test shows that this plugin server can notify the analysis server of lint diagnostics to be reported, and can respond to a query for quick fixes. Change-Id: Ibc93332319220a2caf49d20ab480940041a15049 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382480 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
16 lines
433 B
Dart
16 lines
433 B
Dart
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:analysis_server_plugin/registry.dart';
|
|
|
|
abstract class Plugin {
|
|
FutureOr<void> register(PluginRegistry registry);
|
|
|
|
FutureOr<void> shutDown() {}
|
|
|
|
FutureOr<void> start() {}
|
|
}
|