From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vincenzo Pupillo Newsgroups: gmane.emacs.bugs Subject: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sat, 15 Jul 2023 14:34:29 +0200 Message-ID: <2171209.irdbgypaU6@fedora> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart13327100.uLZWGnKmhe" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32269"; mail-complaints-to="usenet@ciao.gmane.io" To: 64647@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 15 14:35:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qKeUZ-00089h-Vk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jul 2023 14:35:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKeUK-0005tC-U8; Sat, 15 Jul 2023 08:35:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKeUJ-0005rY-GS for bug-gnu-emacs@gnu.org; Sat, 15 Jul 2023 08:35:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKeUJ-00016b-7W for bug-gnu-emacs@gnu.org; Sat, 15 Jul 2023 08:35:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKeUI-00043Y-PA for bug-gnu-emacs@gnu.org; Sat, 15 Jul 2023 08:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jul 2023 12:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64647 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168942448915561 (code B ref -1); Sat, 15 Jul 2023 12:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Jul 2023 12:34:49 +0000 Original-Received: from localhost ([127.0.0.1]:44322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKeU4-00042v-Hv for submit@debbugs.gnu.org; Sat, 15 Jul 2023 08:34:48 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:49202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKeTz-00042g-UA for submit@debbugs.gnu.org; Sat, 15 Jul 2023 08:34:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKeTt-0005qE-UM for bug-gnu-emacs@gnu.org; Sat, 15 Jul 2023 08:34:37 -0400 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKeTs-0000xj-Ay for bug-gnu-emacs@gnu.org; Sat, 15 Jul 2023 08:34:37 -0400 Original-Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so26187805e9.0 for ; Sat, 15 Jul 2023 05:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689424471; x=1692016471; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=zu8rbrA99RoGrD8TAFDLAvPa+7CjJxnxz6gqwkC3yjU=; b=ecZmBQXIs0/wOL6WS82ni1yRKwhes8qZJLEwfD1KUu0RUmXpKo5jrOMGh6mlm+d26j WK4pgUo1maBgNVPtGIw06g3mfTIoC4ZzBJ7y7a9MrnNsg603rwHTd2MlqQSdw3rArEv7 DswagbDYig+F2eiYRNPRXcgj9L5a7j5PMfHJEo3YCYeFWQlLMx48KMKvyI2k2ZvYYnJs m7aurxY31KYDsXkIziF0YY4quZGzDsyoUn1pFZ8aKuiIYg1P30EFFKtyG2A0jrI0OaTB upAPh3R84ha9Xwapy0ycV0espz0IaEV6zwy8V9tWlGMi729oOiA+bgLKAfuiuqIYi6tr vkTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689424471; x=1692016471; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zu8rbrA99RoGrD8TAFDLAvPa+7CjJxnxz6gqwkC3yjU=; b=kc/KTyXVMkb9unB/N46syTdEztnsOOa3fTIVdBI1pqiiAA5TmXLMaVTWK6ZH/cf8Wa yJWgqYjeNhf8QvmLzDRE5qCK9JKW61nsiBFkKA20lzuWNo0C3m6eaYIPDqjXfTjJL2eG bCtXxzfFhIrxtiNlyBmyeQlAIKnYssP8zYQdMihAqRMeflAqABnDRE68XpcugmgOxOrA FZ4YIXy+tHQTA+XHaxca7c9JzqcdjAmq/HFN4s65vesJohKzLRk+XRaCtWj4PLTa8CkE KQ8IOzfCLHbq4p7uy1oluT6Jw+eLgI02bxJ30nMNtfopfhrOoKD56qTtcihLzP+N1OIX WvMQ== X-Gm-Message-State: ABy/qLb7ounP3zPrBWcn8wiDK8e1shVGBOaG7Wn1u8M/y41Pif36fiHI 6RYNjNeC2IbH/IU+bkqkoYf5btbsfek= X-Google-Smtp-Source: APBJJlEA31EbMk36xjzJek2HJ9gSCgI3Q2UyiwWhBcneNJ3X22yJq7xJ4nUYoiZ9EqhivOKwqHNitA== X-Received: by 2002:a1c:7407:0:b0:3fb:ffa8:6d78 with SMTP id p7-20020a1c7407000000b003fbffa86d78mr5995345wmc.36.1689424470762; Sat, 15 Jul 2023 05:34:30 -0700 (PDT) Original-Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id o10-20020a05600c510a00b003fbb1ce274fsm6224514wms.0.2023.07.15.05.34.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 05:34:30 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=v.pupillo@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265197 Archived-At: This is a multi-part message in MIME format. --nextPart13327100.uLZWGnKmhe Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, this commit (bb1f97b643b77fc1f082d621bf533b4b14cf0c30) changed the definition of the JSX grammar to tree-sitter-javascript. This causes a node type error: " Error while displaying: (jit-lock-function 1) reported (treesit-query-error "Node type error at" 24 "(jsx_opening_element [(nested_identifier (identifier)) (identifier)] @font-lock-function-call-face) (jsx_closing_element [(nested_identifier (identifier)) (identifier)] @font- lock-function-call-face) (jsx_self_closing_element [(nested_identifier (identifier)) (identifier)] @font- lock-function-call-face) (jsx_attribute (property_identifier) @font-lock- constant-face)" "Debug the query with `treesit-query-validate'") " Indentation also has problems due to the deletion of "jsx_fragment" definition. The patch in attachment fixes both problems. Thank you Vincenzo p.s. nvim-treesitter tries to limit these problems by indicating which commit to install. Does it make sense to try a similar approach with emacs as well? --nextPart13327100.uLZWGnKmhe Content-Disposition: attachment; filename="0001-Updated-JSX-support-due-to-changes-in-tree-sitter-ja.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Updated-JSX-support-due-to-changes-in-tree-sitter-ja.patch" >From fab9765fdaa7d4712d0bf3b4b8068d02f4dd73c2 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Sat, 15 Jul 2023 13:47:41 +0200 Subject: [PATCH] Updated JSX support due to changes in tree-sitter-javascript A recent change in tree-sitter-javascript grammar support for JSX (commit bb1f97b), changed two things: 1. renamed nested_identifier to member_expression 2. removed jsx_fragment, jsx_text is used instead * lisp/progmodes/js-ts-mode.el: (js--treesit-font-lock-settings): replace nested_identifier with member_expression * lisp/progmodes/js-ts-mode.el: (js--treesit-indent-rules): replace jsx_fragment with jsx_text --- lisp/progmodes/js.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index de1a820ba11..7ee72a22daa 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3462,8 +3462,8 @@ js--treesit-indent-rules ((parent-is "statement_block") parent-bol js-indent-level) ;; JSX - ((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent js-indent-level) + ((match "<" "jsx_text") parent 0) + ((parent-is "jsx_text") parent js-indent-level) ((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent js-indent-level) ((parent-is "jsx_element") parent js-indent-level) @@ -3600,15 +3600,15 @@ js--treesit-font-lock-settings :language 'javascript :feature 'jsx '((jsx_opening_element - [(nested_identifier (identifier)) (identifier)] + [(member_expression (identifier)) (identifier)] @font-lock-function-call-face) (jsx_closing_element - [(nested_identifier (identifier)) (identifier)] + [(member_expression (identifier)) (identifier)] @font-lock-function-call-face) (jsx_self_closing_element - [(nested_identifier (identifier)) (identifier)] + [(member_expression (identifier)) (identifier)] @font-lock-function-call-face) (jsx_attribute -- 2.41.0 --nextPart13327100.uLZWGnKmhe--