-
-
Notifications
You must be signed in to change notification settings - Fork 514
Automatic Code Indentation #1817
Description
Issue Checklist
- I confirm that this feature request has not been previously suggested.
- I agree to follow the project's code of conduct.
- I have checked and verified that I am using the latest version of AndroidIDE from GitHub or F-Droid.
Additional terms
- I understand that feature requests are subject to evaluation and may not be implemented immediately.
- I agree to provide additional details if needed for a clearer understanding of the requested feature.
Feature description
Summary:
There is an issue with the automatic indentation of code when moving blocks of code in the editor. The indentation is not preserved correctly, resulting in poorly formatted code.
Steps to Reproduce:
-
Consider the following initial Java code:
class MyClass { void myMethod() { int a = 10; int b = 5; if(a > b) { b *= a; } else { b = a--; } while(true) { int c = 100; if(--c < 0) break; } } }
-
Move the code block:
int a = 10; int b = 5; if(a > b) { b *= a; } else { b = a--; }
inside the
whileloop. -
Observe the result:
class MyClass { void myMethod() { while(true) { int c = 100; if(--c < 0) break; int a = 10; int b = 5; if(a > b) { b *= a; } else { b = a--; } } } }
-
The expected correctly indented result should be:
class MyClass { void myMethod() { while(true) { int c = 100; if(--c < 0) break; int a = 10; int b = 5; if(a > b) { b *= a; } else { b = a--; } } } }
-
Move the code inside the
whileloop back to outside of it. -
Observe the result:
class MyClass { void myMethod() { int a = 10; int b = 5; if(a > b) { b *= a; } else { b = a--; } int c = 100; if(--c < 0) break; while(true) { } } }
-
The expected correctly indented result should be:
class MyClass { void myMethod() { int a = 10; int b = 5; if(a > b) { b *= a; } else { b = a--; } int c = 100; if(--c < 0) break; while(true) { } } }
Actual Result:
The code is not indented correctly when moved, leading to a messy and hard-to-read code structure.
Expected Result:
The code should maintain proper indentation when moved, making it clean and readable.
Use Case
Enhanced Readability: The code remains clean and readable regardless of how blocks are moved around
Improved Maintainability: Well-indented code is easier to understand, modify, and debug.
Time-Saving: Jane saves time otherwise spent on manually fixing indentation errors, allowing her to focus more on the logic and functionality of the code.
Consistency: Ensures a consistent code style throughout the project, which is crucial for team-based development and code reviews.
Benefits
Enchanced user experience