@@ -732,6 +732,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
732
732
// issue: Should indent after an equal sign is detected followed by whitespace characters.
733
733
// This should be outdented when a semi-colon is detected indicating the end of the assignment.
734
734
735
+ // TODO: requires exploring indent/outdent pairs instead
736
+
735
737
const model = createTextModel ( [
736
738
'const array ='
737
739
] . join ( '\n' ) , languageId , { } ) ;
@@ -753,6 +755,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
753
755
// https://github.com/microsoft/vscode/issues/43244
754
756
// issue: When a dot is written, we should detect that this is a method call and indent accordingly
755
757
758
+ // TODO: requires exploring indent/outdent pairs instead
759
+
756
760
const model = createTextModel ( [
757
761
'const array = [1, 2, 3];' ,
758
762
'array.'
@@ -776,6 +780,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
776
780
// https://github.com/microsoft/vscode/issues/43244
777
781
// issue: When a dot is written, we should detect that this is a method call and indent accordingly
778
782
783
+ // TODO: requires exploring indent/outdent pairs instead
784
+
779
785
const model = createTextModel ( [
780
786
'const array = [1, 2, 3]' ,
781
787
] . join ( '\n' ) , languageId , { } ) ;
@@ -798,6 +804,8 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
798
804
// https://github.com/microsoft/vscode/issues/43244
799
805
// Currently passes, but should pass with all the tests above too
800
806
807
+ // TODO: requires exploring indent/outdent pairs instead
808
+
801
809
const model = createTextModel ( [
802
810
'const array = [1, 2, 3]' ,
803
811
' .filter(() => true)'
@@ -816,10 +824,38 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
816
824
} ) ;
817
825
} ) ;
818
826
827
+ test . skip ( 'issue #43244: keep indentation when chained methods called on object/array' , ( ) => {
828
+
829
+ // https://github.com/microsoft/vscode/issues/43244
830
+ // When the call chain is not finished yet, and we type a dot, we do not want to change the indentation
831
+
832
+ // TODO: requires exploring indent/outdent pairs instead
833
+
834
+ const model = createTextModel ( [
835
+ 'const array = [1, 2, 3]' ,
836
+ ' .filter(() => true)' ,
837
+ ' '
838
+ ] . join ( '\n' ) , languageId , { } ) ;
839
+ disposables . add ( model ) ;
840
+
841
+ withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
842
+ registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
843
+ editor . setSelection ( new Selection ( 3 , 5 , 3 , 5 ) ) ;
844
+ viewModel . type ( "." ) ;
845
+ assert . strictEqual ( model . getValue ( ) , [
846
+ 'const array = [1, 2, 3]' ,
847
+ ' .filter(() => true)' ,
848
+ ' .' // here we don't want to increase the indentation because we have chained methods
849
+ ] . join ( '\n' ) ) ;
850
+ } ) ;
851
+ } ) ;
852
+
819
853
test . skip ( 'issue #43244: outdent when a semi-color is detected indicating the end of the assignment' , ( ) => {
820
854
821
855
// https://github.com/microsoft/vscode/issues/43244
822
856
857
+ // TODO: requires exploring indent/outdent pairs instead
858
+
823
859
const model = createTextModel ( [
824
860
'const array = [1, 2, 3]' ,
825
861
' .filter(() => true);'
@@ -844,17 +880,17 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => {
844
880
845
881
const model = createTextModel ( [
846
882
'const array = [1, 2, 3, 4, 5];' ,
847
- 'array.map(v => )'
883
+ 'array.map(_ )'
848
884
] . join ( '\n' ) , languageId , { } ) ;
849
885
disposables . add ( model ) ;
850
886
851
887
withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
852
888
registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
853
- editor . setSelection ( new Selection ( 2 , 15 , 2 , 15 ) ) ;
889
+ editor . setSelection ( new Selection ( 2 , 12 , 2 , 12 ) ) ;
854
890
viewModel . type ( "\n" , 'keyboard' ) ;
855
891
assert . strictEqual ( model . getValue ( ) , [
856
892
'const array = [1, 2, 3, 4, 5];' ,
857
- 'array.map(v => ' ,
893
+ 'array.map(_ ' ,
858
894
' ' ,
859
895
')'
860
896
] . join ( '\n' ) ) ;
0 commit comments