Skip to content

Commit 5db2785

Browse files
committed
adding a todo and one more test
1 parent e5515ac commit 5db2785

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
741741
// issue: Should indent after an equal sign is detected followed by whitespace characters.
742742
// This should be outdented when a semi-colon is detected indicating the end of the assignment.
743743

744+
// TODO: requires exploring indent/outdent pairs instead
745+
744746
const model = createTextModel([
745747
'const array ='
746748
].join('\n'), languageId, {});
@@ -762,6 +764,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
762764
// https://github.com/microsoft/vscode/issues/43244
763765
// issue: When a dot is written, we should detect that this is a method call and indent accordingly
764766

767+
// TODO: requires exploring indent/outdent pairs instead
768+
765769
const model = createTextModel([
766770
'const array = [1, 2, 3];',
767771
'array.'
@@ -785,6 +789,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
785789
// https://github.com/microsoft/vscode/issues/43244
786790
// issue: When a dot is written, we should detect that this is a method call and indent accordingly
787791

792+
// TODO: requires exploring indent/outdent pairs instead
793+
788794
const model = createTextModel([
789795
'const array = [1, 2, 3]',
790796
].join('\n'), languageId, {});
@@ -807,6 +813,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
807813
// https://github.com/microsoft/vscode/issues/43244
808814
// Currently passes, but should pass with all the tests above too
809815

816+
// TODO: requires exploring indent/outdent pairs instead
817+
810818
const model = createTextModel([
811819
'const array = [1, 2, 3]',
812820
' .filter(() => true)'
@@ -825,10 +833,38 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
825833
});
826834
});
827835

836+
test.skip('issue #43244: keep indentation when chained methods called on object/array', () => {
837+
838+
// https://github.com/microsoft/vscode/issues/43244
839+
// When the call chain is not finished yet, and we type a dot, we do not want to change the indentation
840+
841+
// TODO: requires exploring indent/outdent pairs instead
842+
843+
const model = createTextModel([
844+
'const array = [1, 2, 3]',
845+
' .filter(() => true)',
846+
' '
847+
].join('\n'), languageId, {});
848+
disposables.add(model);
849+
850+
withTestCodeEditor(model, { autoIndent: "full" }, (editor, viewModel, instantiationService) => {
851+
registerLanguage(instantiationService, languageId, Language.TypeScript, disposables);
852+
editor.setSelection(new Selection(3, 5, 3, 5));
853+
viewModel.type(".");
854+
assert.strictEqual(model.getValue(), [
855+
'const array = [1, 2, 3]',
856+
' .filter(() => true)',
857+
' .' // here we don't want to increase the indentation because we have chained methods
858+
].join('\n'));
859+
});
860+
});
861+
828862
test.skip('issue #43244: outdent when a semi-color is detected indicating the end of the assignment', () => {
829863

830864
// https://github.com/microsoft/vscode/issues/43244
831865

866+
// TODO: requires exploring indent/outdent pairs instead
867+
832868
const model = createTextModel([
833869
'const array = [1, 2, 3]',
834870
' .filter(() => true);'

src/vs/workbench/contrib/codeEditor/test/node/autoindent.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,8 @@ suite('Auto-Reindentation - TypeScript/JavaScript', () => {
282282
// related: https://github.com/microsoft/vscode/issues/43244
283283
// explanation: When you have an arrow function, you don't have { or }, but you would expect indentation to still be done in that way
284284

285-
/*
286-
Notes: Currently the reindent edit operations does not call the onEnter rules
287-
The reindent should also call the onEnter rules to get the correct indentation
288-
*/
285+
// TODO: requires exploring indent/outdent pairs instead
286+
289287
const fileContents = [
290288
'const add1 = (n) =>',
291289
' n + 1;',

0 commit comments

Comments
 (0)