File tree Expand file tree Collapse file tree
packages/prettier-plugin-java/src/printers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -457,43 +457,12 @@ export class ExpressionsPrettierVisitor extends BaseCstPrettierPrinter {
457457 return dot ;
458458 } )
459459 : [ ] ;
460- const isMethodInvocation = ctx . Dot && ctx . Dot . length === 1 ;
461-
462- if ( params ?. shouldBreakBeforeFirstMethodInvocation === true ) {
463- // when fqnOrRefType is a method call from an object
464- if ( isMethodInvocation ) {
465- const separator = hasLeadingComments ( ctx . Dot ! [ 0 ] )
466- ? dots [ 0 ]
467- : concat ( [ softline , dots [ 0 ] ] ) ;
468- return rejectAndConcat ( [
469- indent (
470- rejectAndConcat ( [
471- fqnOrRefTypePartFirst ,
472- separator ,
473- rejectAndJoinSeps ( dots . slice ( 1 ) , fqnOrRefTypePartRest ) ,
474- dims
475- ] )
476- )
477- ] ) ;
478- // otherwise it is a fully qualified name but we need to exclude when it is just a method call
479- } else if ( ctx . Dot ) {
480- const lastDot = ctx . Dot [ ctx . Dot . length - 1 ] ;
481- const separator = hasLeadingComments ( lastDot )
482- ? dots [ dots . length - 1 ]
483- : concat ( [ softline , lastDot ] ) ;
484-
485- return indent (
486- rejectAndConcat ( [
487- rejectAndJoinSeps ( dots . slice ( 0 , dots . length - 1 ) , [
488- fqnOrRefTypePartFirst ,
489- ...fqnOrRefTypePartRest . slice ( 0 , fqnOrRefTypePartRest . length - 1 )
490- ] ) ,
491- separator ,
492- fqnOrRefTypePartRest [ fqnOrRefTypePartRest . length - 1 ] ,
493- dims
494- ] )
495- ) ;
496- }
460+
461+ if (
462+ params ?. shouldBreakBeforeFirstMethodInvocation === true &&
463+ ctx . Dot !== undefined
464+ ) {
465+ dots [ dots . length - 1 ] = concat ( [ softline , ctx . Dot [ ctx . Dot . length - 1 ] ] ) ;
497466 }
498467
499468 return indent (
You can’t perform that action at this time.
0 commit comments