GNU bug report logs - #69589
29.2; Invalid query in js--treesit-font-lock-settings prevents syntax highlighting

Previous Next

Package: emacs;

Reported by: "Divvy Cr." <divvycr <at> gmail.com>

Date: Wed, 6 Mar 2024 17:37:02 UTC

Severity: normal

Found in version 29.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: "Divvy Cr." <divvycr <at> gmail.com>
Subject: bug#69589: closed (Re: bug#69589: 29.2; Invalid query in
 js--treesit-font-lock-settings prevents syntax highlighting)
Date: Wed, 06 Mar 2024 19:23:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#69589: 29.2; Invalid query in js--treesit-font-lock-settings prevents syntax highlighting

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 69589 <at> debbugs.gnu.org.

-- 
69589: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69589
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: "Divvy Cr." <divvycr <at> gmail.com>
Cc: 69589-done <at> debbugs.gnu.org
Subject: Re: bug#69589: 29.2; Invalid query in js--treesit-font-lock-settings
 prevents syntax highlighting
Date: Wed, 06 Mar 2024 21:21:51 +0200
> From: "Divvy Cr." <divvycr <at> gmail.com>
> Date: Wed, 6 Mar 2024 18:00:50 +0000
> 
> Ah, yep, that solves it. Cheers!

Thanks for testing, I'm therefore closing this bug.

[Message part 3 (message/rfc822, inline)]
From: "Divvy Cr." <divvycr <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.2; Invalid query in js--treesit-font-lock-settings prevents syntax
 highlighting
Date: Wed, 6 Mar 2024 17:25:40 +0000
[Message part 4 (text/plain, inline)]
Open a JavaScript file containing 'const x = 10;' for instance. Then,
enable js-ts-mode (M-x js-ts-mode). Expected the literal '10' to be
highlighted with font-lock-number-face, but it is not.

The apparent reason is that the 'function' node name used in
treesit-font-lock-rules to define js--treesit-font-lock-settings (in the
file js.el) is a valid elisp function (C-h f function). This invalidates
the query, as verified by running the following:

(treesit-query-validate 'javascript ((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)

     (formal_parameters
      [(identifier) @font-lock-variable-name-face
       (array_pattern (identifier) @font-lock-variable-name-face)
       (object_pattern (shorthand_property_identifier_pattern)
@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)])

     ;; full module imports
     (import_clause (identifier) @font-lock-variable-name-face)
     ;; named imports with aliasing
     (import_clause (named_imports (import_specifier
                                    alias: (identifier)
@font-lock-variable-name-face)))
     ;; named imports without aliasing
     (import_clause (named_imports (import_specifier
                                    !alias
                                    name: (identifier)
@font-lock-variable-name-face)))

     ;; full namespace import (* as alias)
     (import_clause (namespace_import (identifier)
     @font-lock-variable-name-face))))

Note that this query is taken directly from the definition of
js--tresit-font-lock-settings.

Removing the invalid snippet above from the definition of
js--treesit-font-lock-settings fixes this bug.


In GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
 cairo version 1.16.0) of 2024-03-05 built on DV-Portable
System Description: Ubuntu 22.04.4 LTS

Configured using:
 'configure --with-pgtk --with-native-compilation
 --without-compress-install --with-tree-sitter'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix

Major mode: JavaScript

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr cl-print thingatpt help-fns radix-tree emacsbug
message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec
password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils pp wid-edit descr-text js
c-ts-common treesit json map byte-opt imenu cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv
cl-extra help-mode bytecomp byte-compile cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd
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 dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 146459 33528)
 (symbols 48 22745 0)
 (strings 32 97373 2695)
 (string-bytes 1 2500148)
 (vectors 16 25550)
 (vector-slots 8 853209 33493)
 (floats 8 53 28)
 (intervals 56 282 0)
 (buffers 984 14))
[Message part 5 (text/html, inline)]

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

Previous Next


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