JuliaEditorSupport / julia-ts-mode

Experimental Emacs Julia major mode using tree-sitter
MIT License
37 stars 8 forks source link

Displaying Julia files using julia-ts-mode fails on Emacs 30.0.5 #21

Open nameiwillforget opened 7 months ago

nameiwillforget commented 7 months ago

I apologize if this is a basic issue, as I'm very new to using tree-sitter. I followed the installation procedures and now julia-ts-mode is the default major mode for opening .ji files, but when I open such a file with it, there is almost no syntax highlighting at all and I get an error in the messages buffer:

Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Node type error at" 177 "(assignment (identifier) @font-lock-variable-name-face (_)) (assignment (field_expression (identifier) \".\" (identifier) @font-lock-variable-name-face) (operator)) (assignment (bare_tuple (identifier) @font-lock-variable-name-face)) (assignment (bare_tuple (field_expression (identifier) \".\" (identifier) @font-lock-variable-name-face)) (operator)) (local_statement (identifier) @font-lock-variable-name-face) (let_binding (identifier) @font-lock-variable-name-face) (global_statement (identifier) @font-lock-variable-name-face)" "Debug the query with `treesit-query-validate'")

I looked up the function treesit-query-validate, but it wants a query as an argument and I couldn't find out which one. I also tried re-installing julia-ts-mode, but it still didn't work. What could be the issue?

ronisbr commented 7 months ago

Hi @nameiwillforget !

Probably the Julia treesitter grammar has changed and the current julia-ts-mode needs to be updated accordingly. Unfortunately, I do not use Emacs anymore and it will take a while until I can get a working setup here to try fixing the problem (https://github.com/JuliaEditorSupport/julia-emacs/issues/205#issuecomment-2046087465).

I will migrate the repository to JuliaEditorSupport org this weekend hopefully. Maybe someone else can fix the problem faster.

ronisbr commented 7 months ago

Btw @nameiwillforget, can you try with emacs 29?

tpapp commented 7 months ago

Just a quick note: given that Emacs 30 is, at the moment, unreleased, and we are just integrating this code, fixing stuff on Emacs 30 is unlikely to be a priority of the maintainers. Users are advised to use Emacs 29.x for the moment.

hexaeder commented 6 months ago

I also encounter this problem on emacs 29.3 in WSL2 environment.

Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Node type error at" 177 "(assignment (identifier) @font-lock-variable-name-face (_)) (assignment (field_expression (identifier) \".\" (identifier) @font-lock-variable-name-face) (operator)) (assignment (bare_tuple (identifier) @font-lock-variable-name-face)) (assignment (bare_tuple (field_expression (identifier) \".\" (identifier) @font-lock-variable-name-face)) (operator)) (local_statement (identifier) @font-lock-variable-name-face) (let_binding (identifier) @font-lock-variable-name-face) (global_statement (identifier) @font-lock-variable-name-face)" "Debug the query with `treesit-query-validate'")

There are a few things happening currently in the grammar repo, maybe it just fails when you're rebuilding the grammar as of now?

hexaeder commented 6 months ago

Yep, confirmed. How to fix it temporarily: call this function for the interactive grammar install process

(treesit-install-language-grammar 'julia)

For repo use https://github.com/tree-sitter/tree-sitter-julia, for branch/revision use v0.20.0 (which is the tag before the current v0.22.0).