Skip to content

Commit afee49e

Browse files
committed
Add a default clientID when running in LSP mode
Change-Id: Ice200282cb84e512562628fd534177ebbd1c13de Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152801 Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 8c70a60 commit afee49e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/analysis_server/lib/src/server/driver.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,21 @@ class Driver implements ServerStarter {
327327
analysisServerOptions.newAnalysisDriverLog =
328328
results[NEW_ANALYSIS_DRIVER_LOG];
329329
analysisServerOptions.clientId = results[CLIENT_ID];
330+
analysisServerOptions.useLanguageServerProtocol = results[USE_LSP];
331+
// For clients that don't supply their own identifier, use a default based on
332+
// whether the server will run in LSP mode or not.
333+
analysisServerOptions.clientId ??=
334+
analysisServerOptions.useLanguageServerProtocol
335+
? 'unknown.client.lsp'
336+
: 'unknown.client.classic';
337+
330338
analysisServerOptions.clientVersion = results[CLIENT_VERSION];
331339
analysisServerOptions.cacheFolder = results[CACHE_FOLDER];
332340
if (results.wasParsed(ENABLE_EXPERIMENT_OPTION)) {
333341
analysisServerOptions.enabledExperiments =
334342
(results[ENABLE_EXPERIMENT_OPTION] as List).cast<String>().toList();
335343
}
336344
analysisServerOptions.useFastaParser = results[USE_FASTA_PARSER];
337-
analysisServerOptions.useLanguageServerProtocol = results[USE_LSP];
338345
analysisServerOptions.useNewRelevance = results[USE_NEW_RELEVANCE];
339346

340347
// Read in any per-SDK overrides specified in <sdk>/config/settings.json.
@@ -383,8 +390,7 @@ class Driver implements ServerStarter {
383390
analysisServerOptions.analytics = analytics;
384391

385392
// Record the client name as the application installer ID.
386-
analytics.setSessionValue(
387-
'aiid', analysisServerOptions.clientId ?? 'not-set');
393+
analytics.setSessionValue('aiid', analysisServerOptions.clientId);
388394
if (analysisServerOptions.clientVersion != null) {
389395
analytics.setSessionValue('cd1', analysisServerOptions.clientVersion);
390396
}

0 commit comments

Comments
 (0)