[analysis_server] Add a test for signature help of extension type method

Change-Id: I3e4d54e63f171dfd73b11e1997feb4dba7e4b76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324684
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/lsp/signature_help_test.dart b/pkg/analysis_server/test/lsp/signature_help_test.dart
index 4f6e51e..9883fea 100644
--- a/pkg/analysis_server/test/lsp/signature_help_test.dart
+++ b/pkg/analysis_server/test/lsp/signature_help_test.dart
@@ -24,7 +24,7 @@
   Future<void> testSignature(
     String fileContent,
     String expectedLabel,
-    String expectedDoc,
+    String? expectedDoc,
     List<ParameterInformation> expectedParams, {
     MarkupKind? expectedFormat = MarkupKind.Markdown,
     SignatureHelpContext? context,
@@ -41,16 +41,19 @@
     expect(sig.label, equals(expectedLabel));
     expect(sig.parameters, equals(expectedParams));
 
-    // Test the format matches the tests expectation.
-    // For clients that don't support MarkupContent it'll be a plain string,
-    // but otherwise it'll be a MarkupContent of type PlainText or Markdown.
-    final doc = sig.documentation!;
-    if (expectedFormat == null) {
-      // Plain string.
-      expect(doc.valueEquals(expectedDoc), isTrue);
-    } else {
-      final expected = MarkupContent(kind: expectedFormat, value: expectedDoc);
-      expect(doc.valueEquals(expected), isTrue);
+    if (expectedDoc != null) {
+      // Test the format matches the tests expectation.
+      // For clients that don't support MarkupContent it'll be a plain string,
+      // but otherwise it'll be a MarkupContent of type PlainText or Markdown.
+      final doc = sig.documentation!;
+      if (expectedFormat == null) {
+        // Plain string.
+        expect(doc.valueEquals(expectedDoc), isTrue);
+      } else {
+        final expected =
+            MarkupContent(kind: expectedFormat, value: expectedDoc);
+        expect(doc.valueEquals(expected), isTrue);
+      }
     }
   }
 }
@@ -192,6 +195,35 @@
     expect(res, isNull);
   }
 
+  Future<void> test_extensionType() async {
+    final content = '''
+class A {
+  void f(int a) {}
+}
+
+extension type E(A a) {
+  void f(int e) {}
+}
+
+void f() {
+  final e = E(A());
+  e.f(^);
+}
+''';
+    final initialAnalysis = waitForAnalysisComplete();
+    await initialize();
+    await openFile(mainFileUri, withoutMarkers(content));
+    await initialAnalysis;
+    await testSignature(
+      content,
+      'f(int e)',
+      null,
+      [
+        ParameterInformation(label: 'int e'),
+      ],
+    );
+  }
+
   Future<void> test_formats_markdown() async {
     final content = '''
     /// Does foo.