Issue
I'm creating a Flutter app in android studio. Under Settings -> Editor -> Code Style -> Dart, I enabled "use tab character" and changed the tab size and indent to 4.
However, nothing seemed to have changed in the main.dart file, so I used Ctrl-Alt-Shift-L to reformat the code (even tried with "code cleanup" enabled), but it still uses two spaces to indent.
How do I make android studio use tab characters?
Solution
You can still change the tab indents manually via the configuration files in Android Studio 4.
Look for your configuration files, where CONFIGURATION_FOLDER
is your android studio folder:
Windows: %USERPROFILE%\. CONFIGURATION_FOLDER.
macOS: ~/Library/Preferences/ CONFIGURATION_FOLDER.
Linux: ~/. CONFIGURATION_FOLDER.
And then add a new section into the file your IDE is using. Mine is codestyles/Default.xml
.
Like so:
<code_scheme name="Default" version="173">
...
<codeStyleSettings language="Dart">
<option name="BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
...
</code_scheme>
Answered By - iOSonntag
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.