Skip to content

Commit 4a315a4

Browse files
Copilotalexr00
andcommitted
Final implementation with proper formatting
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 59bb9f0 commit 4a315a4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/test/view/compareChangesTreeDataProvider.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { default as assert } from 'assert';
88
// Test the text truncation logic that should be applied to tree view button text
99
describe('CompareChangesTreeDataProvider text truncation', () => {
1010
const MAX_BUTTON_TEXT_LENGTH = 40; // Same constant used in implementation
11-
11+
1212
function truncateButtonText(buttonText: string): string {
13-
return buttonText.length > MAX_BUTTON_TEXT_LENGTH
13+
return buttonText.length > MAX_BUTTON_TEXT_LENGTH
1414
? buttonText.substring(0, MAX_BUTTON_TEXT_LENGTH - 3) + '...'
1515
: buttonText;
1616
}
@@ -19,7 +19,7 @@ describe('CompareChangesTreeDataProvider text truncation', () => {
1919
it('should truncate long button text with ellipsis', () => {
2020
const longButtonText = '$(sparkle) Very Long Copilot Reviewer Name That Would Cause Overflow Issues Code Review';
2121
const result = truncateButtonText(longButtonText);
22-
22+
2323
assert.strictEqual(result.length, MAX_BUTTON_TEXT_LENGTH);
2424
assert.ok(result.endsWith('...'));
2525
assert.ok(result.includes('$(sparkle)'));
@@ -29,23 +29,23 @@ describe('CompareChangesTreeDataProvider text truncation', () => {
2929
it('should not truncate short button text', () => {
3030
const shortButtonText = '$(sparkle) Copilot Code Review';
3131
const result = truncateButtonText(shortButtonText);
32-
32+
3333
assert.strictEqual(result, shortButtonText);
3434
assert.ok(!result.includes('...'));
3535
});
3636

3737
it('should handle exactly max length text', () => {
3838
const exactLengthText = 'A'.repeat(MAX_BUTTON_TEXT_LENGTH);
3939
const result = truncateButtonText(exactLengthText);
40-
40+
4141
assert.strictEqual(result, exactLengthText);
4242
assert.ok(!result.includes('...'));
4343
});
4444

4545
it('should handle text that is one character over the limit', () => {
4646
const overLimitByOne = 'A'.repeat(MAX_BUTTON_TEXT_LENGTH + 1);
4747
const result = truncateButtonText(overLimitByOne);
48-
48+
4949
assert.strictEqual(result.length, MAX_BUTTON_TEXT_LENGTH);
5050
assert.ok(result.endsWith('...'));
5151
assert.strictEqual(result, 'A'.repeat(MAX_BUTTON_TEXT_LENGTH - 3) + '...');
@@ -54,7 +54,7 @@ describe('CompareChangesTreeDataProvider text truncation', () => {
5454
it('should preserve sparkle icon in truncated text', () => {
5555
const longTextWithIcon = '$(sparkle) ' + 'Very '.repeat(20) + 'Long Code Review';
5656
const result = truncateButtonText(longTextWithIcon);
57-
57+
5858
assert.ok(result.startsWith('$(sparkle)'));
5959
assert.ok(result.endsWith('...'));
6060
assert.strictEqual(result.length, MAX_BUTTON_TEXT_LENGTH);

src/view/compareChangesTreeDataProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ class CompareChangesFilesTreeProvider extends CompareChangesTreeProvider {
264264
markdown.appendMarkdown('\n\n');
265265
}
266266
markdown.supportThemeIcons = true;
267-
267+
268268
// Create the button text with potential truncation for better UI in smaller panels
269269
const buttonText = vscode.l10n.t('$(sparkle) {0} Code Review', preReviewer.title);
270270
const MAX_BUTTON_TEXT_LENGTH = 40; // Reasonable length for tree view messages
271-
const truncatedButtonText = buttonText.length > MAX_BUTTON_TEXT_LENGTH
271+
const truncatedButtonText = buttonText.length > MAX_BUTTON_TEXT_LENGTH
272272
? buttonText.substring(0, MAX_BUTTON_TEXT_LENGTH - 3) + '...'
273273
: buttonText;
274-
274+
275275
markdown.appendMarkdown(`[${truncatedButtonText}](command:pr.preReview)`);
276276
return markdown;
277277
}

0 commit comments

Comments
 (0)