From: "Divvy Cr." <divvycr@gmail.com>
To: 69589@debbugs.gnu.org
Subject: bug#69589: 29.2; Invalid query in js--treesit-font-lock-settings prevents syntax highlighting
Date: Wed, 6 Mar 2024 17:25:40 +0000 [thread overview]
Message-ID: <CADmOxiLW3NCEGWotDWDPUCNf_BfR+m7DQYQ46fr0VtGirdqCeQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5427 bytes --]
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))
[-- Attachment #2: Type: text/html, Size: 6147 bytes --]
next reply other threads:[~2024-03-06 17:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 17:25 Divvy Cr. [this message]
2024-03-06 17:48 ` bug#69589: 29.2; Invalid query in js--treesit-font-lock-settings prevents syntax highlighting Eli Zaretskii
[not found] ` <CADmOxiLB9J1UhE3UXiMDCDVnUDT-=_i0RjJbbJpn=9uZckf=XA@mail.gmail.com>
2024-03-06 19:21 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADmOxiLW3NCEGWotDWDPUCNf_BfR+m7DQYQ46fr0VtGirdqCeQ@mail.gmail.com \
--to=divvycr@gmail.com \
--cc=69589@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.