Report HighlightRegionType.IMPORT_PREFIX for import prefix in NamedType.

Change-Id: I05ce7fb0010dafe69c6b5926a368350a3486332e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343541
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index e1fd908..ebfc57f 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -1194,6 +1194,13 @@
 
   @override
   void visitNamedType(NamedType node) {
+    if (node.importPrefix case final importPrefix?) {
+      computer._addRegion_token(
+        importPrefix.name,
+        HighlightRegionType.IMPORT_PREFIX,
+      );
+    }
+
     var type = node.type;
     if (type != null) {
       var isDynamic = type is DynamicType && node.name2.lexeme == 'dynamic';
diff --git a/pkg/analysis_server/test/analysis/notification_highlights2_test.dart b/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
index 93de9c5..bf8ec92 100644
--- a/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_highlights2_test.dart
@@ -1256,6 +1256,28 @@
     assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'ma.max');
   }
 
+  Future<void> test_IMPORT_PREFIX_methodInvocation() async {
+    addTestFile('''
+import 'dart:math' as ma;
+void f() {
+  ma.max(1, 2);
+}
+''');
+    await prepareHighlights();
+    assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'ma;');
+    assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'ma.max');
+  }
+
+  Future<void> test_IMPORT_PREFIX_namedType() async {
+    addTestFile('''
+import 'dart:math' as math;
+void f(math.Random r) {}
+''');
+    await prepareHighlights();
+    assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'math;');
+    assertHasRegion(HighlightRegionType.IMPORT_PREFIX, 'math.Random');
+  }
+
   Future<void> test_INSTANCE_FIELD() async {
     addTestFile('''
 class A {