@@ -2282,7 +2282,7 @@ suite('Editor Controller - Cursor Configuration', () => {
22822282suite ( 'Editor Controller - Indentation Rules' , ( ) => {
22832283 let mode = new IndentRulesMode ( {
22842284 decreaseIndentPattern : / ^ \s * ( (? ! \S .* \/ [ * ] ) .* [ * ] \/ \s * ) ? [ } ) \] ] | ^ \s * ( c a s e \b .* | d e f a u l t ) : \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ / ,
2285- increaseIndentPattern : / ( \{ [ ^ } " ' ` ] * | \( [ ^ ) " ' ] * | \[ [ ^ \] " ' ] * | ^ \s * ( \{ \} | \( \) | \[ \] | ( c a s e \b .* | d e f a u l t ) : ) ) \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ / ,
2285+ increaseIndentPattern : / ^ ( (? ! \/ \/ ) . ) * ( \{ [ ^ } " ' ` ] * | \( [ ^ ) " ' ] * | \[ [ ^ \] " ' ] * | ^ \s * ( \{ \} | \( \) | \[ \] | ( c a s e \b .* | d e f a u l t ) : ) ) \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ / ,
22862286 indentNextLinePattern : / ^ \s * ( f o r | w h i l e | i f | e l s e ) \b (? ! .* [ ; { } ] \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ ) / ,
22872287 unIndentedLinePattern : / ^ (? ! .* ( [ ; { } ] | \S : ) \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ ) (? ! .* ( \{ [ ^ } " ' ] * | \( [ ^ ) " ' ] * | \[ [ ^ \] " ' ] * | ^ \s * ( \{ \} | \( \) | \[ \] | ( c a s e \b .* | d e f a u l t ) : ) ) \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ ) (? ! ^ \s * ( (? ! \S .* \/ [ * ] ) .* [ * ] \/ \s * ) ? [ } ) \] ] | ^ \s * ( c a s e \b .* | d e f a u l t ) : \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ ) (? ! ^ \s * ( f o r | w h i l e | i f | e l s e ) \b (? ! .* [ ; { } ] \s * ( \/ \/ .* | \/ [ * ] .* [ * ] \/ \s * ) ? $ ) ) /
22882288 } ) ;
@@ -3080,6 +3080,26 @@ suite('Editor Controller - Indentation Rules', () => {
30803080 assert . equal ( model . getLineContent ( 2 ) , '\t ) {' , 'This line should not decrease indent' ) ;
30813081 } ) ;
30823082 } ) ;
3083+
3084+ test ( 'bug 29972: if a line is line comment, open bracket should not indent next line' , ( ) => {
3085+ usingCursor ( {
3086+ text : [
3087+ 'if (true) {' ,
3088+ '\t// {' ,
3089+ '\t\t'
3090+ ] ,
3091+ languageIdentifier : mode . getLanguageIdentifier ( ) ,
3092+ modelOpts : { insertSpaces : false , tabSize : 4 , detectIndentation : false , defaultEOL : DefaultEndOfLine . LF , trimAutoWhitespace : true } ,
3093+ editorOpts : { autoIndent : true }
3094+ } , ( model , cursor ) => {
3095+ moveTo ( cursor , 3 , 3 , false ) ;
3096+ assertCursor ( cursor , new Selection ( 3 , 3 , 3 , 3 ) ) ;
3097+
3098+ cursorCommand ( cursor , H . Type , { text : '}' } , 'keyboard' ) ;
3099+ assertCursor ( cursor , new Selection ( 3 , 2 , 3 , 2 ) ) ;
3100+ assert . equal ( model . getLineContent ( 3 ) , '}' ) ;
3101+ } ) ;
3102+ } ) ;
30833103} ) ;
30843104
30853105interface ICursorOpts {
0 commit comments