Home > Software engineering >  Function "Format code (Ctrl Alt l)" in Android studio, not working properly
Function "Format code (Ctrl Alt l)" in Android studio, not working properly

Time:04-22

When I apply "Format code" my lines of code automatically down line (many lines) even though my screen has enough space to display it on 1 line.

enter image description here

I see it depends on the vertical line (red in the image), how can I remove this line or widen it?

My language is: Dart

CodePudding user response:

You can disable the line from File->Settings->Editor->Appearance and then uncheck 'Show hard wrap and visual guides'.

You can take reference from these two images:

'Show hard wrap and visual guides' checked With line

'Show hard wrap and visual guides' unchecked Without line

Also you can customize it from the 'Code Style' option in the same(Editor) dropdown.

For your reference: Hard wrap with value 50: Hard wrap 50

Hard wrap with value 100: Hard wrap 100

Edit: for flutter development you need to the change the line length for auto formatting in dart option in the code style dropdown. Like this: Dart formatting

A lot of customizations could be done according to the need.

  • Related