bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60105: [PATCH] Add yaml-ts-mode


From: Randy Taylor
Subject: bug#60105: [PATCH] Add yaml-ts-mode
Date: Mon, 02 Jan 2023 21:58:57 +0000

On Monday, January 2nd, 2023 at 13:52, Juri Linkov <juri@linkov.net> wrote:
> 
> > + :language 'yaml
> 
> > + :feature 'string
> > + :override t
> > + '([(block_scalar)
> > + (double_quote_scalar)
> > + (single_quote_scalar)
> > + (string_scalar)] @font-lock-string-face)
> 
> 
> Thanks, yaml-ts-mode works great. One problem is that
> with the above setting everything is (over)fontified in the buffer.
> This is the only mode I have seen where 100% of text has
> non-default colors making it so called "angry fruit salad".
> In this regard yaml-mode is not better: it fontifies only text in quotes
> that makes an unnecessary distinction between quoted and unquoted text.
> I know it's possible to configure this in a hackish way:
> 
> (with-eval-after-load 'yaml-ts-mode
> (setq yaml-ts-mode--font-lock-settings
> (seq-remove (lambda (e) (eq (nth 2 e) 'string))
> yaml-ts-mode--font-lock-settings)))
> 
> But what I propose is to add a customizable option to enable/disable
> font-lock-string-face on most text to lessen the color burden on users.

I think using treesit-font-lock-recompute-features is the way to adjust which 
features you want, and is what is expected for cases like this (but Yuan would 
know best).

Alternatively, treesit-font-lock-level dictates which level of features should 
be included for highlighting. The default is level 3, and string is on level 2. 
We can move string to the 4th level, which may be an OK compromise?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]