@@ -75,6 +75,7 @@ define(function (require, exports, module) {
7575 name : $tab . find ( '.tab-name' ) . text ( ) ,
7676 isActive : $tab . hasClass ( 'active' ) ,
7777 isDirty : $tab . hasClass ( 'dirty' ) ,
78+ isPlaceholder : $tab . hasClass ( 'placeholder' ) ,
7879 $icon : $tab . find ( '.tab-icon' ) . clone ( )
7980 } ;
8081
@@ -148,17 +149,22 @@ define(function (require, exports, module) {
148149 <i class="fa-solid fa-times"></i>
149150 </span>` ;
150151
152+ // add placeholder class to style it differently
153+ const placeholderClass = item . isPlaceholder ? ' placeholder-name' : '' ;
154+
151155 // return html for this item
152156 return {
153157 html :
154- `<div class="dropdown-tab-item" data-tab-path="${ item . path } ">
155- <div class="tab-info-container">
156- ${ dirtyHtml }
157- <span class="tab-icon-container">${ iconHtml } </span>
158- <span class="tab-name-container">${ item . name } </span>
159- </div>
160- ${ closeIconHtml }
161- </div>` ,
158+ `<div class="dropdown-tab-item${ item . isPlaceholder
159+ ? ' placeholder-item' : ''
160+ } " data-tab-path="${ item . path } ">
161+ <div class="tab-info-container">
162+ ${ dirtyHtml }
163+ <span class="tab-icon-container">${ iconHtml } </span>
164+ <span class="tab-name-container${ placeholderClass } ">${ item . name } </span>
165+ </div>
166+ ${ closeIconHtml }
167+ </div>` ,
162168 enabled : true
163169 } ;
164170 } ) ;
@@ -223,6 +229,14 @@ define(function (require, exports, module) {
223229 // Set the active pane and open the file
224230 MainViewManager . setActivePaneId ( paneId ) ;
225231 CommandManager . execute ( Commands . FILE_OPEN , { fullPath : filePath } ) ;
232+
233+ // get the tab bar element based on paneId and scroll to the active tab
234+ // we use setTimeout to ensure that the DOM has updated after the file open command
235+ setTimeout ( function ( ) {
236+ const $tabBarElement = paneId === "first-pane" ?
237+ $ ( "#phoenix-tab-bar" ) : $ ( "#phoenix-tab-bar-2" ) ;
238+ scrollToActiveTab ( $tabBarElement ) ;
239+ } , 100 ) ;
226240 }
227241 } ) ;
228242
0 commit comments