Tree-sitter Grammar 설정
문제
Go 관련 파일 (go.mod, go.work) 열 때 아래 경고가 반복 발생:
Warning (treesit): Cannot activate tree-sitter, because language grammar for go mod is unavailable (not-found):
(libtree-sitter-gomod.so libtree-sitter-gomod.dylib ...) No such file or directory
tree-sitter가 해당 언어의 compiled grammar (.dylib)를 못 찾아서 나는 경고.
해결
1. init.el에 grammar source 등록
(setq treesit-language-source-alist
'((gomod "https://github.com/camdencheek/tree-sitter-go-mod")))
2. grammar 설치 (최초 1회)
M-x treesit-install-language-grammar RET gomod RET
이후 나오는 branch, C compiler 등은 전부 기본값(Enter).
컴파일된 .dylib가 ~/.emacs.d/tree-sitter/에 저장되며, 이후 재설치 불필요.
다른 언어 추가 시
treesit-language-source-alist에 추가하면 됨:
(setq treesit-language-source-alist
'((gomod "https://github.com/camdencheek/tree-sitter-go-mod")
(go "https://github.com/tree-sitter/tree-sitter-go")
(python "https://github.com/tree-sitter/tree-sitter-python")))
copilot 경고
Warning (copilot): copilot--infer-indentation-offset found no mode-specific indentation offset.
이건 copilot 플러그인이 현재 파일의 들여쓰기를 자동 감지 못할 때 나는 경고. 기능에 영향 없음. 무시해도 됨.