Spring/RestDocs

IntelliJ Restdocs Unexpected token - .snippet 파일을 AsciiDoc로 인식하지 않을 때

ysk(0soo) 2023. 1. 28. 23:00

Restdocs 커스텀을 위하여 src/test/resources/org/springframework/restdocs/templates 경로에 snippet 파일을 추가하여 작성하면 다음처럼 인식이 되지 않아서 작성하기 힘든 경우가 생긴다.

Unexpected token

빨간줄에, 문법 형식도 맞지 않게 작성된다.

Intellij 설정을 바꾸면 해결된다.

해결법

Mac 기준

Preferences -> Editor -> File Types -> Recognized File Types

Recognized File Types 에서 마우스 조금 내리다보면 AsciiDoc files보인다.

File name patterns에 *.snippet 추가

writing AsciiDoc works best with soft-wrap enabled. Do you want to enable it by default? 라는 문구 발견

  • AsciiDoc 작성은 소프트 랩이 활성화된 상태에서 가장 잘 작동합니다. 기본적으로 활성화하시겠습니까?

활성화 창 클릭

yes, take me to the Soft Wrap settings! 클릭

soft-wrap these fiels -> *.snippet; 추가

문제없이 asciidoc 작성을 할 수 있다.