@@ -12,6 +12,7 @@ import * as SDK from '../../core/sdk/sdk.js';
1212import * as Bindings from '../../models/bindings/bindings.js' ;
1313import * as Persistence from '../../models/persistence/persistence.js' ;
1414import * as Workspace from '../../models/workspace/workspace.js' ;
15+ import * as IconButton from '../../ui/components/icon_button/icon_button.js' ;
1516import * as QuickOpen from '../../ui/legacy/components/quick_open/quick_open.js' ;
1617import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js' ;
1718import * as UI from '../../ui/legacy/legacy.js' ;
@@ -145,45 +146,53 @@ export class SourcesView extends Common.ObjectWrapper.eventMixin<EventTypes, typ
145146 }
146147
147148 private placeholderElement ( ) : Element {
149+ const placeholder = document . createElement ( 'div' ) ;
150+
151+ const workspaceElement = placeholder . createChild ( 'div' , 'tabbed-pane-placeholder-row' ) ;
152+ workspaceElement . classList . add ( 'workspace' ) ;
153+
154+ const icon = IconButton . Icon . create ( 'sync' , 'sync-icon' ) ;
155+ workspaceElement . createChild ( 'span' , 'icon-container' ) . appendChild ( icon ) ;
156+ const text = workspaceElement . createChild ( 'span' ) ;
157+ text . textContent = UIStrings . workspaceDropInAFolderToSyncSources ;
158+ const browseButton = text . createChild ( 'button' ) ;
159+ browseButton . textContent = i18nString ( UIStrings . selectFolder ) ;
160+ browseButton . addEventListener ( 'click' , this . addFileSystemClicked . bind ( this ) ) ;
161+
148162 const shortcuts = [
149163 { actionId : 'quick-open.show' , description : i18nString ( UIStrings . openFile ) } ,
150164 { actionId : 'quick-open.show-command-menu' , description : i18nString ( UIStrings . runCommand ) } ,
151- {
152- actionId : 'sources.add-folder-to-workspace' ,
153- description : i18nString ( UIStrings . workspaceDropInAFolderToSyncSources ) ,
154- isWorkspace : true ,
155- } ,
156165 ] ;
157166
158- const list = document . createElement ( 'div' ) ;
167+ const list = placeholder . createChild ( 'div' , 'shortcuts-list' ) ;
168+ list . classList . add ( 'tabbed-pane-placeholder-row' ) ;
159169 UI . ARIAUtils . markAsList ( list ) ;
160170 UI . ARIAUtils . setLabel ( list , i18nString ( UIStrings . sourceViewActions ) ) ;
161171
162172 for ( const shortcut of shortcuts ) {
163- const shortcutKeyText = UI . ShortcutRegistry . ShortcutRegistry . instance ( ) . shortcutTitleForAction ( shortcut . actionId ) ;
164- const listItemElement = list . createChild ( 'div' , 'tabbed-pane-placeholder-row' ) ;
173+ const shortcutKeys = UI . ShortcutRegistry . ShortcutRegistry . instance ( ) . shortcutsForAction ( shortcut . actionId ) ;
174+ const listItemElement = list . createChild ( 'div' ) ;
175+ listItemElement . classList . add ( 'shortcut-line' ) ;
176+
165177 UI . ARIAUtils . markAsListitem ( listItemElement ) ;
166- if ( shortcutKeyText ) {
167- const title = listItemElement . createChild ( 'span' ) ;
168- title . textContent = shortcutKeyText ;
169178
179+ // Take the first shortcut for display.
180+ if ( shortcutKeys && shortcutKeys [ 0 ] ) {
170181 const button = listItemElement . createChild ( 'button' ) ;
171182 button . textContent = shortcut . description ;
172183 const action = UI . ActionRegistry . ActionRegistry . instance ( ) . getAction ( shortcut . actionId ) ;
173184 button . addEventListener ( 'click' , ( ) => action . execute ( ) ) ;
174- }
175-
176- if ( shortcut . isWorkspace ) {
177- const workspace = listItemElement . createChild ( 'span' , 'workspace' ) ;
178- workspace . textContent = shortcut . description ;
179185
180- const browseButton = workspace . createChild ( 'button' ) ;
181- browseButton . textContent = i18nString ( UIStrings . selectFolder ) ;
182- browseButton . addEventListener ( 'click' , this . addFileSystemClicked . bind ( this ) ) ;
186+ const shortcutElement = listItemElement . createChild ( 'span' , 'shortcuts' ) ;
187+ const separator = Host . Platform . isMac ( ) ? '\u2004' : ' + ' ;
188+ const keys = shortcutKeys [ 0 ] . descriptors . flatMap ( descriptor => descriptor . name . split ( separator ) ) ;
189+ keys . forEach ( key => {
190+ shortcutElement . createChild ( 'span' , 'keybinds-key' ) . createChild ( 'span' ) . textContent = key ;
191+ } ) ;
183192 }
184193 }
185194
186- return list ;
195+ return placeholder ;
187196 }
188197
189198 private async addFileSystemClicked ( ) : Promise < void > {
0 commit comments