Skip to content

Commit c9356d7

Browse files
Kateryna ProkopenkoDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update command menu help
Screenshot: https://imgur.com/a/M97CpZV Bug: 325442580 Change-Id: Ibefdc64549f809ec10c5ea99ad87012bef42c32d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6174732 Reviewed-by: Kim-Anh Tran <[email protected]> Commit-Queue: Kateryna Prokopenko <[email protected]> Auto-Submit: Kateryna Prokopenko <[email protected]>
1 parent 3e92545 commit c9356d7

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

front_end/panels/snippets/SnippetsQuickOpen.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ const UIStrings = {
2222
*@description Text for suggestion of run a code snippet
2323
*/
2424
snippet: 'Snippet',
25+
/**
26+
*@description Text for help title of run code snippet menu
27+
*/
28+
runSnippet: 'Run snippet',
2529
};
2630
const str_ = i18n.i18n.registerUIStrings('panels/snippets/SnippetsQuickOpen.ts', UIStrings);
2731
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -88,8 +92,8 @@ export class SnippetsQuickOpen extends QuickOpen.FilteredListWidget.Provider {
8892
QuickOpen.FilteredListWidget.registerProvider({
8993
prefix: '!',
9094
iconName: 'exclamation',
91-
iconWidth: '20px',
9295
provider: () => Promise.resolve(SnippetsQuickOpen.instance()),
96+
helpTitle: i18nLazyString(UIStrings.runSnippet),
9397
titlePrefix: i18nLazyString(UIStrings.run),
9498
titleSuggestion: i18nLazyString(UIStrings.snippet),
9599
});

front_end/panels/sources/sources-meta.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ const UIStrings = {
416416
*@description Text for command suggestion of go to a given symbol
417417
*/
418418
symbol: 'Symbol',
419+
/**
420+
*@description Text for help title of go to symbol menu
421+
*/
422+
goToSymbol: 'Go to symbol',
419423
/**
420424
*@description Text for command prefix of open a file
421425
*/
@@ -424,9 +428,13 @@ const UIStrings = {
424428
*@description Text for command suggestion of open a file
425429
*/
426430
file: 'File',
431+
/**
432+
*@description Text for help title of open file menu
433+
*/
434+
openFile: 'Open file',
427435
/**
428436
* @description Title of a setting under the Sources category in Settings. If this option is off,
429-
* the sources panel will not be automatically be focsed whenever the application hits a breakpoint
437+
* the sources panel will not be automatically be focused whenever the application hits a breakpoint
430438
* and comes to a halt.
431439
*/
432440
disableAutoFocusOnDebuggerPaused: 'Do not focus Sources panel when triggering a breakpoint',
@@ -2019,35 +2027,35 @@ UI.ContextMenu.registerItem({
20192027
QuickOpen.FilteredListWidget.registerProvider({
20202028
prefix: '@',
20212029
iconName: 'symbol',
2022-
iconWidth: '20px',
20232030
async provider() {
20242031
const Sources = await loadSourcesModule();
20252032
return new Sources.OutlineQuickOpen.OutlineQuickOpen();
20262033
},
2034+
helpTitle: i18nLazyString(UIStrings.goToSymbol),
20272035
titlePrefix: i18nLazyString(UIStrings.goTo),
20282036
titleSuggestion: i18nLazyString(UIStrings.symbol),
20292037
});
20302038

20312039
QuickOpen.FilteredListWidget.registerProvider({
20322040
prefix: ':',
20332041
iconName: 'colon',
2034-
iconWidth: '20px',
20352042
async provider() {
20362043
const Sources = await loadSourcesModule();
20372044
return new Sources.GoToLineQuickOpen.GoToLineQuickOpen();
20382045
},
2046+
helpTitle: i18nLazyString(UIStrings.goToLine),
20392047
titlePrefix: i18nLazyString(UIStrings.goTo),
20402048
titleSuggestion: i18nLazyString(UIStrings.line),
20412049
});
20422050

20432051
QuickOpen.FilteredListWidget.registerProvider({
20442052
prefix: '',
20452053
iconName: 'document',
2046-
iconWidth: '20px',
20472054
async provider() {
20482055
const Sources = await loadSourcesModule();
20492056
return new Sources.OpenFileQuickOpen.OpenFileQuickOpen();
20502057
},
2058+
helpTitle: i18nLazyString(UIStrings.openFile),
20512059
titlePrefix: i18nLazyString(UIStrings.open),
20522060
titleSuggestion: i18nLazyString(UIStrings.file),
20532061
});

front_end/ui/legacy/components/quick_open/CommandMenu.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ const UIStrings = {
3030
* @description Text for command suggestion of run a command
3131
*/
3232
command: 'Command',
33+
/**
34+
* @description Text for help title of run command menu
35+
*/
36+
runCommand: 'Run command',
3337
/**
3438
* @description Hint text to indicate that a selected command is deprecated
3539
*/
@@ -433,8 +437,8 @@ export class ShowActionDelegate implements UI.ActionRegistration.ActionDelegate
433437
registerProvider({
434438
prefix: '>',
435439
iconName: 'chevron-right',
436-
iconWidth: '20px',
437440
provider: () => Promise.resolve(new CommandMenuProvider()),
441+
helpTitle: () => i18nString(UIStrings.runCommand),
438442
titlePrefix: () => i18nString(UIStrings.run),
439443
titleSuggestion: () => i18nString(UIStrings.command),
440444
});

front_end/ui/legacy/components/quick_open/FilteredListWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,8 @@ export function getRegisteredProviders(): ProviderRegistration[] {
667667
export interface ProviderRegistration {
668668
prefix: string;
669669
iconName: string;
670-
iconWidth: string;
671670
provider: () => Promise<Provider>;
671+
helpTitle: (() => string);
672672
titlePrefix: (() => string);
673673
titleSuggestion?: (() => string);
674674
}

front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export class HelpQuickOpen extends Provider {
1212
private providers: {
1313
prefix: string,
1414
iconName: string,
15-
iconWidth: string,
1615
title: string,
1716
jslogContext: string,
1817
}[];
@@ -24,15 +23,12 @@ export class HelpQuickOpen extends Provider {
2423
}
2524

2625
private async addProvider(extension: ProviderRegistration): Promise<void> {
27-
if (extension.titleSuggestion) {
28-
this.providers.push({
29-
prefix: extension.prefix || '',
30-
iconName: extension.iconName,
31-
iconWidth: extension.iconWidth,
32-
title: extension.titlePrefix() + ' ' + extension.titleSuggestion(),
33-
jslogContext: (await extension.provider()).jslogContext,
34-
});
35-
}
26+
this.providers.push({
27+
prefix: extension.prefix || '',
28+
iconName: extension.iconName,
29+
title: extension.helpTitle(),
30+
jslogContext: (await extension.provider()).jslogContext,
31+
});
3632
}
3733

3834
override itemCount(): number {
@@ -54,7 +50,7 @@ export class HelpQuickOpen extends Provider {
5450
iconElement.data = {
5551
iconName: provider.iconName,
5652
color: 'var(--icon-default)',
57-
width: provider.iconWidth,
53+
width: '18px',
5854
};
5955
titleElement.parentElement?.parentElement?.insertBefore(iconElement, titleElement.parentElement);
6056

@@ -79,8 +75,8 @@ export class HelpQuickOpen extends Provider {
7975
registerProvider({
8076
prefix: '?',
8177
iconName: 'help',
82-
iconWidth: '20px',
8378
provider: () => Promise.resolve(new HelpQuickOpen('help')),
79+
helpTitle: () => 'Help',
8480
titlePrefix: () => 'Help',
8581
titleSuggestion: undefined,
8682
});

0 commit comments

Comments
 (0)