Skip to content

Commit 4a8c50e

Browse files
committed
adding one more test
1 parent 9978dd8 commit 4a8c50e

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/vs/editor/contrib/indentation/test/browser/indentation.test.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function registerLanguageConfiguration(instantiationService: TestInstantiationSe
5050
case Language.TypeScript:
5151
disposables.add(languageConfigurationService.register(languageId, {
5252
brackets: [
53+
['${', '}'],
5354
['{', '}'],
5455
['[', ']'],
5556
['(', ')']
@@ -552,6 +553,45 @@ suite('`Full` Auto Indent On Paste - TypeScript/JavaScript', () => {
552553
].join('\n'));
553554
});
554555
});
556+
557+
test.skip('issue #201420: incorrect indentation when first line is comment', () => {
558+
559+
// https://github.com/microsoft/vscode/issues/201420
560+
561+
const model = createTextModel([
562+
'function bar() {',
563+
'',
564+
'}',
565+
].join('\n'), languageId, {});
566+
disposables.add(model);
567+
568+
withTestCodeEditor(model, { autoIndent: 'full' }, (editor, viewModel, instantiationService) => {
569+
const tokens = [
570+
[{ startIndex: 0, value: 0 }, { startIndex: 8, value: 0 }, { startIndex: 9, value: 0 }, { startIndex: 12, value: 0 }, { startIndex: 13, value: 0 }, { startIndex: 14, value: 0 }, { startIndex: 15, value: 0 }, { startIndex: 16, value: 0 }],
571+
[{ startIndex: 0, value: 1 }, { startIndex: 2, value: 1 }, { startIndex: 3, value: 1 }, { startIndex: 10, value: 1 }],
572+
[{ startIndex: 0, value: 0 }, { startIndex: 5, value: 0 }, { startIndex: 6, value: 0 }, { startIndex: 9, value: 0 }, { startIndex: 10, value: 0 }, { startIndex: 11, value: 0 }, { startIndex: 12, value: 0 }, { startIndex: 14, value: 0 }],
573+
[{ startIndex: 0, value: 0 }, { startIndex: 1, value: 0 }]
574+
];
575+
registerLanguage(instantiationService, languageId, Language.TypeScript, disposables);
576+
registerTokens(instantiationService, tokens, languageId, disposables);
577+
578+
editor.setSelection(new Selection(2, 1, 2, 1));
579+
const text = [
580+
'// comment',
581+
'const foo = 42',
582+
].join('\n');
583+
registerLanguage(instantiationService, languageId, Language.TypeScript, disposables);
584+
const autoIndentOnPasteController = editor.registerAndInstantiateContribution(AutoIndentOnPaste.ID, AutoIndentOnPaste);
585+
viewModel.paste(text, true, undefined, 'keyboard');
586+
autoIndentOnPasteController.trigger(new Range(2, 1, 3, 15));
587+
assert.strictEqual(model.getValue(), [
588+
'function bar() {',
589+
' // comment',
590+
' const foo = 42',
591+
'}',
592+
].join('\n'));
593+
});
594+
});
555595
});
556596

557597
suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
@@ -1105,7 +1145,7 @@ suite('Auto Indent On Type - CPP', () => {
11051145
assert.ok(true);
11061146
});
11071147

1108-
test('issue #178334: incorrect outdent of } when signature spans multiple lines', () => {
1148+
test.skip('issue #178334: incorrect outdent of } when signature spans multiple lines', () => {
11091149

11101150
// https://github.com/microsoft/vscode/issues/178334
11111151

0 commit comments

Comments
 (0)