Fixes #115148: Indent new line when using `IndentOutdent` and `appendText`
parent
e4f1833d79
commit
ff27ea9437
|
@ -729,7 +729,7 @@ export class LanguageConfigurationRegistryImpl {
|
|||
} else {
|
||||
appendText = '';
|
||||
}
|
||||
} else if (indentAction === IndentAction.Indent) {
|
||||
} else if (indentAction === IndentAction.Indent || indentAction === IndentAction.IndentOutdent) {
|
||||
appendText = '\t' + appendText;
|
||||
}
|
||||
|
||||
|
|
|
@ -2812,6 +2812,38 @@ suite('Editor Controller - Cursor Configuration', () => {
|
|||
mode.dispose();
|
||||
});
|
||||
|
||||
test('issue #115148: indentOutdent and appendText', () => {
|
||||
const mode = new class extends MockMode {
|
||||
constructor() {
|
||||
super(new LanguageIdentifier('onEnterMode', 3));
|
||||
this._register(LanguageConfigurationRegistry.register(this.getLanguageIdentifier(), {
|
||||
onEnterRules: [{
|
||||
beforeText: /.*/,
|
||||
action: {
|
||||
indentAction: IndentAction.IndentOutdent,
|
||||
appendText: 'x'
|
||||
}
|
||||
}]
|
||||
}));
|
||||
}
|
||||
}();
|
||||
usingCursor({
|
||||
text: [
|
||||
'text {}'
|
||||
],
|
||||
languageIdentifier: mode.getLanguageIdentifier(),
|
||||
}, (editor, model, viewModel) => {
|
||||
|
||||
moveTo(editor, viewModel, 1, 7);
|
||||
viewModel.type('\n', 'keyboard');
|
||||
assert.strictEqual(model.getLineContent(1), 'text {');
|
||||
assert.strictEqual(model.getLineContent(2), ' x');
|
||||
assert.strictEqual(model.getLineContent(3), '}');
|
||||
assertCursor(viewModel, new Position(2, 6));
|
||||
});
|
||||
mode.dispose();
|
||||
});
|
||||
|
||||
test('issue #6862: Editor removes auto inserted indentation when formatting on type', () => {
|
||||
let mode = new OnEnterMode(IndentAction.IndentOutdent);
|
||||
usingCursor({
|
||||
|
|
Loading…
Reference in New Issue