Skip to content

Commit a3ef455

Browse files
srawlinsCommit Queue
authored andcommitted
DAS: Small fixes for LegacyAnalysisServer docs and ctor
* Fix two comment references * Mark AnalysisServer().enableBlazeWatcher as `@visibleForTesting`. * Use named super parameters where possible. Change-Id: Ic2561c7dd1a661857fbe2e7577fb29c55a5d57b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402440 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Auto-Submit: Samuel Rawlins <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent b12fa8c commit a3ef455

File tree

3 files changed

+19
-36
lines changed

3 files changed

+19
-36
lines changed

pkg/analysis_server/lib/src/analysis_server.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ abstract class AnalysisServer {
280280
ProcessRunner? processRunner,
281281
this.notificationManager, {
282282
this.requestStatistics,
283-
bool enableBlazeWatcher = false,
283+
// Disable to avoid using this in unit tests.
284+
@visibleForTesting bool enableBlazeWatcher = false,
284285
DartFixPromptManager? dartFixPromptManager,
285286
this.providedByteStore,
286287
PluginManager? pluginManager,

pkg/analysis_server/lib/src/legacy_analysis_server.dart

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ import 'package:analysis_server/src/services/completion/completion_state.dart';
9393
import 'package:analysis_server/src/services/execution/execution_context.dart';
9494
import 'package:analysis_server/src/services/flutter/widget_descriptions.dart';
9595
import 'package:analysis_server/src/services/refactoring/legacy/refactoring_manager.dart';
96-
import 'package:analysis_server/src/services/user_prompts/dart_fix_prompt_manager.dart';
9796
import 'package:analysis_server/src/utilities/process.dart';
98-
import 'package:analysis_server/src/utilities/request_statistics.dart';
9997
import 'package:analyzer/dart/analysis/results.dart';
10098
import 'package:analyzer/dart/analysis/session.dart';
10199
import 'package:analyzer/dart/ast/ast.dart';
@@ -167,8 +165,8 @@ class AnalysisServerOptions {
167165
}
168166

169167
/// Instances of the class [LegacyAnalysisServer] implement a server that
170-
/// listens on a [CommunicationChannel] for analysis requests and processes
171-
/// them.
168+
/// listens on a [ServerCommunicationChannel] for analysis requests and
169+
/// processes them.
172170
class LegacyAnalysisServer extends AnalysisServer {
173171
/// A map from the name of a request to a function used to create a request
174172
/// handler.
@@ -192,19 +190,19 @@ class LegacyAnalysisServer extends AnalysisServer {
192190
ANALYSIS_REQUEST_SET_SUBSCRIPTIONS: AnalysisSetSubscriptionsHandler.new,
193191
ANALYSIS_REQUEST_UPDATE_CONTENT: AnalysisUpdateContentHandler.new,
194192
ANALYSIS_REQUEST_UPDATE_OPTIONS: AnalysisUpdateOptionsHandler.new,
195-
//
193+
196194
ANALYTICS_REQUEST_IS_ENABLED: AnalyticsIsEnabledHandler.new,
197195
ANALYTICS_REQUEST_ENABLE: AnalyticsEnableHandler.new,
198196
ANALYTICS_REQUEST_SEND_EVENT: AnalyticsSendEventHandler.new,
199197
ANALYTICS_REQUEST_SEND_TIMING: AnalyticsSendTimingHandler.new,
200-
//
198+
201199
COMPLETION_REQUEST_GET_SUGGESTION_DETAILS2:
202200
CompletionGetSuggestionDetails2Handler.new,
203201
COMPLETION_REQUEST_GET_SUGGESTIONS2: CompletionGetSuggestions2Handler.new,
204-
//
202+
205203
DIAGNOSTIC_REQUEST_GET_DIAGNOSTICS: DiagnosticGetDiagnosticsHandler.new,
206204
DIAGNOSTIC_REQUEST_GET_SERVER_PORT: DiagnosticGetServerPortHandler.new,
207-
//
205+
208206
EDIT_REQUEST_FORMAT: EditFormatHandler.new,
209207
EDIT_REQUEST_FORMAT_IF_ENABLED: EditFormatIfEnabledHandler.new,
210208
EDIT_REQUEST_GET_ASSISTS: EditGetAssistsHandler.new,
@@ -223,19 +221,19 @@ class LegacyAnalysisServer extends AnalysisServer {
223221
EDIT_REQUEST_GET_POSTFIX_COMPLETION: EditGetPostfixCompletionHandler.new,
224222
EDIT_REQUEST_LIST_POSTFIX_COMPLETION_TEMPLATES:
225223
EditListPostfixCompletionTemplatesHandler.new,
226-
//
224+
227225
EXECUTION_REQUEST_CREATE_CONTEXT: ExecutionCreateContextHandler.new,
228226
EXECUTION_REQUEST_DELETE_CONTEXT: ExecutionDeleteContextHandler.new,
229227
EXECUTION_REQUEST_GET_SUGGESTIONS: ExecutionGetSuggestionsHandler.new,
230228
EXECUTION_REQUEST_MAP_URI: ExecutionMapUriHandler.new,
231229
EXECUTION_REQUEST_SET_SUBSCRIPTIONS: ExecutionSetSubscriptionsHandler.new,
232-
//
230+
233231
FLUTTER_REQUEST_GET_WIDGET_DESCRIPTION:
234232
FlutterGetWidgetDescriptionHandler.new,
235233
FLUTTER_REQUEST_SET_WIDGET_PROPERTY_VALUE:
236234
FlutterSetWidgetPropertyValueHandler.new,
237235
FLUTTER_REQUEST_SET_SUBSCRIPTIONS: FlutterSetSubscriptionsHandler.new,
238-
//
236+
239237
SEARCH_REQUEST_FIND_ELEMENT_REFERENCES:
240238
SearchFindElementReferencesHandler.new,
241239
SEARCH_REQUEST_FIND_MEMBER_DECLARATIONS:
@@ -247,15 +245,14 @@ class LegacyAnalysisServer extends AnalysisServer {
247245
SEARCH_REQUEST_GET_ELEMENT_DECLARATIONS:
248246
SearchGetElementDeclarationsHandler.new,
249247
SEARCH_REQUEST_GET_TYPE_HIERARCHY: SearchGetTypeHierarchyHandler.new,
250-
//
248+
251249
SERVER_REQUEST_CANCEL_REQUEST: ServerCancelRequestHandler.new,
252250
SERVER_REQUEST_GET_VERSION: ServerGetVersionHandler.new,
253251
SERVER_REQUEST_SET_CLIENT_CAPABILITIES:
254252
ServerSetClientCapabilitiesHandler.new,
255253
SERVER_REQUEST_SET_SUBSCRIPTIONS: ServerSetSubscriptionsHandler.new,
256254
SERVER_REQUEST_SHUTDOWN: ServerShutdownHandler.new,
257255

258-
//
259256
LSP_REQUEST_HANDLE: LspOverLegacyHandler.new,
260257
};
261258

@@ -364,11 +361,6 @@ class LegacyAnalysisServer extends AnalysisServer {
364361

365362
/// Initialize a newly created server to receive requests from and send
366363
/// responses to the given [channel].
367-
///
368-
/// If [rethrowExceptions] is true, then any exceptions thrown by analysis are
369-
/// propagated up the call stack. The default is true to allow analysis
370-
/// exceptions to show up in unit tests, but it should be set to false when
371-
/// running a full analysis server.
372364
LegacyAnalysisServer(
373365
this.channel,
374366
ResourceProvider baseResourceProvider,
@@ -379,15 +371,14 @@ class LegacyAnalysisServer extends AnalysisServer {
379371
InstrumentationService instrumentationService, {
380372
http.Client? httpClient,
381373
ProcessRunner? processRunner,
382-
RequestStatisticsHelper? requestStatistics,
374+
super.requestStatistics,
383375
DiagnosticServer? diagnosticServer,
384376
this.detachableFileSystemManager,
385-
// Disable to avoid using this in unit tests.
386-
bool enableBlazeWatcher = false,
387-
DartFixPromptManager? dartFixPromptManager,
377+
super.enableBlazeWatcher,
378+
super.dartFixPromptManager,
388379
super.providedByteStore,
389380
super.pluginManager,
390-
bool retainDataForTesting = false,
381+
super.retainDataForTesting,
391382
}) : lspClientConfiguration = lsp.LspClientConfiguration(
392383
baseResourceProvider.pathContext,
393384
),
@@ -402,10 +393,6 @@ class LegacyAnalysisServer extends AnalysisServer {
402393
httpClient,
403394
processRunner,
404395
NotificationManager(channel, baseResourceProvider.pathContext),
405-
requestStatistics: requestStatistics,
406-
enableBlazeWatcher: enableBlazeWatcher,
407-
dartFixPromptManager: dartFixPromptManager,
408-
retainDataForTesting: retainDataForTesting,
409396
) {
410397
var contextManagerCallbacks = ServerContextManagerCallbacks(
411398
this,

pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import 'package:analysis_server/src/server/diagnostic_server.dart';
2929
import 'package:analysis_server/src/server/error_notifier.dart';
3030
import 'package:analysis_server/src/server/message_scheduler.dart';
3131
import 'package:analysis_server/src/server/performance.dart';
32-
import 'package:analysis_server/src/services/user_prompts/dart_fix_prompt_manager.dart';
3332
import 'package:analysis_server/src/utilities/process.dart';
3433
import 'package:analyzer/dart/analysis/results.dart';
3534
import 'package:analyzer/dart/analysis/session.dart';
@@ -160,10 +159,9 @@ class LspAnalysisServer extends AnalysisServer {
160159
ProcessRunner? processRunner,
161160
DiagnosticServer? diagnosticServer,
162161
this.detachableFileSystemManager,
163-
// Disable to avoid using this in unit tests.
164-
bool enableBlazeWatcher = false,
165-
DartFixPromptManager? dartFixPromptManager,
166-
bool retainDataForTesting = false,
162+
super.enableBlazeWatcher,
163+
super.dartFixPromptManager,
164+
super.retainDataForTesting,
167165
}) : lspClientConfiguration = LspClientConfiguration(
168166
baseResourceProvider.pathContext,
169167
),
@@ -178,9 +176,6 @@ class LspAnalysisServer extends AnalysisServer {
178176
httpClient,
179177
processRunner,
180178
LspNotificationManager(baseResourceProvider.pathContext),
181-
enableBlazeWatcher: enableBlazeWatcher,
182-
dartFixPromptManager: dartFixPromptManager,
183-
retainDataForTesting: retainDataForTesting,
184179
) {
185180
notificationManager.server = this;
186181
messageHandler = UninitializedStateMessageHandler(this);

0 commit comments

Comments
 (0)