danderson / templ-ts-mode

Emacs major mode for editing Templ files
GNU General Public License v3.0
13 stars 2 forks source link

Almost no font lock, only minimal in script block #8

Closed efim closed 8 months ago

efim commented 8 months ago

Hello!

I'm having trouble figuring out font locking, when i enable 'templ-ts-mode' only few items inside of script block have color

My initially attempted setup is no-distribution just emacs config: templ-ts-no-font-lock-2024-03-11_06-13

as seen in screenshot, i've enabled tree-sitter-explorer, and file has been parsed

this is minimal setup i've used to recreate same behavior in emacs -Q:

(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(package-install 'templ-ts-mode)  ; Assuming templ-ts-mode is available in the package repository

;; manual javascript tree-sitter grammar install with
;; M-x treesit-install-language-grammar javascript

in Messages i get following error: Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Node type error at" 2 "(function name: (identifier) @font-lock-function-name-face) (class_declaration name: (identifier) @font-lock-type-face) (function_declaration name: (identifier) @font-lock-function-name-face) (method_definition name: (property_identifier) @font-lock-function-name-face) (method_definition parameters: (formal_parameters (identifier) @font-lock-variable-name-face)) (arrow_function parameters: (formal_parameters (identifier) @font-lock-variable-name-face)) (function_declaration parameters: (formal_parameters (identifier) @font-lock-variable-name-face)) (variable_declarator name: (identifier) @font-lock-variable-name-face) (variable_declarator name: (identifier) @font-lock-function-name-face value: [(function) (arrow_function)]) (variable_declarator name: [(array_pattern (identifier) @font-lock-variable-name-face) (object_pattern (shorthand_property_identifier_pattern) @font-lock-variable-name-face)]) (import_clause (identifier) @font-lock-variable-name-face) (import_clause (named_imports (import_specifier alias: (identifier) @font-lock-variable-name-face))) (import_clause (named_imports (import_specifier !alias name: (identifier) @font-lock-variable-name-face))) (import_clause (namespace_import (identifier) @font-lock-variable-name-face))" "Debug the query with `treesit-query-validate'")

Error during redisplay: (jit-lock-function 101) signaled (treesit-query-error "Node type error at" 2 "(function name: (identifier) @font-lock-function-name-face) (class_declaration name: (identifier) @font-lock-type-face) (function_declaration name: (identifier) @font-lock-function-name-face) (method_definition name: (property_identifier) @font-lock-function-name-face) (method_definition parameters: (formal_parameters (identifier) @font-lock-variable-name-face)) (arrow_function parameters: (formal_parameters (identifier) @font-lock-variable-name-face)) (function_declaration parameters: (formal_parameters (identifier) @font-lock-variable-name-face)) (variable_declarator name: (identifier) @font-lock-variable-name-face) (variable_declarator name: (identifier) @font-lock-function-name-face value: [(function) (arrow_function)]) (variable_declarator name: [(array_pattern (identifier) @font-lock-variable-name-face) (object_pattern (shorthand_property_identifier_pattern) @font-lock-variable-name-face)]) (import_clause (identifier) @font-lock-variable-name-face) (import_clause (named_imports (import_specifier alias: (identifier) @font-lock-variable-name-face))) (import_clause (named_imports (import_specifier !alias name: (identifier) @font-lock-variable-name-face))) (import_clause (namespace_import (identifier) @font-lock-variable-name-face))" "Debug the query with `treesit-query-validate'")

Am I missing something? Maybe there is some dependency i need, which is not installed automatically?

I understand that error message asks to check treesit query, but right now i don't know how to do that

efim commented 8 months ago

Oh, now i see that this is duplicate of the https://github.com/danderson/templ-ts-mode/issues/6