GNU bug report logs - #60105
[PATCH] Add yaml-ts-mode

Previous Next

Package: emacs;

Reported by: Randy Taylor <dev <at> rjt.dev>

Date: Thu, 15 Dec 2022 22:21:01 UTC

Severity: normal

Tags: patch

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 60105 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: casouri <at> gmail.com, 60105 <at> debbugs.gnu.org
Subject: Re: 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 <at> 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?




This bug report was last modified 2 years and 134 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.