File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { default as assert } from 'assert';
77
88// Test the text truncation logic that should be applied to tree view button text
99describe ( 'CompareChangesTreeDataProvider text truncation' , ( ) => {
10- const MAX_BUTTON_TEXT_LENGTH = 40 ; // Same constant used in implementation
10+ const MAX_BUTTON_TEXT_LENGTH = 40 ; // Same constant used in CompareChangesFilesTreeProvider
1111
1212 function truncateButtonText ( buttonText : string ) : string {
1313 return buttonText . length > MAX_BUTTON_TEXT_LENGTH
Original file line number Diff line number Diff line change @@ -208,6 +208,8 @@ abstract class CompareChangesTreeProvider extends Disposable implements vscode.T
208208}
209209
210210class CompareChangesFilesTreeProvider extends CompareChangesTreeProvider {
211+ private static readonly MAX_BUTTON_TEXT_LENGTH = 40 ; // Reasonable length for tree view messages
212+
211213 constructor (
212214 model : CreatePullRequestDataModel ,
213215 private folderRepoManager : FolderRepositoryManager ,
@@ -267,9 +269,8 @@ class CompareChangesFilesTreeProvider extends CompareChangesTreeProvider {
267269
268270 // Create the button text with potential truncation for better UI in smaller panels
269271 const buttonText = vscode . l10n . t ( '$(sparkle) {0} Code Review' , preReviewer . title ) ;
270- const MAX_BUTTON_TEXT_LENGTH = 40 ; // Reasonable length for tree view messages
271- const truncatedButtonText = buttonText . length > MAX_BUTTON_TEXT_LENGTH
272- ? buttonText . substring ( 0 , MAX_BUTTON_TEXT_LENGTH - 3 ) + '...'
272+ const truncatedButtonText = buttonText . length > CompareChangesFilesTreeProvider . MAX_BUTTON_TEXT_LENGTH
273+ ? buttonText . substring ( 0 , CompareChangesFilesTreeProvider . MAX_BUTTON_TEXT_LENGTH - 3 ) + '...'
273274 : buttonText ;
274275
275276 markdown . appendMarkdown ( `[${ truncatedButtonText } ](command:pr.preReview)` ) ;
You can’t perform that action at this time.
0 commit comments