Change extensions' `tags` field to array

Tags for an extension are declared in a single string and are
localized one by one at runtime. Tags to localize are provided to
the localization system by a static analysis done on module.json
files. However, with the new system for extensions, we cannot opt
for dynamically localizing tags because UI strings must be declared to
the localization system beforehand.

A workaround, implemented in this CL, is to provide an array of localized
strings as the tags of the extensions, where applicable.

Bug:1134103
Change-Id: I0760d47e25d346d4e52afad2ebdca8c014d63d86
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2577168
Reviewed-by: Tim van der Lippe <[email protected]>
Commit-Queue: Andres Olivares <[email protected]>
diff --git a/front_end/ui/ActionRegistration.ts b/front_end/ui/ActionRegistration.ts
index d48d736..d8baac3 100644
--- a/front_end/ui/ActionRegistration.ts
+++ b/front_end/ui/ActionRegistration.ts
@@ -36,7 +36,7 @@
 
   category(): string;
 
-  tags(): string|undefined;
+  tags(): string|void;
 
   toggleable(): boolean;
 
@@ -207,8 +207,11 @@
     return this.actionRegistration.category;
   }
 
-  tags(): string|undefined {
-    return this.actionRegistration.tags;
+  tags(): string|void {
+    if (this.actionRegistration.tags) {
+      // Get localized keys and separate by null character to prevent fuzzy matching from matching across them.
+      return this.actionRegistration.tags.join('\0');
+    }
   }
 
   toggleable(): boolean {
@@ -365,7 +368,7 @@
   /**
    * Words used to find an action in the Command Menu.
    */
-  tags?: string;
+  tags?: Array<string>;
   /**
    * Whether the action is toggleable.
    */
diff --git a/front_end/ui/ViewManager.js b/front_end/ui/ViewManager.js
index e894c4f..cb81fec 100644
--- a/front_end/ui/ViewManager.js
+++ b/front_end/ui/ViewManager.js
@@ -70,7 +70,11 @@
   }
 
   tags() {
-    return this._viewRegistration.tags;
+    if (this._viewRegistration.tags) {
+      // Get localized keys and separate by null character to prevent fuzzy matching from matching across them.
+      return this._viewRegistration.tags.join('\0');
+    }
+    return undefined;
   }
 
   persistence() {
diff --git a/front_end/ui/ViewRegistration.ts b/front_end/ui/ViewRegistration.ts
index b3500dd..b52b532 100644
--- a/front_end/ui/ViewRegistration.ts
+++ b/front_end/ui/ViewRegistration.ts
@@ -29,7 +29,10 @@
   id: string;
   location?: ViewLocationValues;
   hasToolbar?: boolean;
-  loadView: () => Promise<Widget>, order?: number, settings?: Array<string>, tags?: string;
+  loadView: () => Promise<Widget>;
+  order?: number;
+  settings?: Array<string>;
+  tags?: Array<string>;
 }
 
 export function registerViewExtension(registration: ViewRegistration) {