AndroidIDEOfficial / AndroidIDE

AndroidIDE is an IDE for Android to develop full featured Android apps.
https://m.androidide.com
GNU General Public License v3.0
2.3k stars 272 forks source link

Code formatting suggestions #1770

Closed LsxMm closed 6 months ago

LsxMm commented 6 months ago

Issue Checklist

Additional terms

Feature description

Suggest Java code formatting

  1. When formatting, do not wrap lines automatically or choose whether to split attributes into new lines like in XML
  2. When formatting, I always select all options. This is a complicated operation. I suggest adding a formatting option in the Tabs section to format the entire file. Alternatively, I can add an additional option to organize the import package

Use Case

More convenient to operate

Benefits

Writing code is more comfortable

itsaky commented 6 months ago

When formatting, do not wrap lines automatically or choose whether to split attributes into new lines like in XML

Currently, only Google Java Format is supported for formatting Java files, which does not allow customizing the format operation. However, we have plans to implement a customizable formatter like Eclipse's (#1466) or our own formatter.

When formatting, I always select all options. This is a complicated operation. I suggest adding a formatting option in the Tabs section to format the entire file.

If nothing is selected, the formatter formats all of the text. To achieve this, you can click on the cursor and the editor will show the text actions without selecting any text.

Alternatively, I can add an additional option to organize the import package.

The Organize imports action for Java files is available in the code actions menu (accessible from editor text actions). See Java code actions for more details.