Skip to content

Commit 55d8d97

Browse files
authored
testing: fix default size of inline peek diff (microsoft#187072)
* testing: fix default size of inline peek diff Fixes microsoft#185331 * rm unused import
1 parent 1157e96 commit 55d8d97

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { Iterable } from 'vs/base/common/iterator';
2626
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
2727
import { Lazy } from 'vs/base/common/lazy';
2828
import { Disposable, DisposableStore, IDisposable, IReference, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
29-
import { clamp } from 'vs/base/common/numbers';
3029
import { count } from 'vs/base/common/strings';
3130
import { ThemeIcon } from 'vs/base/common/themables';
3231
import { URI } from 'vs/base/common/uri';
@@ -520,8 +519,8 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
520519
* Shows a peek for the message in the editor.
521520
*/
522521
public async show(uri: URI) {
523-
const subjecet = this.retrieveTest(uri);
524-
if (!subjecet) {
522+
const subject = this.retrieveTest(uri);
523+
if (!subject) {
525524
return;
526525
}
527526

@@ -537,12 +536,12 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
537536
this.peek.value!.create();
538537
}
539538

540-
if (subjecet instanceof MessageSubject) {
541-
const message = subjecet.messages[subjecet.messageIndex];
539+
if (subject instanceof MessageSubject) {
540+
const message = subject.messages[subject.messageIndex];
542541
alert(renderStringAsPlaintext(message.message));
543542
}
544543

545-
this.peek.value.setModel(subjecet);
544+
this.peek.value.setModel(subject);
546545
this.currentPeekUri = uri;
547546
}
548547

@@ -1022,7 +1021,7 @@ const diffEditorOptions: IDiffEditorConstructionOptions = {
10221021
diffAlgorithm: 'advanced',
10231022
};
10241023

1025-
const isDiffable = (message: ITestMessage): message is ITestErrorMessage & { actualOutput: string; expectedOutput: string } =>
1024+
const isDiffable = (message: ITestMessage): message is ITestErrorMessage & { actual: string; expected: string } =>
10261025
message.type === TestMessageType.Error && message.actual !== undefined && message.expected !== undefined;
10271026

10281027
class DiffContentProvider extends Disposable implements IPeekOutputRenderer {
@@ -1381,8 +1380,9 @@ const firstLine = (str: string) => {
13811380
};
13821381

13831382
const isMultiline = (str: string | undefined) => !!str && str.includes('\n');
1384-
const hintPeekStrHeight = (str: string | undefined) =>
1385-
clamp(str ? Math.max(count(str, '\n'), Math.ceil(str.length / 80)) + 3 : 0, 14, 24);
1383+
1384+
// add 5ish lines for the size of the title and decorations in the peek.
1385+
const hintPeekStrHeight = (str: string) => Math.min(count(str, '\n') + 5, 24);
13861386

13871387
class SimpleDiffEditorModel extends EditorModel {
13881388
public readonly original = this._original.object.textEditorModel;

0 commit comments

Comments
 (0)