GNU bug report logs - #67684
30.0.50; Font lock rule conflict in js-ts-mode at level 4

Previous Next

Package: emacs;

Reported by: Loïc Lemaître <loic.lemaitre <at> gmail.com>

Date: Thu, 7 Dec 2023 10:09:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 29.2

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67684 in the body.
You can then email your comments to 67684 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67684; Package emacs. (Thu, 07 Dec 2023 10:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Loïc Lemaître <loic.lemaitre <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 07 Dec 2023 10:09:02 GMT) Full text and rfc822 format available.

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

From: Loïc Lemaître <loic.lemaitre <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Font lock rule conflict in js-ts-mode at level 4
Date: Thu, 7 Dec 2023 11:07:53 +0100
Hi !

Hi !

I have noticed a font coloration issue in js-ts-mode when setting the 
treesit font lock level to 4: JSX attributes color is not the same than 
at level 3.
There should have a conflict between rules for "property_identifier" 
treesit type. The feature that triggers the conflict is "property" (of 
the level 4).

You can reproduce the issue by following these steps:
- M-: (setq treesit-font-lock-level 4)
- M-x js-ts-mode on a JSX buffer

Note that the bug already exists in Emacs 29.1.

Thanks !

Loïc

In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2023-12-07 built on
 loic-Latitude-E5470
Repository revision: e4e1e268c8e9f7de6fe5d4b05beb595a1781c02c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12201001
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --with-native-compilation=aot --with-tree-sitter --with-json
 CC=gcc-12'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE
XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: JavaScript

Minor modes in effect:
  eglot-inlay-hints-mode: t
  eglot--managed-mode: t
  whitespace-mode: t
  electric-pair-mode: t
  global-so-long-mode: t
  telephone-line-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  windmove-mode: t
  counsel-projectile-mode: t
  ivy-mode: t
  delete-selection-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  TeX-PDF-mode: t
  TeX-source-correlate-mode: t
  which-key-mode: t
  highlight-indentation-current-column-mode: t
  ws-butler-global-mode: t
  ws-butler-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  hs-minor-mode: t

Load-path shadows:
/home/loic/.emacs.d/elpa/transient-20230830.1638/transient hides 
/home/loic/Travail/Temp/emacs/lisp/transient
/home/loic/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides 
/home/loic/Travail/Temp/emacs/lisp/bind-key
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-ensure
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package hides 
/home/loic/Travail/Temp/emacs/lisp/use-package/use-package
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-bind-key
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-lint 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-lint
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-diminish
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-jump 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-jump
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-core 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-core
/home/loic/.emacs.d/elpa/use-package-20230426.2324/use-package-delight 
hides /home/loic/Travail/Temp/emacs/lisp/use-package/use-package-delight
/home/loic/.emacs.d/elpa/hierarchy-20190425.842/hierarchy hides 
/home/loic/Travail/Temp/emacs/lisp/emacs-lisp/hierarchy

Features:
(shadow sort mail-extr emacsbug mule-util vc-git flycheck-eglot eglot
external-completion jsonrpc ert ewoc debug backtrace jtsx
typescript-ts-mode whitespace hideshow company-oddmuse company-keywords
company-files company-dabbrev-code company-dabbrev company-yasnippet
company-capf time elec-pair so-long term disp-table ehelp telephone-line
telephone-line-segments telephone-line-separators telephone-line-utils
ox-gfm ox-md ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util
rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox org-element
org-persist org-id org-refile org ob ob-tangle ob-ref ob-lob ob-table
org-macro org-src ob-comint org-pcomplete org-list org-footnote
org-faces org-entities noutline outline ob-emacs-lisp org-table org-keys
org-loaddefs cal-menu calendar cal-loaddefs avl-tree ol oc ob-exp
ob-core org-cycle org-fold org-fold-core org-compat ob-eval org-version
org-macs magit-submodule magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode diff diff-mode git-commit log-edit message sendmail
yank-media puny rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util
time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process with-editor comp
comp-cstr shell pcomplete server magit-mode magit-git magit-base
magit-section cursor-sensor rg files-x vc vc-dispatcher rg-info-hack
rg-menu transient compat rg-ibuffer rg-result wgrep-rg wgrep rg-history
rg-header cus-edit pp cus-load dashboard dashboard-widgets recentf
tree-widget wid-edit ffap windmove framemove counsel-projectile counsel
xdg dired dired-loaddefs swiper ivy delsel ivy-faces ivy-overlay colir
color dockerfile-mode derived sh-script smie executable flycheck
find-func jest jest-traversal ibuffer-projectile projectile lisp-mnt
grep ibuf-ext ibuffer ibuffer-loaddefs magit-popup format-spec js2-mode
etags fileloop generator xref js cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs imenu pdf-loader
company-auctex yasnippet-snippets yasnippet company latex latex-flymake
flymake project compile text-property-search warnings icons thingatpt
tex-ispell tex-style tex dbus comp-run comp-common xml crm texmathp
c++-ts-mode c-ts-mode c-ts-common treesit advice virtualenvwrapper gud
comint ansi-osc ansi-color ring s dash py-autopep8 which-key
highlight-indentation ws-butler edmacro kmacro use-package-bind-key
bind-key easy-mmode snazzy-theme base16-theme exec-path-from-shell
cl-extra help-mode use-package-ensure use-package-core finder-inf
buttercup-autoloads auctex-autoloads tex-site company-web-autoloads
dashboard-autoloads dockerfile-mode-autoloads doom-themes-autoloads
evil-autoloads exec-path-from-shell-autoloads f-autoloads
flycheck-eglot-autoloads flycheck-autoloads goto-chg-autoloads
ibuffer-projectile-autoloads company-autoloads js2-mode-autoloads
json-mode-autoloads rx magit-autoloads pcase git-commit-autoloads
markdown-mode-autoloads mood-line-autoloads multiple-cursors-autoloads
nix-mode-autoloads magit-section-autoloads package-lint-autoloads
popper-autoloads popup-autoloads rainbow-mode-autoloads
realgud-autoloads realgud-recursive-autoloads loc-changes-autoloads
load-relative-autoloads rg-autoloads simple-modeline-autoloads
base16-theme-autoloads sqlformat-autoloads reformatter-autoloads
ivy-autoloads test-simple-autoloads transient-autoloads
treemacs-projectile-autoloads treemacs-autoloads posframe-autoloads
ht-autoloads projectile-autoloads dash-autoloads
web-completion-data-autoloads which-key-autoloads with-editor-autoloads
info compat-autoloads yaml-autoloads yaml-mode-autoloads
yasnippet-snippets-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 918736 127661) (symbols 48 52905 3) (strings 32 301817 
19250) (string-bytes 1 10190663)
 (vectors 16 97148) (vector-slots 8 1704214 34772) (floats 8 380 11535) 
(intervals 56 1687 287)
 (buffers 992 17))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67684; Package emacs. (Fri, 08 Dec 2023 01:34:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Loïc Lemaître <loic.lemaitre <at> gmail.com>,
 67684 <at> debbugs.gnu.org, Yuan Fu <casouri <at> gmail.com>
Subject: Re: bug#67684: 30.0.50; Font lock rule conflict in js-ts-mode at
 level 4
Date: Fri, 8 Dec 2023 03:33:16 +0200
[Message part 1 (text/plain, inline)]
Hi!

On 07/12/2023 12:07, Loïc Lemaître wrote:
> I have noticed a font coloration issue in js-ts-mode when setting the 
> treesit font lock level to 4: JSX attributes color is not the same than 
> at level 3.
> There should have a conflict between rules for "property_identifier" 
> treesit type. The feature that triggers the conflict is "property" (of 
> the level 4).
> 
> You can reproduce the issue by following these steps:
> - M-: (setq treesit-font-lock-level 4)
> - M-x js-ts-mode on a JSX buffer
> 
> Note that the bug already exists in Emacs 29.1.

The attached patch seems to fix that.

But it removes a function added by Yuan in e78e69b33189, while 
reshuffling the highlights to reorder priorities.

Yuan, do you remember why you did it that way back then? Perhaps I'm 
missing some other conflict.
[js-ts-font-lock-property.diff (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67684; Package emacs. (Fri, 08 Dec 2023 11:17:01 GMT) Full text and rfc822 format available.

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

From: Loïc Lemaître <loic.lemaitre <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>, 67684 <at> debbugs.gnu.org,
 Yuan Fu <casouri <at> gmail.com>
Subject: Re: bug#67684: 30.0.50; Font lock rule conflict in js-ts-mode at
 level 4
Date: Fri, 8 Dec 2023 12:16:24 +0100
Le 08/12/2023 à 02:33, Dmitry Gutov a écrit :
> Hi!
>
> On 07/12/2023 12:07, Loïc Lemaître wrote:
>> I have noticed a font coloration issue in js-ts-mode when setting the 
>> treesit font lock level to 4: JSX attributes color is not the same 
>> than at level 3.
>> There should have a conflict between rules for "property_identifier" 
>> treesit type. The feature that triggers the conflict is "property" 
>> (of the level 4).
>>
>> You can reproduce the issue by following these steps:
>> - M-: (setq treesit-font-lock-level 4)
>> - M-x js-ts-mode on a JSX buffer
>>
>> Note that the bug already exists in Emacs 29.1.
>
> The attached patch seems to fix that.
Yes I confirm, thanks !
>
> But it removes a function added by Yuan in e78e69b33189, while 
> reshuffling the highlights to reorder priorities.
>
> Yuan, do you remember why you did it that way back then? Perhaps I'm 
> missing some other conflict.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67684; Package emacs. (Mon, 11 Dec 2023 01:39:01 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>, Loïc Lemaître
 <loic.lemaitre <at> gmail.com>, 67684 <at> debbugs.gnu.org
Subject: Re: bug#67684: 30.0.50; Font lock rule conflict in js-ts-mode at
 level 4
Date: Sun, 10 Dec 2023 17:37:35 -0800

On 12/7/23 5:33 PM, Dmitry Gutov wrote:
> Hi!
>
> On 07/12/2023 12:07, Loïc Lemaître wrote:
>> I have noticed a font coloration issue in js-ts-mode when setting the 
>> treesit font lock level to 4: JSX attributes color is not the same 
>> than at level 3.
>> There should have a conflict between rules for "property_identifier" 
>> treesit type. The feature that triggers the conflict is "property" 
>> (of the level 4).
>>
>> You can reproduce the issue by following these steps:
>> - M-: (setq treesit-font-lock-level 4)
>> - M-x js-ts-mode on a JSX buffer
>>
>> Note that the bug already exists in Emacs 29.1.
>
> The attached patch seems to fix that.
>
> But it removes a function added by Yuan in e78e69b33189, while 
> reshuffling the highlights to reorder priorities.
>
> Yuan, do you remember why you did it that way back then? Perhaps I'm 
> missing some other conflict.
For a method invocation like obj.fn(), the "fn" should be fontified in 
function-call-face. However, "fn" is a property_identifier in the parse 
tree, so it would be fontified in property-use-face by the property 
feature. The predicate in the property feature makes sure we skip 
properties that are function invocations. And down the line in function 
feature, you'll see

(call_expression
      function: [(identifier) @font-lock-function-call-face
                 (member_expression
                  property:
                  (property_identifier) @font-lock-function-call-face)])

Here, the property_identifier is fontified in function-call-face.

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67684; Package emacs. (Mon, 11 Dec 2023 16:36:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Yuan Fu <casouri <at> gmail.com>, Loïc Lemaître
 <loic.lemaitre <at> gmail.com>, 67684 <at> debbugs.gnu.org
Subject: Re: bug#67684: 30.0.50; Font lock rule conflict in js-ts-mode at
 level 4
Date: Mon, 11 Dec 2023 18:35:06 +0200
On 11/12/2023 03:37, Yuan Fu wrote:
> 
> 
> On 12/7/23 5:33 PM, Dmitry Gutov wrote:
>> Hi!
>>
>> On 07/12/2023 12:07, Loïc Lemaître wrote:
>>> I have noticed a font coloration issue in js-ts-mode when setting the 
>>> treesit font lock level to 4: JSX attributes color is not the same 
>>> than at level 3.
>>> There should have a conflict between rules for "property_identifier" 
>>> treesit type. The feature that triggers the conflict is "property" 
>>> (of the level 4).
>>>
>>> You can reproduce the issue by following these steps:
>>> - M-: (setq treesit-font-lock-level 4)
>>> - M-x js-ts-mode on a JSX buffer
>>>
>>> Note that the bug already exists in Emacs 29.1.
>>
>> The attached patch seems to fix that.
>>
>> But it removes a function added by Yuan in e78e69b33189, while 
>> reshuffling the highlights to reorder priorities.
>>
>> Yuan, do you remember why you did it that way back then? Perhaps I'm 
>> missing some other conflict.
> For a method invocation like obj.fn(), the "fn" should be fontified in 
> function-call-face. However, "fn" is a property_identifier in the parse 
> tree, so it would be fontified in property-use-face by the property 
> feature. The predicate in the property feature makes sure we skip 
> properties that are function invocations. And down the line in function 
> feature, you'll see
> 
> (call_expression
>        function: [(identifier) @font-lock-function-call-face
>                   (member_expression
>                    property:
>                    (property_identifier) @font-lock-function-call-face)])
> 
> Here, the property_identifier is fontified in function-call-face.

Thanks. So the patch I sent should also cover this, right?

It moves the 'property' feature to below 'function'. And below 'jsx', 
which fixes the problem reported in this bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67684; Package emacs. (Tue, 12 Dec 2023 08:35:01 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>, Loïc Lemaître
 <loic.lemaitre <at> gmail.com>, 67684 <at> debbugs.gnu.org
Subject: Re: bug#67684: 30.0.50; Font lock rule conflict in js-ts-mode at
 level 4
Date: Tue, 12 Dec 2023 00:33:44 -0800

On 12/11/23 8:35 AM, Dmitry Gutov wrote:
> On 11/12/2023 03:37, Yuan Fu wrote:
>>
>>
>> On 12/7/23 5:33 PM, Dmitry Gutov wrote:
>>> Hi!
>>>
>>> On 07/12/2023 12:07, Loïc Lemaître wrote:
>>>> I have noticed a font coloration issue in js-ts-mode when setting 
>>>> the treesit font lock level to 4: JSX attributes color is not the 
>>>> same than at level 3.
>>>> There should have a conflict between rules for 
>>>> "property_identifier" treesit type. The feature that triggers the 
>>>> conflict is "property" (of the level 4).
>>>>
>>>> You can reproduce the issue by following these steps:
>>>> - M-: (setq treesit-font-lock-level 4)
>>>> - M-x js-ts-mode on a JSX buffer
>>>>
>>>> Note that the bug already exists in Emacs 29.1.
>>>
>>> The attached patch seems to fix that.
>>>
>>> But it removes a function added by Yuan in e78e69b33189, while 
>>> reshuffling the highlights to reorder priorities.
>>>
>>> Yuan, do you remember why you did it that way back then? Perhaps I'm 
>>> missing some other conflict.
>> For a method invocation like obj.fn(), the "fn" should be fontified 
>> in function-call-face. However, "fn" is a property_identifier in the 
>> parse tree, so it would be fontified in property-use-face by the 
>> property feature. The predicate in the property feature makes sure we 
>> skip properties that are function invocations. And down the line in 
>> function feature, you'll see
>>
>> (call_expression
>>        function: [(identifier) @font-lock-function-call-face
>>                   (member_expression
>>                    property:
>>                    (property_identifier) 
>> @font-lock-function-call-face)])
>>
>> Here, the property_identifier is fontified in function-call-face.
>
> Thanks. So the patch I sent should also cover this, right?
>
> It moves the 'property' feature to below 'function'. And below 'jsx', 
> which fixes the problem reported in this bug.

Ah, right. In that case, I don't have anything else to add.

Yuan




Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Tue, 12 Dec 2023 22:04:01 GMT) Full text and rfc822 format available.

Notification sent to Loïc Lemaître <loic.lemaitre <at> gmail.com>:
bug acknowledged by developer. (Tue, 12 Dec 2023 22:04:01 GMT) Full text and rfc822 format available.

Message #25 received at 67684-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Yuan Fu <casouri <at> gmail.com>, Loïc Lemaître
 <loic.lemaitre <at> gmail.com>, 67684-done <at> debbugs.gnu.org
Subject: Re: bug#67684: 30.0.50; Font lock rule conflict in js-ts-mode at
 level 4
Date: Wed, 13 Dec 2023 00:02:55 +0200
Version: 29.2

On 12/12/2023 10:33, Yuan Fu wrote:
> 
> 
> On 12/11/23 8:35 AM, Dmitry Gutov wrote:
>> On 11/12/2023 03:37, Yuan Fu wrote:
>>>
>>>
>>> On 12/7/23 5:33 PM, Dmitry Gutov wrote:
>>>> Hi!
>>>>
>>>> On 07/12/2023 12:07, Loïc Lemaître wrote:
>>>>> I have noticed a font coloration issue in js-ts-mode when setting 
>>>>> the treesit font lock level to 4: JSX attributes color is not the 
>>>>> same than at level 3.
>>>>> There should have a conflict between rules for 
>>>>> "property_identifier" treesit type. The feature that triggers the 
>>>>> conflict is "property" (of the level 4).
>>>>>
>>>>> You can reproduce the issue by following these steps:
>>>>> - M-: (setq treesit-font-lock-level 4)
>>>>> - M-x js-ts-mode on a JSX buffer
>>>>>
>>>>> Note that the bug already exists in Emacs 29.1.
>>>>
>>>> The attached patch seems to fix that.
>>>>
>>>> But it removes a function added by Yuan in e78e69b33189, while 
>>>> reshuffling the highlights to reorder priorities.
>>>>
>>>> Yuan, do you remember why you did it that way back then? Perhaps I'm 
>>>> missing some other conflict.
>>> For a method invocation like obj.fn(), the "fn" should be fontified 
>>> in function-call-face. However, "fn" is a property_identifier in the 
>>> parse tree, so it would be fontified in property-use-face by the 
>>> property feature. The predicate in the property feature makes sure we 
>>> skip properties that are function invocations. And down the line in 
>>> function feature, you'll see
>>>
>>> (call_expression
>>>        function: [(identifier) @font-lock-function-call-face
>>>                   (member_expression
>>>                    property:
>>>                    (property_identifier) 
>>> @font-lock-function-call-face)])
>>>
>>> Here, the property_identifier is fontified in function-call-face.
>>
>> Thanks. So the patch I sent should also cover this, right?
>>
>> It moves the 'property' feature to below 'function'. And below 'jsx', 
>> which fixes the problem reported in this bug.
> 
> Ah, right. In that case, I don't have anything else to add.

Great! I've pushed the patch to emacs-29, and this bug is now closed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Jan 2024 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 122 days ago.

Previous Next


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