Analysis server: Show current registration in LSP Diagnostics

Show the current registration and params in the capabilities page.
For me, this was useful to verify plugin registrations with a custom
document selector.

Change-Id: If8c009cb75a6c4b42661354ee90eb515eee2da06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
index 617a6f6..ad70fb7 100644
--- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
+++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
@@ -92,7 +92,7 @@
   final LspAnalysisServer _server;
 
   /// Map from method name to current registration data.
-  Map<String, Registration> _currentRegistrations = {};
+  Map<String, Registration> currentRegistrations = {};
   var _lastRegistrationId = 0;
 
   ServerCapabilitiesComputer(this._server);
@@ -373,7 +373,7 @@
     // compute a diff of old and new registrations to send the unregister or
     // another register request. We assume that we'll only ever have one
     // registration per LSP method name.
-    for (final entry in _currentRegistrations.entries) {
+    for (final entry in currentRegistrations.entries) {
       final method = entry.key;
       final registration = entry.value;
 
@@ -393,7 +393,7 @@
       }
     }
 
-    _currentRegistrations = newRegistrationsByMethod;
+    currentRegistrations = newRegistrationsByMethod;
 
     if (removedRegistrations.isNotEmpty) {
       await _server.sendRequest(Method.client_unregisterCapability,
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index b99d5c2..d2680b1 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -984,7 +984,13 @@
     } else {
       prettyJson(server.capabilities.toJson());
     }
-    buf.writeln('</div>');
+    buf.writeln('</div>'); // half for server capabilities
+    buf.writeln('</div>'); // columns
+
+    h3('Current registrations');
+    p('Showing the LSP method name and the registration params sent to the '
+        'client.');
+    prettyJson(server.capabilitiesComputer.currentRegistrations);
   }
 }