nvim-treesitter kotlin 쿼리의 "..<" 노드 에러는 파서 버전 불일치
Kotlin 1.7.20 rangeUntil 연산자(..<)를 모르는 옛 파서가 새 highlights 쿼리와 충돌할 때의 진단/복구
nvim-treesitter kotlin 쿼리의 "..<" 노드 에러는 파서 버전 불일치
snacks picker에서 Query error at 350:4. Invalid node type "..<" 가 터지면, 보통 nvim-treesitter의 kotlin/highlights.scm은 최신인데 설치된 tree-sitter-kotlin 파서 .so가 옛날 버전이라 둘이 안 맞는 상황이다.
무슨 일이 벌어졌나
Kotlin 1.7.20에서 추가된 rangeUntil 연산자(..<)가 highlights 쿼리에 들어왔는데, 파서가 그 노드 타입을 모르면 쿼리 컴파일 자체가 실패한다. 픽커가 kotlin 파일을 하이라이트하려고 쿼리를 로드하는 순간 에러가 올라온다.
1
.../vim/treesitter/query.lua:373: Query error at 350:4. Invalid node type "..<"
해결
1
:TSUpdate kotlin
캐시가 꼬여 있으면 강제로 다시 깔자.
1
2
rm -rf ~/.local/share/nvim/lazy/nvim-treesitter/parser/kotlin.so
nvim --headless "+TSInstallSync kotlin" +qa
교훈
nvim-treesitter업데이트 = 쿼리 파일 업데이트지 파서 바이너리 업데이트가 아니다. 파서는:TSUpdate로 따로 갱신해야 짝이 맞는다.highlights.scm을 직접 수정하는 우회는:Lazy sync한 번이면 날아가니까 비추천. 정말 필요하면after/queries/<lang>/에 override를 둔다.
This post is licensed under CC BY 4.0 by the author.