Mac용 Visual Studio Code에 Google coding style 적용 (Java)

말많은개발자·2022년 10월 27일
0

소소한 팁들

목록 보기
2/2

1. 먼저 homebrew 로 google-style-format 을 설치

brew install google-style-format

설치하고나면 아래 스샷처럼 설치 경로가 나오는데 요걸 복사해둔다.

만약 이걸 까먹었다면 아래 명령어로 설치 경로를 확인

brew info google-style-format

2. vscode에서 아래 확장 프로그램 설치

이름: google-java-format
VS Marketplace 링크: https://marketplace.visualstudio.com/items?itemName=ilkka.google-java-format

3. vscode 설정에서 google-java-format 검색

가장 위의 Executable-path 에 위에서 복사해둔 경로 하위의 실행 가능한 스크립트 path를 넣어준다.
내 경우엔 아래와 같음

/opt/homebrew/Cellar/google-java-format/1.15.0/bin/google-java-format

4. 코드 에디터에서 보조메뉴(보통 우클릭) 불러 '문서 서식 프로그램' 선택


위 메뉴에서 기본 포맷터 구성에서 google-java-format 선택으로 기본 설정

5. 코드에디터의 보조메뉴에서 '문서 서식' 선택 또는 단축키 사용

profile
백엔드 개발로 밥 먹고 사는 아저씨

0개의 댓글