-
-
Notifications
You must be signed in to change notification settings - Fork 263
Description
I am trying to use scala-ts-mode for Scala buffers. These files contain Scala code and the Chisel EDSL for hardware (this means that there is usually no good way to know if a particular file is Scala or Chisel).
The default settings for scala-ts-mode do not match what I am used to from scala-mode's "mis-handling" of Chisel code, and I am trying to see if I can restore it. The main goal is to alter treesit-font-lock-feature-list
so that I highlight what I care about as Chisel code.
After some discussion on IRC, we narrowed down the issue to the :config
in my use-package invocation. :config
runs after the feature is available, which is distinctly different than when the major-mode is invoked. I am currently working around this by attaching a hook, but wanted to make sure that this :config
behavior is intended.
ELISP> (macroexpand-1 '(use-package scala-ts-mode
:ensure t
:defer t
:config
(setq-local treesit-font-lock-feature-list
'((comment doc-comment definition)
(keyword type)
(variable function import literal)
(operator interpolation extra)))
(setq-local treesit-font-lock-level 3)
(treesit-font-lock-recompute-features)))
(elpaca scala-ts-mode
(defvar use-package--warning99
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'scala-ts-mode keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(eval-after-load 'scala-ts-mode
'(condition-case-unless-debug err
(progn
(setq-local treesit-font-lock-feature-list
'((comment doc-comment definition)
(keyword type)
(variable function import literal)
(operator interpolation extra)))
(setq-local treesit-font-lock-level 3)
(treesit-font-lock-recompute-features)
t)
(error
(funcall use-package--warning99 :config err))))
(error
(funcall use-package--warning99 :catch err))))