mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Added test
This commit is contained in:
parent
cd4023e59e
commit
162f221b78
|
@ -265,3 +265,54 @@ suite('Editor Contrib - Auto Indent On Paste', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
suite('Editor Contrib - Keep Indent On Paste', () => {
|
||||
let disposables: DisposableStore;
|
||||
|
||||
setup(() => {
|
||||
disposables = new DisposableStore();
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
disposables.dispose();
|
||||
});
|
||||
|
||||
test('issue #167299: Blank line removes indent', () => {
|
||||
const languageId = 'blankLineRemovesIndent';
|
||||
const model = createTextModel("", languageId, {});
|
||||
disposables.add(model);
|
||||
withTestCodeEditor(model, { autoIndent: 'full' }, (editor, viewModel, instantiationService) => {
|
||||
const languageService = instantiationService.get(ILanguageService);
|
||||
const languageConfigurationService = instantiationService.get(ILanguageConfigurationService);
|
||||
disposables.add(languageService.registerLanguage({ id: languageId }));
|
||||
disposables.add(languageConfigurationService.register(languageId, {
|
||||
brackets: [
|
||||
['{', '}'],
|
||||
['[', ']'],
|
||||
['(', ')']
|
||||
],
|
||||
indentationRules: javascriptIndentationRules,
|
||||
onEnterRules: javascriptOnEnterRules
|
||||
}));
|
||||
|
||||
const autoIndentOnPasteController = editor.registerAndInstantiateContribution(AutoIndentOnPaste.ID, AutoIndentOnPaste);
|
||||
const pasteText = [
|
||||
'',
|
||||
'export type IncludeReference =',
|
||||
' | BaseReference',
|
||||
' | SelfReference',
|
||||
' | RelativeReference;',
|
||||
'',
|
||||
'export const enum IncludeReferenceKind {',
|
||||
' Base,',
|
||||
' Self,',
|
||||
' RelativeReference,',
|
||||
'}'
|
||||
].join('\n');
|
||||
|
||||
viewModel.paste(pasteText, true, undefined, 'keyboard');
|
||||
autoIndentOnPasteController.trigger(new Range(1, 1, 11, 2));
|
||||
assert.strictEqual(model.getValue(), pasteText);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue