Etc

[Intellij] 코드 스타일 설정하기

jyjyjy25 2024. 4. 17. 17:15

Google-Java-Style-Format 적용

1. IntelliJ IDEA > Settings 선택

2. Preferences > Editor > Code Style 선택

3. Scheme > Import Scheme > IntelliJ IDEA code style XML 선택

4. https://github.com/google/styleguide 접속하여 intellij-java-google-style.xml 파일을 다운받은 후, 파일을 open하고 저장

5. GoogleStyle로 변경 완료

 

Google-Java-Style-Format 사용법

Mac 기준 Option + Command + L을 누르면 포맷에 맞게 코드가 변경된다.

 

파일을 저장할 때마다 formatter 작동시키기

1. IntelliJ IDEA > Settings 선택

2. Tools > Action on Save 선택

3. Reformat code, Optimize imports를 체크한다.