DAS: Remove AnalysisServer.supportsPlugins
I'm not sure of the history of this static final field, but it is not commented, nor are there any hints of the value changing. It can just be removed. Change-Id: I310511fb63000a728f21a96c40b34f8d8798b366 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446281 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
committed by
Commit Queue
parent
423deed157
commit
cc28d8ca3d
@@ -103,9 +103,6 @@ typedef UserPromptSender =
|
||||
/// Implementations of [AnalysisServer] implement a server that listens
|
||||
/// on an [AbstractNotificationManager] for analysis messages and process them.
|
||||
abstract class AnalysisServer {
|
||||
/// A flag indicating whether plugins are supported in this build.
|
||||
static final bool supportsPlugins = true;
|
||||
|
||||
/// The options of this server instance.
|
||||
AnalysisServerOptions options;
|
||||
|
||||
@@ -338,19 +335,15 @@ abstract class AnalysisServer {
|
||||
);
|
||||
performance = performanceDuringStartup;
|
||||
|
||||
PluginWatcher? pluginWatcher;
|
||||
if (supportsPlugins) {
|
||||
this.pluginManager =
|
||||
pluginManager ??= PluginManager(
|
||||
resourceProvider,
|
||||
resourceProvider.byteStorePath,
|
||||
sdkManager.defaultSdkDirectory,
|
||||
notificationManager,
|
||||
instrumentationService,
|
||||
);
|
||||
|
||||
pluginWatcher = PluginWatcher(resourceProvider, pluginManager);
|
||||
}
|
||||
this.pluginManager =
|
||||
pluginManager ??= PluginManager(
|
||||
resourceProvider,
|
||||
resourceProvider.byteStorePath,
|
||||
sdkManager.defaultSdkDirectory,
|
||||
notificationManager,
|
||||
instrumentationService,
|
||||
);
|
||||
var pluginWatcher = PluginWatcher(resourceProvider, pluginManager);
|
||||
|
||||
var logName = options.newAnalysisDriverLog;
|
||||
if (logName != null) {
|
||||
@@ -519,7 +512,7 @@ abstract class AnalysisServer {
|
||||
analyzer_plugin.RequestParams requestParams,
|
||||
analysis.AnalysisDriver? driver,
|
||||
) {
|
||||
if (driver == null || !AnalysisServer.supportsPlugins) {
|
||||
if (driver == null) {
|
||||
return <PluginInfo, Future<Response>>{};
|
||||
}
|
||||
return pluginManager.broadcastRequest(
|
||||
@@ -1074,9 +1067,8 @@ abstract class AnalysisServer {
|
||||
// For now we record plugins only on shutdown. We might want to record them
|
||||
// every time the set of plugins changes, in which case we'll need to listen
|
||||
// to the `PluginManager.pluginsChanged` stream.
|
||||
if (supportsPlugins) {
|
||||
analyticsManager.changedPlugins(pluginManager);
|
||||
}
|
||||
analyticsManager.changedPlugins(pluginManager);
|
||||
|
||||
// For now we record context-dependent information only on shutdown. We
|
||||
// might want to record it on start-up as well.
|
||||
analyticsManager.createdAnalysisContexts(contextManager.analysisContexts);
|
||||
@@ -1139,9 +1131,7 @@ abstract class CommonServerContextManagerCallbacks
|
||||
void broadcastWatchEvent(WatchEvent event) {
|
||||
analysisServer.notifyDeclarationsTracker(event.path);
|
||||
analysisServer.notifyFlutterWidgetDescriptions(event.path);
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
analysisServer.pluginManager.broadcastWatchEvent(event);
|
||||
}
|
||||
analysisServer.pluginManager.broadcastWatchEvent(event);
|
||||
}
|
||||
|
||||
void flushResults(List<String> files);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
|
||||
|
||||
/// The handler for the `analysis.reanalyze` request.
|
||||
@@ -26,12 +25,8 @@ class AnalysisReanalyzeHandler extends LegacyHandler {
|
||||
sendResult(AnalysisReanalyzeResult());
|
||||
|
||||
await server.reanalyze();
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
//
|
||||
// Restart all of the plugins. This is an async operation that will happen
|
||||
// in the background.
|
||||
//
|
||||
unawaited(server.pluginManager.restartPlugins());
|
||||
}
|
||||
// Restart all of the plugins. This is an async operation that will happen
|
||||
// in the background.
|
||||
unawaited(server.pluginManager.restartPlugins());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/protocol/protocol.dart';
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
|
||||
import 'package:analysis_server/src/plugin/request_converter.dart';
|
||||
import 'package:analysis_server/src/utilities/extensions/resource_provider.dart';
|
||||
@@ -39,18 +38,11 @@ class AnalysisSetPriorityFilesHandler extends LegacyHandler {
|
||||
}
|
||||
|
||||
server.setPriorityFiles(request.id, params.files);
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
//
|
||||
// Forward the request to the plugins.
|
||||
//
|
||||
var converter = RequestConverter();
|
||||
server.pluginManager.setAnalysisSetPriorityFilesParams(
|
||||
converter.convertAnalysisSetPriorityFilesParams(params),
|
||||
);
|
||||
}
|
||||
//
|
||||
// Send the response.
|
||||
//
|
||||
// Forward the request to the plugins.
|
||||
var converter = RequestConverter();
|
||||
server.pluginManager.setAnalysisSetPriorityFilesParams(
|
||||
converter.convertAnalysisSetPriorityFilesParams(params),
|
||||
);
|
||||
sendResult(AnalysisSetPriorityFilesResult());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/protocol/protocol.dart';
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
|
||||
import 'package:analysis_server/src/plugin/request_converter.dart';
|
||||
import 'package:analysis_server/src/protocol/protocol_internal.dart';
|
||||
@@ -45,18 +44,11 @@ class AnalysisSetSubscriptionsHandler extends LegacyHandler {
|
||||
valueCallback: (List<String> subscriptions) => subscriptions.toSet(),
|
||||
);
|
||||
server.setAnalysisSubscriptions(subMap);
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
//
|
||||
// Forward the request to the plugins.
|
||||
//
|
||||
var converter = RequestConverter();
|
||||
server.pluginManager.setAnalysisSetSubscriptionsParams(
|
||||
converter.convertAnalysisSetSubscriptionsParams(params),
|
||||
);
|
||||
}
|
||||
//
|
||||
// Send the response.
|
||||
//
|
||||
// Forward the request to the plugins.
|
||||
var converter = RequestConverter();
|
||||
server.pluginManager.setAnalysisSetSubscriptionsParams(
|
||||
converter.convertAnalysisSetSubscriptionsParams(params),
|
||||
);
|
||||
sendResult(AnalysisSetSubscriptionsResult());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,15 +173,13 @@ class LspAnalysisServer extends AnalysisServer {
|
||||
|
||||
channel.listen(scheduleMessage, onDone: done, onError: socketError);
|
||||
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
_pluginChangeSubscription = pluginManager.pluginsChanged.listen(
|
||||
(_) => _onPluginsChanged(),
|
||||
);
|
||||
_pluginChangeSubscription = pluginManager.pluginsChanged.listen(
|
||||
(_) => _onPluginsChanged(),
|
||||
);
|
||||
|
||||
// TODO(srawlins): Listen to
|
||||
// `notificationManager.pluginAnalysisStatusChanges` and perform "on idle"
|
||||
// tasks.
|
||||
}
|
||||
// TODO(srawlins): Listen to
|
||||
// `notificationManager.pluginAnalysisStatusChanges` and perform "on idle"
|
||||
// tasks.
|
||||
}
|
||||
|
||||
/// The hosted location of the client application.
|
||||
@@ -251,15 +249,13 @@ class LspAnalysisServer extends AnalysisServer {
|
||||
|
||||
@override
|
||||
set pluginManager(PluginManager value) {
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
// we exchange the plugin manager in tests
|
||||
super.pluginManager = value;
|
||||
_pluginChangeSubscription?.cancel();
|
||||
// we exchange the plugin manager in tests
|
||||
super.pluginManager = value;
|
||||
_pluginChangeSubscription?.cancel();
|
||||
|
||||
_pluginChangeSubscription = pluginManager.pluginsChanged.listen(
|
||||
(_) => _onPluginsChanged(),
|
||||
);
|
||||
}
|
||||
_pluginChangeSubscription = pluginManager.pluginsChanged.listen(
|
||||
(_) => _onPluginsChanged(),
|
||||
);
|
||||
}
|
||||
|
||||
/// Whether or not the client has advertised support for
|
||||
@@ -1092,11 +1088,9 @@ class LspAnalysisServer extends AnalysisServer {
|
||||
String path,
|
||||
plugin.HasToJson changeForPlugins,
|
||||
) {
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
pluginManager.setAnalysisUpdateContentParams(
|
||||
plugin.AnalysisUpdateContentParams({path: changeForPlugins}),
|
||||
);
|
||||
}
|
||||
pluginManager.setAnalysisUpdateContentParams(
|
||||
plugin.AnalysisUpdateContentParams({path: changeForPlugins}),
|
||||
);
|
||||
}
|
||||
|
||||
void _onPluginsChanged() {
|
||||
@@ -1160,21 +1154,19 @@ class LspAnalysisServer extends AnalysisServer {
|
||||
driver.priorityFiles = priorityFilesList;
|
||||
}
|
||||
|
||||
if (AnalysisServer.supportsPlugins) {
|
||||
var pluginPriorities = plugin.AnalysisSetPriorityFilesParams(
|
||||
priorityFilesList,
|
||||
);
|
||||
pluginManager.setAnalysisSetPriorityFilesParams(pluginPriorities);
|
||||
var pluginPriorities = plugin.AnalysisSetPriorityFilesParams(
|
||||
priorityFilesList,
|
||||
);
|
||||
pluginManager.setAnalysisSetPriorityFilesParams(pluginPriorities);
|
||||
|
||||
// Plugins send most of their analysis results via notifications, but with
|
||||
// LSP we're supposed to have them available per request. Assume that
|
||||
// we'll only receive requests for files that are currently open.
|
||||
var pluginSubscriptions = plugin.AnalysisSetSubscriptionsParams({
|
||||
for (var service in plugin.AnalysisService.values)
|
||||
service: priorityFilesList,
|
||||
});
|
||||
pluginManager.setAnalysisSetSubscriptionsParams(pluginSubscriptions);
|
||||
}
|
||||
// Plugins send most of their analysis results via notifications, but with
|
||||
// LSP we're supposed to have them available per request. Assume that
|
||||
// we'll only receive requests for files that are currently open.
|
||||
var pluginSubscriptions = plugin.AnalysisSetSubscriptionsParams({
|
||||
for (var service in plugin.AnalysisService.values)
|
||||
service: priorityFilesList,
|
||||
});
|
||||
pluginManager.setAnalysisSetSubscriptionsParams(pluginSubscriptions);
|
||||
|
||||
notificationManager.setSubscriptions({
|
||||
for (var service in protocol.AnalysisService.values)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/lsp/client_capabilities.dart';
|
||||
import 'package:analysis_server/src/lsp/constants.dart';
|
||||
import 'package:analysis_server/src/lsp/lsp_analysis_server.dart';
|
||||
@@ -151,22 +150,18 @@ class ServerCapabilitiesComputer {
|
||||
ServerCapabilitiesComputer(this._server);
|
||||
|
||||
List<TextDocumentFilterScheme> get pluginTypes =>
|
||||
AnalysisServer.supportsPlugins
|
||||
? _server.pluginManager.plugins
|
||||
.expand(
|
||||
(plugin) => plugin.currentSession?.interestingFiles ?? const [],
|
||||
)
|
||||
// All published plugins use something like `*.extension` as
|
||||
// interestingFiles. Prefix a `**/` so that the glob matches nested
|
||||
// folders as well.
|
||||
.map(
|
||||
(glob) => TextDocumentFilterScheme(
|
||||
scheme: 'file',
|
||||
pattern: '**/$glob',
|
||||
),
|
||||
)
|
||||
.toList()
|
||||
: <TextDocumentFilterScheme>[];
|
||||
_server.pluginManager.plugins
|
||||
.expand(
|
||||
(plugin) => plugin.currentSession?.interestingFiles ?? const [],
|
||||
)
|
||||
// All published plugins use something like `*.extension` as
|
||||
// interestingFiles. Prefix a `**/` so that the glob matches nested
|
||||
// folders as well.
|
||||
.map(
|
||||
(glob) =>
|
||||
TextDocumentFilterScheme(scheme: 'file', pattern: '**/$glob'),
|
||||
)
|
||||
.toList();
|
||||
|
||||
ServerCapabilities computeServerCapabilities(
|
||||
LspClientCapabilities clientCapabilities,
|
||||
|
||||
@@ -21,10 +21,7 @@ class PluginsPage extends DiagnosticPageWithNav {
|
||||
@override
|
||||
Future<void> generateContent(Map<String, String> params) async {
|
||||
h3('Analysis plugins');
|
||||
var analysisPlugins =
|
||||
AnalysisServer.supportsPlugins
|
||||
? server.pluginManager.plugins
|
||||
: <PluginInfo>[];
|
||||
var analysisPlugins = server.pluginManager.plugins;
|
||||
|
||||
if (analysisPlugins.isEmpty) {
|
||||
blankslate('No known analysis plugins.');
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import 'package:analysis_server/protocol/protocol.dart';
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
@@ -143,7 +142,6 @@ analyzer:
|
||||
}
|
||||
|
||||
Future<void> test_sentToPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
addTestFile('');
|
||||
// set priority files
|
||||
var response = await _setPriorityFile(testFile);
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'dart:async';
|
||||
import 'package:analysis_server/protocol/protocol.dart';
|
||||
import 'package:analysis_server/protocol/protocol_constants.dart';
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/plugin/plugin_locator.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
||||
@@ -2115,8 +2114,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// excluded from the parents plugin root.
|
||||
Future<void>
|
||||
test_sentToPlugins_inNestedPackages_withNestedAnalysisOptions_enabledPlugin_disabledPlugin() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
|
||||
// package1 has plugin2 enabled.
|
||||
@@ -2156,8 +2153,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// root should be created.
|
||||
Future<void>
|
||||
test_sentToPlugins_inNestedPackages_withNestedAnalysisOptions_enabledPlugin_enabledDifferentPlugin() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
var plugin2 = (name: 'plugin2', path: _createPlugin('plugin2'));
|
||||
|
||||
@@ -2203,8 +2198,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// additional context needs to be created.
|
||||
Future<void>
|
||||
test_sentToPlugins_inNestedPackages_withNestedAnalysisOptions_enabledPlugin_enabledPluginExplicit() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
|
||||
// package1 has plugin2 enabled.
|
||||
@@ -2248,8 +2241,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// created.
|
||||
Future<void>
|
||||
test_sentToPlugins_inNestedPackages_withNestedAnalysisOptions_enabledPlugin_enabledPluginInclude() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
|
||||
// package1 has plugin2 enabled.
|
||||
@@ -2297,8 +2288,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// - package3/ (plugin1)
|
||||
Future<void>
|
||||
test_sentToPlugins_inNestedPackages_withoutPackageConfigs() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
var plugin2 = (name: 'plugin2', path: _createPlugin('plugin2'));
|
||||
|
||||
@@ -2352,8 +2341,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// - package2/ (plugin2, (plugin1 - disabled due to limit))
|
||||
/// - package3/ (plugin1)
|
||||
Future<void> test_sentToPlugins_inNestedPackages_withPackageConfigs() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
var plugin2 = (name: 'plugin2', path: _createPlugin('plugin2'));
|
||||
|
||||
@@ -2396,8 +2383,6 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
/// - package1/ (plugin1)
|
||||
/// - package1/lib/ (no explicit options, plugin1 implied)
|
||||
Future<void> test_sentToPlugins_inNestedPackages_withSubFolders() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
var plugin1 = (name: 'plugin1', path: _createPlugin('plugin1'));
|
||||
|
||||
// Only the first plugin for each will be enabled due to the 1-plugin-limit.
|
||||
@@ -2624,7 +2609,6 @@ class A {}
|
||||
}
|
||||
|
||||
Future<void> test_sentToPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
addTestFile('int V = 42;');
|
||||
// subscribe
|
||||
await addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/plugin/plugin_manager.dart';
|
||||
import 'package:analysis_server/src/services/correction/assist_internal.dart';
|
||||
import 'package:analyzer/instrumentation/service.dart';
|
||||
@@ -53,7 +52,6 @@ class AssistsTest extends PubPackageAnalysisServerTest {
|
||||
}
|
||||
|
||||
Future<void> test_fromPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
PluginInfo info = PluginInfo(
|
||||
'a',
|
||||
'b',
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/plugin/plugin_manager.dart';
|
||||
import 'package:analysis_server/src/services/correction/fix_internal.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
@@ -97,7 +96,6 @@ void f() {
|
||||
}
|
||||
|
||||
Future<void> test_fromPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
PluginInfo info = PluginInfo(
|
||||
'a',
|
||||
'b',
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/lsp/extensions/code_action.dart';
|
||||
import 'package:analyzer/src/test_utilities/test_code_format.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin;
|
||||
@@ -34,7 +33,6 @@ class AssistsCodeActionsTest extends AbstractLspAnalysisServerTest
|
||||
Future<void> test_plugin() async {
|
||||
failTestOnErrorDiagnostic = false;
|
||||
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
// This code should get an assist to replace 'foo' with 'bar'.'
|
||||
const content = '''
|
||||
[!foo!]
|
||||
@@ -80,7 +78,6 @@ bar
|
||||
Future<void> test_plugin_sortsWithServer() async {
|
||||
setSupportedCodeActionKinds([CodeActionKind.Refactor]);
|
||||
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
// Produces a server assist of "Convert to single quoted string" (with a
|
||||
// priority of 30).
|
||||
var code = TestCode.parse('import "[!dart:async!]";');
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/lsp/extensions/code_action.dart';
|
||||
import 'package:analyzer/src/test_utilities/test_code_format.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin;
|
||||
@@ -92,17 +91,14 @@ bar
|
||||
}
|
||||
|
||||
Future<void> test_plugin_dart() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
return await checkPluginResults(testFilePath);
|
||||
}
|
||||
|
||||
Future<void> test_plugin_nonDart() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
return await checkPluginResults(join(projectFolderPath, 'lib', 'foo.foo'));
|
||||
}
|
||||
|
||||
Future<void> test_plugin_sortsWithServer() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
// Produces a server fix for removing unused import with a default
|
||||
// priority of 50.
|
||||
var code = TestCode.parse('''
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analysis_server/lsp_protocol/protocol.dart' as lsp;
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/legacy_analysis_server.dart';
|
||||
import 'package:analyzer/src/test_utilities/test_code_format.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
@@ -470,7 +469,6 @@ class A {
|
||||
}
|
||||
|
||||
Future<void> test_fromPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
var pluginAnalyzedFilePath = join(projectFolderPath, 'lib', 'foo.foo');
|
||||
var pluginAnalyzedFileUri = pathContext.toUri(pluginAnalyzedFilePath);
|
||||
var pluginResult = plugin.AnalysisGetNavigationResult(
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart';
|
||||
import 'package:analysis_server/src/protocol/protocol_internal.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Position;
|
||||
import 'package:test/test.dart';
|
||||
@@ -34,7 +33,6 @@ class Bar {
|
||||
''';
|
||||
|
||||
Future<void> test_documentChange_notifiesPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
await _initializeAndOpen();
|
||||
await changeFile(2, mainFileUri, [
|
||||
TextDocumentContentChangeEvent.t1(
|
||||
@@ -105,7 +103,6 @@ class Bar {
|
||||
}
|
||||
|
||||
Future<void> test_documentClose_notifiesPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
await _initializeAndOpen();
|
||||
await closeFile(mainFileUri);
|
||||
|
||||
@@ -300,7 +297,6 @@ class Bar {
|
||||
}
|
||||
|
||||
Future<void> test_documentOpen_notifiesPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
await _initializeAndOpen();
|
||||
|
||||
expect(
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
||||
import 'package:analysis_server/src/analysis_server.dart' hide MessageType;
|
||||
import 'package:analysis_server/src/lsp/constants.dart';
|
||||
import 'package:analysis_server/src/lsp/server_capabilities_computer.dart';
|
||||
import 'package:analysis_server/src/plugin/plugin_manager.dart';
|
||||
@@ -174,8 +173,6 @@ class InitializationTest extends AbstractLspAnalysisServerTest {
|
||||
}
|
||||
|
||||
Future<void> test_completionRegistrations_withDartPlugin() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
// This tests for a bug that occurred with an analysis server plugin
|
||||
// that works on Dart files. When computing completion registrations we
|
||||
// usually have separate registrations for Dart + non-Dart to account for
|
||||
@@ -216,8 +213,6 @@ class InitializationTest extends AbstractLspAnalysisServerTest {
|
||||
}
|
||||
|
||||
Future<void> test_dynamicRegistration_areNotInterleaved() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
// Some of the issues in https://github.com/dart-lang/sdk/issues/47851
|
||||
// (duplicate hovers/code actions/etc.) were caused by duplicate
|
||||
// registrations. This happened when we tried to rebuild registrations
|
||||
@@ -617,8 +612,6 @@ class InitializationTest extends AbstractLspAnalysisServerTest {
|
||||
}
|
||||
|
||||
Future<void> test_dynamicRegistration_unregistersOutdatedAfterChange() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
|
||||
// Initialize by supporting dynamic registrations everywhere
|
||||
setAllSupportedTextDocumentDynamicRegistrations();
|
||||
|
||||
@@ -656,7 +649,6 @@ class InitializationTest extends AbstractLspAnalysisServerTest {
|
||||
}
|
||||
|
||||
Future<void> test_dynamicRegistration_updatesWithPlugins() async {
|
||||
if (!AnalysisServer.supportsPlugins) return;
|
||||
setTextDocumentDynamicRegistration('foldingRange');
|
||||
await initialize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user