@@ -845,158 +845,6 @@ suite('Auto Indent On Type - TypeScript/JavaScript', () => {
845
845
} ) ;
846
846
} ) ;
847
847
848
- // Failing tests...
849
-
850
- test ( 'issue #43244: indent when lambda arrow function is detected, outdent when end is reached' , ( ) => {
851
-
852
- // https://github.com/microsoft/vscode/issues/43244
853
-
854
- const model = createTextModel ( [
855
- 'const array = [1, 2, 3, 4, 5];' ,
856
- 'array.map(_)'
857
- ] . join ( '\n' ) , languageId , { } ) ;
858
- disposables . add ( model ) ;
859
-
860
- withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
861
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
862
- editor . setSelection ( new Selection ( 2 , 12 , 2 , 12 ) ) ;
863
- viewModel . type ( "\n" , 'keyboard' ) ;
864
- assert . strictEqual ( model . getValue ( ) , [
865
- 'const array = [1, 2, 3, 4, 5];' ,
866
- 'array.map(_' ,
867
- ' ' ,
868
- ')'
869
- ] . join ( '\n' ) ) ;
870
- } ) ;
871
- } ) ;
872
-
873
- test ( 'issue #43244: incorrect indentation after if/for/while without braces' , ( ) => {
874
-
875
- // https://github.com/microsoft/vscode/issues/43244
876
-
877
- const model = createTextModel ( [
878
- 'function f() {' ,
879
- ' if (condition)' ,
880
- '}'
881
- ] . join ( '\n' ) , languageId , { } ) ;
882
- disposables . add ( model ) ;
883
-
884
- withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
885
-
886
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
887
- editor . setSelection ( new Selection ( 2 , 19 , 2 , 19 ) ) ;
888
- viewModel . type ( "\n" , 'keyboard' ) ;
889
- assert . strictEqual ( model . getValue ( ) , [
890
- 'function f() {' ,
891
- ' if (condition)' ,
892
- ' ' ,
893
- '}' ,
894
- ] . join ( '\n' ) ) ;
895
-
896
- viewModel . type ( "return;" ) ;
897
- viewModel . type ( "\n" , 'keyboard' ) ;
898
- assert . strictEqual ( model . getValue ( ) , [
899
- 'function f() {' ,
900
- ' if (condition)' ,
901
- ' return;' ,
902
- ' ' ,
903
- '}' ,
904
- ] . join ( '\n' ) ) ;
905
- } ) ;
906
- } ) ;
907
-
908
- // Failing tests...
909
-
910
- test ( 'issue #29755: do not add indentation on enter if indentation is already valid' , ( ) => {
911
-
912
- //https://github.com/microsoft/vscode/issues/29755
913
-
914
- const model = createTextModel ( [
915
- 'function f() {' ,
916
- ' const one = 1;' ,
917
- ' const two = 2;' ,
918
- '}' ,
919
- ] . join ( '\n' ) , languageId , { } ) ;
920
- disposables . add ( model ) ;
921
-
922
- withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
923
-
924
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
925
- editor . setSelection ( new Selection ( 3 , 1 , 3 , 1 ) ) ;
926
- viewModel . type ( '\n' , 'keyboard' ) ;
927
- assert . strictEqual ( model . getValue ( ) , [
928
- 'function f() {' ,
929
- ' const one = 1;' ,
930
- '' ,
931
- ' const two = 2;' ,
932
- '}' ,
933
- ] . join ( '\n' ) ) ;
934
- } ) ;
935
- } ) ;
936
-
937
- test ( 'issue #36090' , ( ) => {
938
-
939
- // https://github.com/microsoft/vscode/issues/36090
940
-
941
- const model = createTextModel ( [
942
- 'class ItemCtrl {' ,
943
- ' getPropertiesByItemId(id) {' ,
944
- ' return this.fetchItem(id)' ,
945
- ' .then(item => {' ,
946
- ' return this.getPropertiesOfItem(item);' ,
947
- ' });' ,
948
- ' }' ,
949
- '}' ,
950
- ] . join ( '\n' ) , languageId , { } ) ;
951
- disposables . add ( model ) ;
952
-
953
- withTestCodeEditor ( model , { autoIndent : 'advanced' } , ( editor , viewModel , instantiationService ) => {
954
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
955
- editor . setSelection ( new Selection ( 7 , 6 , 7 , 6 ) ) ;
956
- viewModel . type ( '\n' , 'keyboard' ) ;
957
- assert . strictEqual ( model . getValue ( ) ,
958
- [
959
- 'class ItemCtrl {' ,
960
- ' getPropertiesByItemId(id) {' ,
961
- ' return this.fetchItem(id)' ,
962
- ' .then(item => {' ,
963
- ' return this.getPropertiesOfItem(item);' ,
964
- ' });' ,
965
- ' }' ,
966
- ' ' ,
967
- '}' ,
968
- ] . join ( '\n' )
969
- ) ;
970
- assert . deepStrictEqual ( editor . getSelection ( ) , new Selection ( 8 , 5 , 8 , 5 ) ) ;
971
- } ) ;
972
- } ) ;
973
-
974
- test ( 'issue #115304: indent block comment onEnter' , ( ) => {
975
-
976
- // https://github.com/microsoft/vscode/issues/115304
977
-
978
- const model = createTextModel ( [
979
- '/** */' ,
980
- 'function f() {}' ,
981
- ] . join ( '\n' ) , languageId , { } ) ;
982
- disposables . add ( model ) ;
983
-
984
- withTestCodeEditor ( model , { autoIndent : 'advanced' } , ( editor , viewModel , instantiationService ) => {
985
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
986
- editor . setSelection ( new Selection ( 1 , 4 , 1 , 4 ) ) ;
987
- viewModel . type ( '\n' , 'keyboard' ) ;
988
- assert . strictEqual ( model . getValue ( ) ,
989
- [
990
- '/**' ,
991
- ' * ' ,
992
- ' */' ,
993
- 'function f() {}' ,
994
- ] . join ( '\n' )
995
- ) ;
996
- assert . deepStrictEqual ( editor . getSelection ( ) , new Selection ( 2 , 4 , 2 , 4 ) ) ;
997
- } ) ;
998
- } ) ;
999
-
1000
848
test ( 'issue #43244: indent when lambda arrow function is detected, outdent when end is reached' , ( ) => {
1001
849
1002
850
// https://github.com/microsoft/vscode/issues/43244
@@ -1057,63 +905,6 @@ suite('Auto Indent On Type - TypeScript/JavaScript', () => {
1057
905
1058
906
// Failing tests...
1059
907
1060
- test . skip ( 'issue #40115: keep indentation when added' , ( ) => {
1061
-
1062
- // https://github.com/microsoft/vscode/issues/40115
1063
-
1064
- const model = createTextModel ( 'function foo() {}' , languageId , { } ) ;
1065
- disposables . add ( model ) ;
1066
-
1067
- withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
1068
-
1069
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
1070
-
1071
- editor . setSelection ( new Selection ( 1 , 17 , 1 , 17 ) ) ;
1072
- viewModel . type ( "\n" , 'keyboard' ) ;
1073
- assert . strictEqual ( model . getValue ( ) , [
1074
- 'function foo() {' ,
1075
- ' ' ,
1076
- '}' ,
1077
- ] . join ( '\n' ) ) ;
1078
- editor . setSelection ( new Selection ( 2 , 5 , 2 , 5 ) ) ;
1079
- viewModel . type ( "\n" , 'keyboard' ) ;
1080
- assert . strictEqual ( model . getValue ( ) , [
1081
- 'function foo() {' ,
1082
- ' ' ,
1083
- ' ' ,
1084
- '}' ,
1085
- ] . join ( '\n' ) ) ;
1086
- } ) ;
1087
- } ) ;
1088
-
1089
- test . skip ( 'issue #193875: incorrect indentation on enter' , ( ) => {
1090
-
1091
- // https://github.com/microsoft/vscode/issues/193875
1092
-
1093
- const model = createTextModel ( [
1094
- '{' ,
1095
- ' for(;;)' ,
1096
- ' for(;;) {}' ,
1097
- '}' ,
1098
- ] . join ( '\n' ) , languageId , { } ) ;
1099
- disposables . add ( model ) ;
1100
-
1101
- withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
1102
-
1103
- registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
1104
- editor . setSelection ( new Selection ( 3 , 14 , 3 , 14 ) ) ;
1105
- viewModel . type ( "\n" , 'keyboard' ) ;
1106
- assert . strictEqual ( model . getValue ( ) , [
1107
- '{' ,
1108
- ' for(;;)' ,
1109
- ' for(;;) {' ,
1110
- ' ' ,
1111
- ' }' ,
1112
- '}' ,
1113
- ] . join ( '\n' ) ) ;
1114
- } ) ;
1115
- } ) ;
1116
-
1117
908
test . skip ( 'issue #208232: incorrect indentation inside of comments' , ( ) => {
1118
909
1119
910
// https://github.com/microsoft/vscode/issues/208232
@@ -1288,6 +1079,63 @@ suite('Auto Indent On Type - TypeScript/JavaScript', () => {
1288
1079
} ) ;
1289
1080
1290
1081
1082
+ test . skip ( 'issue #40115: keep indentation when added' , ( ) => {
1083
+
1084
+ // https://github.com/microsoft/vscode/issues/40115
1085
+
1086
+ const model = createTextModel ( 'function foo() {}' , languageId , { } ) ;
1087
+ disposables . add ( model ) ;
1088
+
1089
+ withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
1090
+
1091
+ registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
1092
+
1093
+ editor . setSelection ( new Selection ( 1 , 17 , 1 , 17 ) ) ;
1094
+ viewModel . type ( "\n" , 'keyboard' ) ;
1095
+ assert . strictEqual ( model . getValue ( ) , [
1096
+ 'function foo() {' ,
1097
+ ' ' ,
1098
+ '}' ,
1099
+ ] . join ( '\n' ) ) ;
1100
+ editor . setSelection ( new Selection ( 2 , 5 , 2 , 5 ) ) ;
1101
+ viewModel . type ( "\n" , 'keyboard' ) ;
1102
+ assert . strictEqual ( model . getValue ( ) , [
1103
+ 'function foo() {' ,
1104
+ ' ' ,
1105
+ ' ' ,
1106
+ '}' ,
1107
+ ] . join ( '\n' ) ) ;
1108
+ } ) ;
1109
+ } ) ;
1110
+
1111
+ test . skip ( 'issue #193875: incorrect indentation on enter' , ( ) => {
1112
+
1113
+ // https://github.com/microsoft/vscode/issues/193875
1114
+
1115
+ const model = createTextModel ( [
1116
+ '{' ,
1117
+ ' for(;;)' ,
1118
+ ' for(;;) {}' ,
1119
+ '}' ,
1120
+ ] . join ( '\n' ) , languageId , { } ) ;
1121
+ disposables . add ( model ) ;
1122
+
1123
+ withTestCodeEditor ( model , { autoIndent : "full" } , ( editor , viewModel , instantiationService ) => {
1124
+
1125
+ registerLanguage ( instantiationService , languageId , Language . TypeScript , disposables ) ;
1126
+ editor . setSelection ( new Selection ( 3 , 14 , 3 , 14 ) ) ;
1127
+ viewModel . type ( "\n" , 'keyboard' ) ;
1128
+ assert . strictEqual ( model . getValue ( ) , [
1129
+ '{' ,
1130
+ ' for(;;)' ,
1131
+ ' for(;;) {' ,
1132
+ ' ' ,
1133
+ ' }' ,
1134
+ '}' ,
1135
+ ] . join ( '\n' ) ) ;
1136
+ } ) ;
1137
+ } ) ;
1138
+
1291
1139
// Add tests for:
1292
1140
// https://github.com/microsoft/vscode/issues/88638
1293
1141
// https://github.com/microsoft/vscode/issues/63388
0 commit comments