From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 08:34:48 2023 Received: (at submit) by debbugs.gnu.org; 15 Jul 2023 12:34:49 +0000 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 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 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 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 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) 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) From: Vincenzo Pupillo To: bug-gnu-emacs@gnu.org Subject: 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 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-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 08:57:37 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 12:57:37 +0000 Received: from localhost ([127.0.0.1]:44345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKeq8-0004iG-Kn for submit@debbugs.gnu.org; Sat, 15 Jul 2023 08:57:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKeq6-0004i3-M1 for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 08:57:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKepy-0003fy-V0; Sat, 15 Jul 2023 08:57:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W0xFE9zqrg4cMsNdEEU/VJdO0TNHh5TbTNFAu2GcB8M=; b=r1W/CrGn/GD0 qfzBV/rWpAsaUE65gbwul8bFyPLwn2qlvKq4ncvGlro2KDuCByKpiN6Au2QBFQevekhigTEgyb+g6 gX6TZEX396pMTdAWJIeSVBm6X4ei3QDmSMaGRUD01ZiwuQJqWhCZSQ0DRKNKDxy6IEn3e9B2HNMIn DASBgN035Roc8KbkUww1rtM0d+C3dWF346Abfo6Xi+qLMJWhANSZFHThD1maxiJJ/Et9cfwFCyz/p TL3UuNeeOsLOqqnfV26Oeg/HKN8ZnGme9svfgRGCbE7VV1A+yMZ0vtDMFJeuvcU1c41LPMblsIC7O 8i3Ln148xBGkbqN4OlqF9Q==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKepw-0005cd-Mn; Sat, 15 Jul 2023 08:57:26 -0400 Date: Sat, 15 Jul 2023 15:57:46 +0300 Message-Id: <83y1jhbad1.fsf@gnu.org> From: Eli Zaretskii To: Vincenzo Pupillo , Theodor Thornhill , Jostein Kjonigsen In-Reply-To: <2171209.irdbgypaU6@fedora> (message from Vincenzo Pupillo on Sat, 15 Jul 2023 14:34:29 +0200) Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo > Date: Sat, 15 Jul 2023 14:34:29 +0200 > > 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. Will the patch work with the grammar libraries before the recent change? > 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? I think it is better if we make the code work with as many versions as possible, by checking whether a feature exists before using it. Theo, Jostein: any comments or ideas? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 09:23:26 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 13:23:26 +0000 Received: from localhost ([127.0.0.1]:44369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKfF8-0005On-BK for submit@debbugs.gnu.org; Sat, 15 Jul 2023 09:23:26 -0400 Received: from out-59.mta0.migadu.com ([91.218.175.59]:10734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKfF4-0005Oc-P5 for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 09:23:25 -0400 Date: Sat, 15 Jul 2023 15:23:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689427400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H5LZULW5ZDcLt4DZA5EIYCFXt94osfK+dg/rZx7M/mg=; b=WhEcSG+0G3CKxAMD4qf9ElxPtz/LCWXWJoqREij7EDY9rmnBQoHDRDjG13WVP8A4X0AOHN QOXsF/F9daTn01NCMEh28X1gXt0j6d3khKtQcmopWmdydxR++m6i0KrhY792z7t/OQEJUX xt3bmQAzVGySxTiysdORShG2ITnG8FsIzRgIkDFT1Q0GhzEBtU9DEcxg3DJM4KTJmIHO0B KTkI+N5VmtEZ0qdvgu+Udx32UM8jRk2MUKDUjAhyw5E4ftitorB580AN2g6oh2xWojG6oF 8pKQch7c3oVX7zQ6ud4osqXuFHdUq3fBD+449g1Sly7zF3wxzISmsM3oGW+YbQ== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii , Vincenzo Pupillo , Jostein Kjonigsen Subject: =?US-ASCII?Q?Re=3A_bug=2364647=3A_treesit-query-error_due_to_a_recent_?= =?US-ASCII?Q?change_to_tree-sitter-javascript_grammar_definition?= In-Reply-To: <83y1jhbad1.fsf@gnu.org> References: <2171209.irdbgypaU6@fedora> <83y1jhbad1.fsf@gnu.org> Message-ID: <0A7577D4-B484-425A-B49A-526C7FC77569@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 15 July 2023 14:57:46 CEST, Eli Zaretskii wrote: >> From: Vincenzo Pupillo >> Date: Sat, 15 Jul 2023 14:34:29 +0200 >>=20 >> this commit (bb1f97b643b77fc1f082d621bf533b4b14cf0c30) changed the defi= nition=20 >> of the JSX grammar to tree-sitter-javascript=2E This causes a node type= error: >> " >> Error while displaying: (jit-lock-function 1) reported (treesit-query-e= rror=20 >> "Node type error at" 24 "(jsx_opening_element [(nested_identifier (iden= tifier))=20 >> (identifier)] @font-lock-function-call-face) (jsx_closing_element=20 >> [(nested_identifier (identifier)) (identifier)] @font- lock-function-ca= ll-face)=20 >> (jsx_self_closing_element [(nested_identifier (identifier)) (identifier= )] @font- >> lock-function-call-face) (jsx_attribute (property_identifier) @font-loc= k- >> constant-face)" "Debug the query with `treesit-query-validate'") >> " >> Indentation also has problems due to the deletion of "jsx_fragment" def= inition=2E >>=20 >> The patch in attachment fixes both problems=2E > >Will the patch work with the grammar libraries before the recent >change? > >> p=2Es=2E nvim-treesitter tries to limit these problems by indicating wh= ich commit=20 >> to install=2E Does it make sense to try a similar approach with emacs a= s well?=20 > >I think it is better if we make the code work with as many versions as >possible, by checking whether a feature exists before using it=2E > >Theo, Jostein: any comments or ideas? > >Thanks=2E I'll look into it tonight - thanks for the heads up! Theo From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 13:54:10 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 17:54:11 +0000 Received: from localhost ([127.0.0.1]:46049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKjT8-0007QO-Hu for submit@debbugs.gnu.org; Sat, 15 Jul 2023 13:54:10 -0400 Received: from out-27.mta1.migadu.com ([95.215.58.27]:13529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKjT4-0007QB-Du for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 13:54:09 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689443645; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xwSIFKwmEtuknS6V5A6Ypr1k48VKkayQ8hUPqZ0DSvw=; b=muVToJxpse93FyEyVjqRW+dpduptOgTLxhRRf2Xb25okEbsh7+a6aoJ00bkn5ZrtAJiAfM sRy4qWyO+WV1LYx2NkTfDKJmru6s8x5IIR05WQ8P5342HEou+z3IloZ/8c10SCvelz0nmg leObZ9Umr5/OBZgPgz6PEVbxvhxR5BZwb3ZKzR/w6orj67zL1tO7oQqy89gHXy8ZMaVC5k IVvokW5kzvMrfPJds7cDwUBDz7EYDYErcIRBiHtIxKMmUdINKlloXdo5UkGFcA03ksF91R s4ukXJpJQYapcgSd6c47d7XWJPQ5es57mQ4dEgzBRoHMa+wNvj4zd781t/JB8g== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <83y1jhbad1.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 15 Jul 2023 15:57:46 +0300") References: <2171209.irdbgypaU6@fedora> <83y1jhbad1.fsf@gnu.org> Date: Sat, 15 Jul 2023 19:54:03 +0200 Message-ID: <874jm5rrgk.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, Vincenzo Pupillo , Jostein Kjonigsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Vincenzo Pupillo >> Date: Sat, 15 Jul 2023 14:34:29 +0200 >> >> 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. > > Will the patch work with the grammar libraries before the recent > change? > It will introduce regressions, but the patch itself is a change for the better, both in emacs land and in the grammar itself. >> 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? > > I think it is better if we make the code work with as many versions as > possible, by checking whether a feature exists before using it. > > Theo, Jostein: any comments or ideas? > > Thanks. I don't disagree, but I think this is a difficult problem to solve, but with an easy cop-out solution that most other implementors use - just refer to the last supported commit. We've had some discussions on this, but IIRC we never settled on anything. Personally, I think a ;;; Tree-sitter-version: bb1f97b643b77fc1f082d621bf533b4b14cf0c30 header may be the simplest way to at least signal some awareness here. That way the auto install mechanism can pull that hash directly and we can ensure some sort of compatibility checking. What do you think? @Vicenzo, seeing as this change only targets the JSX variant in js-ts-mode, could you possibly also make the according changes to tsx-ts-mode as well? Thanks, Theo From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 15:16:29 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 19:16:29 +0000 Received: from localhost ([127.0.0.1]:46097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKkkn-00017E-7B for submit@debbugs.gnu.org; Sat, 15 Jul 2023 15:16:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKkkk-000170-VV for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 15:16:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKkkf-000221-8K; Sat, 15 Jul 2023 15:16:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cKquB9C2cwvn680veP88W3D2eAeP/54iKMhmba4jG8Y=; b=D7SOJLifYs21 QY1LBwtXNSbcq94lUUDRDKCyYeZqIu67SEo0oemanPenO3MLo537F/d7IDTPgOcWb6FTwyLz6GzqR 3FPC8i1biU+I4AGcK6LIYraQH8RzD4InR5VpnAiuO7RqQzIqkZZ94iE1D1wOweNkfS7tPr5+F1dQg HEUQCSJK5GG02szU8gQFij1qh/zWV37Q+GLXuQ53UaIjqoQevkrmwQCU+1CjMdiqGnH7kASxBo/eg E7LZbwhamRPYdY5ayRBxTC/7CwYeI4U2rsBPSMGIt5FoPG6ObAMMbhMrKcKF33h69coPvTjNZ1/L1 jXPeSxLzMieMPfkCt+YuFw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKkke-0001dd-59; Sat, 15 Jul 2023 15:16:20 -0400 Date: Sat, 15 Jul 2023 22:16:42 +0300 Message-Id: <83edl9asth.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <874jm5rrgk.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 15 Jul 2023 19:54:03 +0200) Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <83y1jhbad1.fsf@gnu.org> <874jm5rrgk.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, v.pupillo@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: Vincenzo Pupillo , Jostein Kjonigsen > , 64647@debbugs.gnu.org > Date: Sat, 15 Jul 2023 19:54:03 +0200 > > Eli Zaretskii writes: > > >> The patch in attachment fixes both problems. > > > > Will the patch work with the grammar libraries before the recent > > change? > > > > It will introduce regressions, but the patch itself is a change for the > better, both in emacs land and in the grammar itself. What kinds of regressions? > I don't disagree, but I think this is a difficult problem to solve, but > with an easy cop-out solution that most other implementors use - just > refer to the last supported commit. We've had some discussions on this, > but IIRC we never settled on anything. Personally, I think a > > ;;; Tree-sitter-version: bb1f97b643b77fc1f082d621bf533b4b14cf0c30 > > header may be the simplest way to at least signal some awareness > here. That way the auto install mechanism can pull that hash directly > and we can ensure some sort of compatibility checking. > > What do you think? I think what I wrote: that we should try to make our modes work with reasonably old versions of the grammars, if that is practical. While in general it could be a very difficult, if not impossible, to achieve that, the question is whether this particular issue can be solved in that manner. If it can, we should do it. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 15:18:05 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 19:18:05 +0000 Received: from localhost ([127.0.0.1]:46101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKkmK-00019j-Nm for submit@debbugs.gnu.org; Sat, 15 Jul 2023 15:18:05 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:60869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKkmI-00019E-Fd for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 15:18:03 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc656873eso30865325e9.1 for <64647@debbugs.gnu.org>; Sat, 15 Jul 2023 12:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689448677; x=1692040677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SEyrmM7u8NItHQ/wcux0mAQzwGcxockonR0LUn2YteI=; b=lykn7wVBKQyrbwuqkXvzlZfERz4ryryONFDOHkLIoF7ZcbfSZo4j6Ka7dIRYrBVd63 8MhZgcLY+O3O8oeoVRQ9ZkJfPbwcCBhqltH2hI/WRTT+AL8YKli2ZNHOqv/Nbsn6dPbC K8rKkYoOrm5/9RSVJiviOp1sqrphO1lFac7aUa6n4lTLQ8kaaI/xUPNV27071zQ3YZN+ kFxbBTRJjE6bHmFnFRF2qLJFFp98k7UpeAoaMonoUIPfSlwStQpaj5aoPxiWx868Qnr8 W8V4g8VXGPzZyi3JDSp2V4H6Z0HZx1c+EAFs1j7wQnhBhXKNL4+Dk49HmT12knSuHRK8 0zVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689448677; x=1692040677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SEyrmM7u8NItHQ/wcux0mAQzwGcxockonR0LUn2YteI=; b=OFbBkeJjgTczxrHJeNJTnvSn0rIxIK4ZPVtpwL94Shw9ZlsN8sFFqf8gIA8v1TCBou OmYQ9vkYTukKP2nIaVy0liB8ZtM57X6aUywL9PZg00hsECKxskBBkPsrvyWAGzHq15Tl X96AZKoqxbPyQbNS47lLDX7ckAPBRaxv2rEVo2ZAI6nk8nPCXkq+qjp8NJPQQnftw07H Y2UDq35NnylSZIh8pf7MS/PmiDRodGigo7DBmZ0Ls3CBKPRwghKTpvrXJyLzzwQun6nL 9JGt0JBf9sg7PWZ7kL5bRXiMOU2KUAL2NzEbk0hml2CDtYjDlEBsCaV7zJxpLtQx5sj1 AvYQ== X-Gm-Message-State: ABy/qLbTGNr54T4Dg/aa5epQubmSRMCh8xTWT3Oxv/H3A6FRdMUt3Bk4 A4J94IAHKH2CUxhBeMjddiw= X-Google-Smtp-Source: APBJJlF0ji/cbC2KW8JdDnUxnRWZmSZrwfZX7yp1SyDkesdkaXF6FEW7cYfIBk3kdi+aiZPk1WET0g== X-Received: by 2002:a7b:cbcb:0:b0:3fb:e254:b81e with SMTP id n11-20020a7bcbcb000000b003fbe254b81emr8421549wmi.12.1689448676318; Sat, 15 Jul 2023 12:17:56 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id k2-20020a7bc402000000b003fc02e8ea68sm4294237wmi.13.2023.07.15.12.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 12:17:55 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii , Theodor Thornhill Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sat, 15 Jul 2023 21:17:54 +0200 Message-ID: <2289696.ElGaqSPkdT@fedora> In-Reply-To: <874jm5rrgk.fsf@thornhill.no> References: <2171209.irdbgypaU6@fedora> <83y1jhbad1.fsf@gnu.org> <874jm5rrgk.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4816812.GXAFRqVoOG" Content-Transfer-Encoding: 7Bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, Jostein Kjonigsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart4816812.GXAFRqVoOG Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi Theo, In data sabato 15 luglio 2023 19:54:03 CEST, Theodor Thornhill ha scritto: > Eli Zaretskii writes: > >> From: Vincenzo Pupillo > >> Date: Sat, 15 Jul 2023 14:34:29 +0200 > >> > >> 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. > > > > Will the patch work with the grammar libraries before the recent > > change? > > It will introduce regressions, but the patch itself is a change for the > better, both in emacs land and in the grammar itself. > > >> 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?> > > I think it is better if we make the code work with as many versions as > > possible, by checking whether a feature exists before using it. > > > > Theo, Jostein: any comments or ideas? > > > > Thanks. > > I don't disagree, but I think this is a difficult problem to solve, but > with an easy cop-out solution that most other implementors use - just > refer to the last supported commit. We've had some discussions on this, > but IIRC we never settled on anything. Personally, I think a > > ;;; Tree-sitter-version: bb1f97b643b77fc1f082d621bf533b4b14cf0c30 > > header may be the simplest way to at least signal some awareness > here. That way the auto install mechanism can pull that hash directly > and we can ensure some sort of compatibility checking. > > What do you think? > > @Vicenzo, seeing as this change only targets the JSX variant in > js-ts-mode, could you possibly also make the according changes to > tsx-ts-mode as well? Yes, and I also attached the previous one with a corrected commit message ((I had written js-ts-mode.el instead of js.el) Thanks, Vincenzo --nextPart4816812.GXAFRqVoOG 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.el: (js--treesit-font-lock-settings): replace nested_identifier with member_expression * lisp/progmodes/js.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 --nextPart4816812.GXAFRqVoOG Content-Disposition: attachment; filename="0002-Updated-JSX-support-due-to-changes-in-tree-sitter-ty.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0002-Updated-JSX-support-due-to-changes-in-tree-sitter-ty.patch" >From 5748f07f1465f30cbd31321d3f6806f8f8cb2b0c Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Sat, 15 Jul 2023 20:37:24 +0200 Subject: [PATCH] Updated JSX support due to changes in tree-sitter-typescript A recent change in tree-sitter-typescript grammar support for JSX (commit b893426), changed two things: 1. renamed nested_identifier to member_expression 2. removed jsx_fragment, jsx_text is used instead * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--font-lock-settings): replace nested_identifier with member_expression * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--indent-rules): replace jsx_fragment with jsx_text --- lisp/progmodes/typescript-ts-mode.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index ccf0026d7ba..ea04c6f24a3 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -110,8 +110,8 @@ typescript-ts-mode--indent-rules ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) ,@(when (eq language 'tsx) - `(((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + `(((match "<" "jsx_text") parent 0) + ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent typescript-ts-mode-indent-offset) ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) @@ -294,15 +294,15 @@ typescript-ts-mode--font-lock-settings :language language :feature 'jsx `((jsx_opening_element - [(nested_identifier (identifier)) (identifier)] + [(member_expression (identifier)) (identifier)] @typescript-ts-jsx-tag-face) (jsx_closing_element - [(nested_identifier (identifier)) (identifier)] + [(member_expression (identifier)) (identifier)] @typescript-ts-jsx-tag-face) (jsx_self_closing_element - [(nested_identifier (identifier)) (identifier)] + [(member_expression (identifier)) (identifier)] @typescript-ts-jsx-tag-face) (jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face)) -- 2.41.0 --nextPart4816812.GXAFRqVoOG-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 15:40:00 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 19:40:00 +0000 Received: from localhost ([127.0.0.1]:46133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKl7X-0001it-Lz for submit@debbugs.gnu.org; Sat, 15 Jul 2023 15:40:00 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:53681) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKl7U-0001iS-Iy for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 15:39:57 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3110ab7110aso3305907f8f.3 for <64647@debbugs.gnu.org>; Sat, 15 Jul 2023 12:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689449991; x=1692041991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sw/xqHgNyQ27QFDFCxMEwraueOkKhBU1eUA3KY2Oqcw=; b=ZOfWzAzRQD+3Qa4tkCPM4P5O4nsy3DPAXGG0H79r3I6uSJJXmX2ex2ekujUO5XD/Zc FdjrP+s7lnLXkVnU8VlnmoEGXCT6TvFWL4dXQPgols2rc8y4UlhNBbj/JBmW4CfoPieR dVFiK3gD/s7oKS5tLzD7bCjoOZaBRgNcprU64royD8iW1YDmLS1WzDUUFMNbPkQzSL2Y 3rrW5szpywSGxQinF4Ae9UXv2C5CZPDcmG5JxSKJTK9b487X1DCDPIP+KVbSep2ODWPG sL1VLUO3nM0/Thj77QCtFIjH0AhIybSNVREeaMcIN8yZkZa4d88LBQVvvi1yJSXiTOKk /kmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689449991; x=1692041991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sw/xqHgNyQ27QFDFCxMEwraueOkKhBU1eUA3KY2Oqcw=; b=kGZliX0UJ61uGxudhByxs/zOuGyiOZnUYQCaIN6nqeuENsiR+M7DS/LKE7gDHs+VfB bwd0VXiCtlV2pQO3ocyeCIgFS6tNcDgLSJgab03OMKBYTN9m000iBT25Zrq67oefyCGq 02+cdFLoojpoy9PdLqvtbJS9oNKrD17y4jz1t0QDk69R3zifVHCkjPiNQy/g5Pwj/Vtd OxH4GueOfkKKNUXyMeyqVWLR4gAmJL6Fcd1NMzIIS4SOSdV4crqXmuLY4raLyrakiQSF 7ITybYB8OSj8uGhjO4xOCM1tGz5e2hQkzFGOkXXhBrHE3ro1SZ4pv5dm4sFHHXfuXJZc GDtQ== X-Gm-Message-State: ABy/qLbEmhn+2OW3Nd0JA2U9xdPdac/indrI9WliF/cIEFWAj8Hk4B1w KF4BoFpXYT4XMRWKcDdtgrE= X-Google-Smtp-Source: APBJJlFXSdKia9kMq4Ln1IF2B9+G83RnYeuan1N4PvFgyjACnjYmVrG/T6zq04EIpxKNajwPleX0hA== X-Received: by 2002:a5d:60c6:0:b0:315:9de4:92f0 with SMTP id x6-20020a5d60c6000000b003159de492f0mr7066901wrt.5.1689449990489; Sat, 15 Jul 2023 12:39:50 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id k2-20020a5d5182000000b003143aa0ca8asm14576200wrv.13.2023.07.15.12.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 12:39:49 -0700 (PDT) From: Vincenzo Pupillo To: Theodor Thornhill , Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sat, 15 Jul 2023 21:39:49 +0200 Message-ID: <2891516.e9J7NaK4W3@fedora> In-Reply-To: <83edl9asth.fsf@gnu.org> References: <2171209.irdbgypaU6@fedora> <874jm5rrgk.fsf@thornhill.no> <83edl9asth.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) In data sabato 15 luglio 2023 21:16:42 CEST, Eli Zaretskii ha scritto: > > From: Theodor Thornhill > > Cc: Vincenzo Pupillo , Jostein Kjonigsen > > > > , 64647@debbugs.gnu.org > > > > Date: Sat, 15 Jul 2023 19:54:03 +0200 > > > > Eli Zaretskii writes: > > >> The patch in attachment fixes both problems. > > > > > > Will the patch work with the grammar libraries before the recent > > > change? > > > > It will introduce regressions, but the patch itself is a change for the > > better, both in emacs land and in the grammar itself. > > What kinds of regressions? > > > I don't disagree, but I think this is a difficult problem to solve, but > > with an easy cop-out solution that most other implementors use - just > > refer to the last supported commit. We've had some discussions on this, > > but IIRC we never settled on anything. Personally, I think a > > > > ;;; Tree-sitter-version: bb1f97b643b77fc1f082d621bf533b4b14cf0c30 > > > > header may be the simplest way to at least signal some awareness > > here. That way the auto install mechanism can pull that hash directly > > and we can ensure some sort of compatibility checking. > > > > What do you think? > > I think what I wrote: that we should try to make our modes work with > reasonably old versions of the grammars, if that is practical. While > in general it could be a very difficult, if not impossible, to achieve > that, the question is whether this particular issue can be solved in > that manner. If it can, we should do it. I can rewrite both patches in the same way I had patched java-ts-mode. Basically, there are only two changes. I think it would be useful to have a function to check whether grammar features are supported or not. For example, a specialized version of treesit-query-validate that could also be used in interactive mode (to simplify the development). Do I rewrite the patches? From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 16:45:38 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 20:45:38 +0000 Received: from localhost ([127.0.0.1]:46178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKm93-0003U8-OV for submit@debbugs.gnu.org; Sat, 15 Jul 2023 16:45:38 -0400 Received: from out-29.mta0.migadu.com ([91.218.175.29]:54480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKm90-0003Tz-UE for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 16:45:36 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689453933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oboLOkpsp1aLHG+Dgb360SN+C+yLh5mKbSqFO8dqkqI=; b=OzTbKZEcGKhn9RgvtiHPrsaLx5X3BKlOTbLWfMNRrTh0N2wVesCnAEIUFNeGhjEhNMvyYQ +D0i2MQF3nBtIj4cLxKd+GKX3WEY9HChRTaoWIkg9HPes5gbDIGo7Ny4VuOR4XmlRpzk+k Chk+j6sEY29Q1+rVbxw4CgIBoH9GZi3zgHk+B7l4iIKrh5ldUQSpW68Yc5JErjP7JYa+eg 0ZqFeOLRVj6lFXpRPFxhtjJSF/kcVnSTMIMFWuVfsEm3Wgq+NHynokmtxtFgyJAeCcTrCF T1gLxSOdSmTWtVqNICpZmQz6USSCj7LoxzAWWWQJuIPoQAddrHgM1jQZeWOA6w== From: Theodor Thornhill To: Vincenzo Pupillo Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <2891516.e9J7NaK4W3@fedora> (Vincenzo Pupillo's message of "Sat, 15 Jul 2023 21:39:49 +0200") References: <2171209.irdbgypaU6@fedora> <874jm5rrgk.fsf@thornhill.no> <83edl9asth.fsf@gnu.org> <2891516.e9J7NaK4W3@fedora> Date: Sat, 15 Jul 2023 22:45:31 +0200 Message-ID: <871qh8sy38.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, Eli Zaretskii , jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Vincenzo Pupillo writes: > In data sabato 15 luglio 2023 21:16:42 CEST, Eli Zaretskii ha scritto: >> > From: Theodor Thornhill >> > Cc: Vincenzo Pupillo , Jostein Kjonigsen >> > >> > , 64647@debbugs.gnu.org >> > >> > Date: Sat, 15 Jul 2023 19:54:03 +0200 >> > >> > Eli Zaretskii writes: >> > >> The patch in attachment fixes both problems. >> > > >> > > Will the patch work with the grammar libraries before the recent >> > > change? >> > >> > It will introduce regressions, but the patch itself is a change for the >> > better, both in emacs land and in the grammar itself. >> >> What kinds of regressions? >> Because the nodes seems to have been removed/swapped in for new ones, we will lose the functionality for people using versions < bb1f97b6. >> > I don't disagree, but I think this is a difficult problem to solve, but >> > with an easy cop-out solution that most other implementors use - just >> > refer to the last supported commit. We've had some discussions on this, >> > but IIRC we never settled on anything. Personally, I think a >> > >> > ;;; Tree-sitter-version: bb1f97b643b77fc1f082d621bf533b4b14cf0c30 >> > >> > header may be the simplest way to at least signal some awareness >> > here. That way the auto install mechanism can pull that hash directly >> > and we can ensure some sort of compatibility checking. >> > >> > What do you think? >> >> I think what I wrote: that we should try to make our modes work with >> reasonably old versions of the grammars, if that is practical. While >> in general it could be a very difficult, if not impossible, to achieve >> that, the question is whether this particular issue can be solved in >> that manner. If it can, we should do it. Yeah, I think we can do that in this case. I'm just wondering whether it's worth the effort or not. Should we introduce some notion of "deprecated" tree sitter functionalities? Otherwise I guess we'll have to maintain a growing set of compat-code, which over time will incur a performance cost, and it may be difficult to remember what code is compat-code and what isn't. > I can rewrite both patches in the same way I had patched java-ts-mode. > Basically, there are only two changes. I think it would be useful to have a > function to check whether grammar features are supported or not. For example, > a specialized version of treesit-query-validate that could also be used in > interactive mode (to simplify the development). > > Do I rewrite the patches? I seem to have missed the java-ts-mode patch. Where is it? Do you have such an implementation ready at hand? To me it sounds smart to have such a function, and it sounds like it should be in treesit.el, but that would probably be too late for emacs-29, I think? Do you want to write such a function Vincenzo? Theo From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 15 16:51:10 2023 Received: (at 64647) by debbugs.gnu.org; 15 Jul 2023 20:51:10 +0000 Received: from localhost ([127.0.0.1]:46183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKmEP-0003hI-KE for submit@debbugs.gnu.org; Sat, 15 Jul 2023 16:51:10 -0400 Received: from out-55.mta0.migadu.com ([2001:41d0:1004:224b::37]:60630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKmEM-0003h9-LC for 64647@debbugs.gnu.org; Sat, 15 Jul 2023 16:51:07 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689454265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=P8OFMG3s85oL/1yO2cLmHWvF5vmCEGDgoryc66QtUbU=; b=K8d0hcikT5aCM+PPgC8QWb7n7I3altlhhVRsNEvI7NC8/19O1WY54eEzqx5mZT9AZWVvSZ a8RGI0F7QaDB/WDPXwIFz/RVBD4em3v2tt/8lvzkkTvUyRlph6i2RZBZ0JTZ02b3Y+cs8w 32dU5q7Hc/2DiUJXvodUPqQRT3Z/6Vi2d6+nje3+cIBDMh6VhubU10tl6peb8e6X/xP/Kd xAnHSaU7eKOuFQGXZx/87VHBSniJ2TFUmIk8d0gInwNaqMnyVsy4MuKRr2GD5WVouvOSGt 2xhhkKQn/a6CWTO7DDhLSp077pLVJ1l0PZPUrch38dFImohyG3jbD2j7dTa3LQ== From: Theodor Thornhill To: Vincenzo Pupillo Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <2289696.ElGaqSPkdT@fedora> (Vincenzo Pupillo's message of "Sat, 15 Jul 2023 21:17:54 +0200") References: <2171209.irdbgypaU6@fedora> <83y1jhbad1.fsf@gnu.org> <874jm5rrgk.fsf@thornhill.no> <2289696.ElGaqSPkdT@fedora> Date: Sat, 15 Jul 2023 22:51:04 +0200 Message-ID: <87y1jgrj9j.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, Eli Zaretskii , Jostein Kjonigsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Vincenzo Pupillo writes: > Hi Theo, > > In data sabato 15 luglio 2023 19:54:03 CEST, Theodor Thornhill ha scritto: >> Eli Zaretskii writes: >> >> From: Vincenzo Pupillo >> >> Date: Sat, 15 Jul 2023 14:34:29 +0200 >> >> >> >> 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. >> > >> > Will the patch work with the grammar libraries before the recent >> > change? >> >> It will introduce regressions, but the patch itself is a change for the >> better, both in emacs land and in the grammar itself. >> >> >> 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?> >> > I think it is better if we make the code work with as many versions as >> > possible, by checking whether a feature exists before using it. >> > >> > Theo, Jostein: any comments or ideas? >> > >> > Thanks. >> >> I don't disagree, but I think this is a difficult problem to solve, but >> with an easy cop-out solution that most other implementors use - just >> refer to the last supported commit. We've had some discussions on this, >> but IIRC we never settled on anything. Personally, I think a >> >> ;;; Tree-sitter-version: bb1f97b643b77fc1f082d621bf533b4b14cf0c30 >> >> header may be the simplest way to at least signal some awareness >> here. That way the auto install mechanism can pull that hash directly >> and we can ensure some sort of compatibility checking. >> >> What do you think? >> >> @Vicenzo, seeing as this change only targets the JSX variant in >> js-ts-mode, could you possibly also make the according changes to >> tsx-ts-mode as well? > Yes, and I also attached the previous one with a corrected commit message ((I > had written js-ts-mode.el instead of js.el) > > Thanks, > Vincenzo Thanks - the patches looks good to me, but let's see what we end up with wrt backward-compatibility :) Theo From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 16 00:48:22 2023 Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 04:48:22 +0000 Received: from localhost ([127.0.0.1]:46362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKtgE-0001xx-5l for submit@debbugs.gnu.org; Sun, 16 Jul 2023 00:48:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKtgB-0001xA-QG for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 00:48:20 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKtg5-00007C-Pa; Sun, 16 Jul 2023 00:48:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=I7vhyRXeHz1iFgDda7uWgRt8MSfz1aC6RksvSz/5fDs=; b=SYj4P5X6keLo WG+SOpP1fxkwbCkgZqAvxyV5VsyUnGCnOOE2qjBZNoC6QuK9d+UrQWiPFoHQfWO/2VTEbUHa6UPip fMNWhz3gx8ahBr3qb976rhD/O3YoyBmc3TnNgjCwV+KxuFwSk7sPc5yM28eyLwwvh+nCyirzeMSdj tpTTw4sOx96S+B6YzaLd6pOALZeYxPX6gJD1lgGYA0R6JBMXE72F/hJavgRFwFlNma3W2nedVFFub oB3OuhuRccJz3H1RCd7rCqlM1Ez8LqyRJQHJ/fXPNLluaRkBbPcNzI0qIfHBAfX55of1OnHGFr97H giMLELtw+abD1hlEn0p8oQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKtg5-0000Ry-8L; Sun, 16 Jul 2023 00:48:13 -0400 Date: Sun, 16 Jul 2023 07:48:37 +0300 Message-Id: <837cr0bgwq.fsf@gnu.org> From: Eli Zaretskii To: Vincenzo Pupillo In-Reply-To: <2891516.e9J7NaK4W3@fedora> (message from Vincenzo Pupillo on Sat, 15 Jul 2023 21:39:49 +0200) Subject: Re: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <874jm5rrgk.fsf@thornhill.no> <83edl9asth.fsf@gnu.org> <2891516.e9J7NaK4W3@fedora> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net, theo@thornhill.no X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo > Cc: jostein@kjonigsen.net, 64647@debbugs.gnu.org > Date: Sat, 15 Jul 2023 21:39:49 +0200 > > > I think what I wrote: that we should try to make our modes work with > > reasonably old versions of the grammars, if that is practical. While > > in general it could be a very difficult, if not impossible, to achieve > > that, the question is whether this particular issue can be solved in > > that manner. If it can, we should do it. > I can rewrite both patches in the same way I had patched java-ts-mode. That would be good, thanks. > Basically, there are only two changes. I think it would be useful to have a > function to check whether grammar features are supported or not. For example, > a specialized version of treesit-query-validate that could also be used in > interactive mode (to simplify the development). Yes, a good idea. > Do I rewrite the patches? Yes, please. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 16 01:13:37 2023 Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 05:13:37 +0000 Received: from localhost ([127.0.0.1]:46377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKu4f-0002j8-Af for submit@debbugs.gnu.org; Sun, 16 Jul 2023 01:13:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKu4c-0002it-Sy for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 01:13:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKu4W-0007lK-KC; Sun, 16 Jul 2023 01:13:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SBbt510Jd9wK2ZDsZ9PR3PmrPDKY93PI7uzWWQLNj0A=; b=XMmCjWPK61pZ jzfQXo8l2uQyJ3CJRAtSSkuW2T9MGvLz8xhXxf6ouZnvPVQfn6fNZnAtCjsKQBM6QVjevKMKAUhqw WHQEaBJEnHvCjcbgBxHTSJKzCk82OAt71GUIF9+iA7VS8nmTsQ2yWBpmiYSmzjuYAzk2W7ZkKH5yV hvyzkcw636+/6ZliwmiXloEH8PrR2waV4Wkg2x7hKOCVRsoFx2DeZUJ4iTx9onfawjy9j/fJzQYDI WNGOfYS3qbbKQCfl/gnXEjHvnuy018DKrehmeLdVIzXyDn1WblKjWL4GOIi6RrdwtiAEei2wmJdJd JtxqMSixvksxCbwCKT3Irw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKu4O-0002vZ-Au; Sun, 16 Jul 2023 01:13:23 -0400 Date: Sun, 16 Jul 2023 08:13:43 +0300 Message-Id: <83351obfqw.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <871qh8sy38.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 15 Jul 2023 22:45:31 +0200) Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <874jm5rrgk.fsf@thornhill.no> <83edl9asth.fsf@gnu.org> <2891516.e9J7NaK4W3@fedora> <871qh8sy38.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, v.pupillo@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: Eli Zaretskii , 64647@debbugs.gnu.org, > jostein@kjonigsen.net > Date: Sat, 15 Jul 2023 22:45:31 +0200 > > >> > > Will the patch work with the grammar libraries before the recent > >> > > change? > >> > > >> > It will introduce regressions, but the patch itself is a change for the > >> > better, both in emacs land and in the grammar itself. > >> > >> What kinds of regressions? > >> > > Because the nodes seems to have been removed/swapped in for new ones, we > will lose the functionality for people using versions < bb1f97b6. That's what I thought. I think we should try to avoid such regressions if it's feasible. > >> I think what I wrote: that we should try to make our modes work with > >> reasonably old versions of the grammars, if that is practical. While > >> in general it could be a very difficult, if not impossible, to achieve > >> that, the question is whether this particular issue can be solved in > >> that manner. If it can, we should do it. > > Yeah, I think we can do that in this case. I'm just wondering whether > it's worth the effort or not. AFAIU, people tend to have old grammar libraries all the time. For example, we had a couple of bug reports for C or C++ which turned out to be due to grammar libraries that are not the latest HEAD of their respective repositories. Some people tend to use only official releases of those grammar libraries (for those which make releases; many don't). Also, you cannot upgrade the library while the Emacs session which uses it is running, so people who have long-running sessions and don't like to restart Emacs sometimes have no choice but to stay with an old library for some time. For these and other reasons, I think being less rigid in requiring the latest grammar libraries will benefit our users. > Should we introduce some notion of > "deprecated" tree sitter functionalities? Otherwise I guess we'll have > to maintain a growing set of compat-code, which over time will incur a > performance cost, and it may be difficult to remember what code is > compat-code and what isn't. I'm not afraid of compatibility code, as long as it's manageable. We could retire some of that as time passes. But we are not yet at a point where this compatibility code presents any significant issue, so I'd rather we delayed the decision until we come to that bridge. 1> > I can rewrite both patches in the same way I had patched java-ts-mode. > > Basically, there are only two changes. I think it would be useful to have a > > function to check whether grammar features are supported or not. For example, > > a specialized version of treesit-query-validate that could also be used in > > interactive mode (to simplify the development). > > > > Do I rewrite the patches? > > I seem to have missed the java-ts-mode patch. Where is it? Do you have > such an implementation ready at hand? To me it sounds smart to have such > a function, and it sounds like it should be in treesit.el, but that > would probably be too late for emacs-29, I think? A function will probably go to master, but an ad-hoc compatibility fix that doesn't regress for older grammar libraries would be welcome on emacs-29 (assuming it is not very complicated). Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 16 04:38:46 2023 Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 08:38:46 +0000 Received: from localhost ([127.0.0.1]:46754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKxHB-0000Ux-Tz for submit@debbugs.gnu.org; Sun, 16 Jul 2023 04:38:46 -0400 Received: from out-2.mta1.migadu.com ([95.215.58.2]:15007) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKxH8-0000Ul-1O for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 04:38:44 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689496719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1sjmMDOUMYkQRC2H0z3EDj1bhnz24gU9DU6Ketb071M=; b=uvhqKjlpxWo2pTJSAACTuAyAL/88JdV1RfU4K8D4Z9tdJddmrC6Px5EjOsZD05FgdDInXG D0hXDUIwjcX3dWxuZq8Lsg0HJDXy3pptQQtLOVO0z06tDd+aPyQwBHZQkTTPsu9iElqvKI J/Nczd90SIosSZVs+Vur+RupOiRces8tCbA3NJVPQVGD7YtiRw1w5y5onUsQiOyg8Qh+KI GL47XLAVMpUcBDzfNozNRKtCt1TbE+emPXUmaLvllc4Yp3ljKjYLzxxqSPAcRUbvFNBe0y qFvzpRAojC6yTIp+cGlyFQbXH5VdrSQg2BI/bM6A9FotMpqDsTtQJKfQpjRiqQ== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <83351obfqw.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 16 Jul 2023 08:13:43 +0300") References: <2171209.irdbgypaU6@fedora> <874jm5rrgk.fsf@thornhill.no> <83edl9asth.fsf@gnu.org> <2891516.e9J7NaK4W3@fedora> <871qh8sy38.fsf@thornhill.no> <83351obfqw.fsf@gnu.org> Date: Sun, 16 Jul 2023 10:38:37 +0200 Message-ID: <87lefgdzea.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, v.pupillo@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> >> Yeah, I think we can do that in this case. I'm just wondering whether >> it's worth the effort or not. > > AFAIU, people tend to have old grammar libraries all the time. For > example, we had a couple of bug reports for C or C++ which turned out > to be due to grammar libraries that are not the latest HEAD of their > respective repositories. Some people tend to use only official > releases of those grammar libraries (for those which make releases; > many don't). Also, you cannot upgrade the library while the Emacs > session which uses it is running, so people who have long-running > sessions and don't like to restart Emacs sometimes have no choice but > to stay with an old library for some time. > > For these and other reasons, I think being less rigid in requiring the > latest grammar libraries will benefit our users. > Sure! >> Should we introduce some notion of >> "deprecated" tree sitter functionalities? Otherwise I guess we'll have >> to maintain a growing set of compat-code, which over time will incur a >> performance cost, and it may be difficult to remember what code is >> compat-code and what isn't. > > I'm not afraid of compatibility code, as long as it's manageable. We > could retire some of that as time passes. But we are not yet at a > point where this compatibility code presents any significant issue, so > I'd rather we delayed the decision until we come to that bridge. > > 1> > I can rewrite both patches in the same way I had patched java-ts-mode. >> > Basically, there are only two changes. I think it would be useful to have a >> > function to check whether grammar features are supported or not. For example, >> > a specialized version of treesit-query-validate that could also be used in >> > interactive mode (to simplify the development). >> > >> > Do I rewrite the patches? >> >> I seem to have missed the java-ts-mode patch. Where is it? Do you have >> such an implementation ready at hand? To me it sounds smart to have such >> a function, and it sounds like it should be in treesit.el, but that >> would probably be too late for emacs-29, I think? > > A function will probably go to master, but an ad-hoc compatibility fix > that doesn't regress for older grammar libraries would be welcome on > emacs-29 (assuming it is not very complicated). > > Thanks. Sure - unless Vincenzo wants to tackle it, I can look into creating a function for master to check for available features. Vincenzo, do you want to add compat-code to emacs-29 and your patches? I can take care of the in-core function in a separate bug, if that makes sense :) Theo From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 16 14:00:54 2023 Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 18:00:54 +0000 Received: from localhost ([127.0.0.1]:48512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL63B-0005eb-TB for submit@debbugs.gnu.org; Sun, 16 Jul 2023 14:00:54 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:47574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL638-0005eO-R8 for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 14:00:52 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so36296685e9.3 for <64647@debbugs.gnu.org>; Sun, 16 Jul 2023 11:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689530445; x=1692122445; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HfWb+GGRSUyjr5c8GSe/dLnVnq1/8QPhAVQ1FqkM7A4=; b=Mzb9QXBR7O07NGY4WAZAkVGk5IRT/aIywDr/QCBKKi1OxOXRPf24naMuei1p/Fjmjt Ctjx33UNwr30b23ogJQH94yciww1ZaFXEGWMapuFHPxLST+9cQv95HJiUh0EHDMCYgNO yyJxtUbG1XjshuRIAh59mJNkJKuN2IxCeZIJVPRqWKLdHETW/ZVDkuQIq1GigYiSjrGq JmFzsFxt7lZ9OuIABeNa9JylIeyFzJ/uuD+Or7JiBeq7peupZrkzvDyMovcHDxNhiWdp ClazmF0h58HUsKmAwC9FD9JlYM0/8b6lTV1HebURi4gu2tKD8wEJAFhQUs3ib9pN9eUj 17zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689530445; x=1692122445; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HfWb+GGRSUyjr5c8GSe/dLnVnq1/8QPhAVQ1FqkM7A4=; b=gcH17+pH+py0j2kia1RIwjA7eAQH1ZMwwsyzc5w40fcyMQUu5pesWklBhKTWE6San+ uh+ihW3x6YY+6yisGOoBQ5ELTyHMSmDrawZtNb6NkFX1Kk0/ej1GXlBUIv+9rh8qXCsA AfwUqtBDTMqXa6F68izw0/JOhCasg6PsRgTl9RsI5FY8QF9sBA4jk2UnFTgddWD0ThQO sChaJ81T6SkM9xpE56DNS5CgGaCb7Pf8ne8AQZ0lf6QeTf9kItMG1lviMbX1GKLXUPaI eSy8/7Ci1USmPUKGCagH6u1TcvpMKZpqg/I8vEmrHdRhi1llfBBYfIxZ/OyKLAnrcyRp TQ2Q== X-Gm-Message-State: ABy/qLaAqwsWaXVC+N8L3yr6g28yt4de+Y/tDUwKw9ZfWL61Z44HgGHB sPirTYYskT+ia96/f8P/qTwzcMWlQD+wqg== X-Google-Smtp-Source: APBJJlFK+dz3vu80+R1ci5elAIk7ue+GvmpjyP5P8IznNqWPdr6iMP7NXGiqKMw5W4VhYY37VPXaFA== X-Received: by 2002:a05:600c:210c:b0:3fb:dd9c:72d2 with SMTP id u12-20020a05600c210c00b003fbdd9c72d2mr9223672wml.31.1689530444890; Sun, 16 Jul 2023 11:00:44 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id w19-20020a1cf613000000b003fa96fe2bd9sm6032871wmc.22.2023.07.16.11.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jul 2023 11:00:44 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii , Theodor Thornhill Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sun, 16 Jul 2023 20:00:43 +0200 Message-ID: <1861187.tdWV9SEqCh@fedora> In-Reply-To: <87lefgdzea.fsf@thornhill.no> References: <2171209.irdbgypaU6@fedora> <83351obfqw.fsf@gnu.org> <87lefgdzea.fsf@thornhill.no> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) In data domenica 16 luglio 2023 10:38:37 CEST, Theodor Thornhill ha scritto: > Eli Zaretskii writes: > >> Yeah, I think we can do that in this case. I'm just wondering whether > >> it's worth the effort or not. > > > > AFAIU, people tend to have old grammar libraries all the time. For > > example, we had a couple of bug reports for C or C++ which turned out > > to be due to grammar libraries that are not the latest HEAD of their > > respective repositories. Some people tend to use only official > > releases of those grammar libraries (for those which make releases; > > many don't). Also, you cannot upgrade the library while the Emacs > > session which uses it is running, so people who have long-running > > sessions and don't like to restart Emacs sometimes have no choice but > > to stay with an old library for some time. > > > > For these and other reasons, I think being less rigid in requiring the > > latest grammar libraries will benefit our users. > > Sure! > > >> Should we introduce some notion of > >> "deprecated" tree sitter functionalities? Otherwise I guess we'll have > >> to maintain a growing set of compat-code, which over time will incur a > >> performance cost, and it may be difficult to remember what code is > >> compat-code and what isn't. > > > > I'm not afraid of compatibility code, as long as it's manageable. We > > could retire some of that as time passes. But we are not yet at a > > point where this compatibility code presents any significant issue, so > > I'd rather we delayed the decision until we come to that bridge. > > > > 1> > I can rewrite both patches in the same way I had patched > > java-ts-mode. > > > >> > Basically, there are only two changes. I think it would be useful to > >> > have a > >> > function to check whether grammar features are supported or not. For > >> > example, a specialized version of treesit-query-validate that could > >> > also be used in interactive mode (to simplify the development). > >> > > >> > Do I rewrite the patches? > >> > >> I seem to have missed the java-ts-mode patch. Where is it? Do you have > >> such an implementation ready at hand? To me it sounds smart to have such > >> a function, and it sounds like it should be in treesit.el, but that > >> would probably be too late for emacs-29, I think? > > > > A function will probably go to master, but an ad-hoc compatibility fix > > that doesn't regress for older grammar libraries would be welcome on > > emacs-29 (assuming it is not very complicated). > > > > Thanks. > > Sure - unless Vincenzo wants to tackle it, I can look into creating a > function for master to check for available features. I am not familiar with the internal emacs treesitter binding. I would need some time to study it. However, I have seen that there are functions in the treesitter library that are not used by the current binding implementation. For example: ts_language_field_id_for_name could be useful to check whether a symbol is defined or not. In my patch for java-ts-mode I used treesit-query-capture to figure out whether a symbol was defined or not. Check out the java-ts-mode--string-highlight- helper function. > > Vincenzo, do you want to add compat-code to emacs-29 and your patches? Okay. I think I can do it this week. Do I create a new file, like treesitter- compat.el ? > I can take care of the in-core function in a separate bug, if that makes > sense :) > > Theo Vincenzo From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 16 14:19:23 2023 Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 18:19:23 +0000 Received: from localhost ([127.0.0.1]:48530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL6L4-0000OU-TI for submit@debbugs.gnu.org; Sun, 16 Jul 2023 14:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL6L2-0000OA-Vs for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 14:19:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qL6Kw-0004bX-GO; Sun, 16 Jul 2023 14:19:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=N8GaDhQfCL4AdCs70i6qs3bXSI+jXQkOf6ScX53XrA4=; b=nzDpu2uw3HGS Kh7TIgECzFaYNDh2oszmIt/PwahYbqHpQeMc5iGHMu1DgTEIlaPU/LzLKLZ/IzyOdT+LgK7RLcKx0 4ova0UYaRZdQ6gCPYGbbGn04SLzxBIrWwEwJCuNMzbXpe7Y3jtT4zsAFzTQKnFG98KeHzTsErvsgQ TXy7jQWdSKWz++ldsPl8udaYo4J8BcH8ocNfmp83jbAKltETRgOU1ToBnTBl2JOPLztYeeyJp0jI5 y52nxfUVF7jOy29GVzhTwJAkyUJzqmWZLCmzZxTXoDy1n8oOhrp8HuNqUCb8PC9WbOL6LEGM7njbT u+JGR8PaJoJpTr5aURLKNA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qL6Kw-0004ev-0Y; Sun, 16 Jul 2023 14:19:14 -0400 Date: Sun, 16 Jul 2023 21:19:38 +0300 Message-Id: <83h6q390sl.fsf@gnu.org> From: Eli Zaretskii To: Vincenzo Pupillo In-Reply-To: <1861187.tdWV9SEqCh@fedora> (message from Vincenzo Pupillo on Sun, 16 Jul 2023 20:00:43 +0200) Subject: Re: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <83351obfqw.fsf@gnu.org> <87lefgdzea.fsf@thornhill.no> <1861187.tdWV9SEqCh@fedora> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net, theo@thornhill.no X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo > Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net > Date: Sun, 16 Jul 2023 20:00:43 +0200 > > In my patch for java-ts-mode I used treesit-query-capture to figure out whether > a symbol was defined or not. Check out the java-ts-mode--string-highlight- > helper function. Can you do something similar in this case? That would be good enough for Emacs 29.1. > > Vincenzo, do you want to add compat-code to emacs-29 and your patches? > > Okay. I think I can do it this week. Do I create a new file, like treesitter- > compat.el ? This should be for master, I think. I'd like to release Emacs 29.1 soon, so this more general job should be less urgent than fixing the typescript modes to work with the latest grammars. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 16 14:56:22 2023 Received: (at 64647) by debbugs.gnu.org; 16 Jul 2023 18:56:22 +0000 Received: from localhost ([127.0.0.1]:48583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL6us-0001Sj-GV for submit@debbugs.gnu.org; Sun, 16 Jul 2023 14:56:22 -0400 Received: from out-54.mta1.migadu.com ([95.215.58.54]:23370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL6up-0001Sa-TI for 64647@debbugs.gnu.org; Sun, 16 Jul 2023 14:56:21 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689533778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hRd3U3aa/Qk73juaMWMQYgeZQsiYW6Kc8T4C7t+rLfc=; b=DGVAyogrzfeDi62xS+TDMP6VHAz48wuq+W9u9VHpfWur+WjMiasQJQptyvGj7SElDLcT0V WXf2slht/TSmYylO+Fgyty/YPOj26j5/eakBy4GXSdh7yNBWwsBF3UpbFIstswQyFxk06P XngSIL0CYTjHYG4jAaS+KwElT12AcUqig7KGLiMFJtWqin/BFhDDUM5pac4TYcEEhQ7/UK v0Z8ADVJZpoEQQqzBBXFvjqOt7GJyJuyj5M6wApcND3TucEZGoklpdXhGzKXliYsQ/Kc3J 8OlvCVNmj5yAlpQ/a/4XECOhZc13tKoWJ/6UZ1IQ02m2XI4/F/Xfx4hxJZlTEQ== From: Theodor Thornhill To: Eli Zaretskii , Vincenzo Pupillo Subject: Re: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <83h6q390sl.fsf@gnu.org> References: <2171209.irdbgypaU6@fedora> <83351obfqw.fsf@gnu.org> <87lefgdzea.fsf@thornhill.no> <1861187.tdWV9SEqCh@fedora> <83h6q390sl.fsf@gnu.org> Date: Sun, 16 Jul 2023 20:56:15 +0200 Message-ID: <87ilajeldc.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Vincenzo Pupillo >> Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net >> Date: Sun, 16 Jul 2023 20:00:43 +0200 >> >> In my patch for java-ts-mode I used treesit-query-capture to figure out whether >> a symbol was defined or not. Check out the java-ts-mode--string-highlight- >> helper function. > > Can you do something similar in this case? That would be good enough > for Emacs 29.1. > >> > Vincenzo, do you want to add compat-code to emacs-29 and your patches? >> >> Okay. I think I can do it this week. Do I create a new file, like treesitter- >> compat.el ? > > This should be for master, I think. I'd like to release Emacs 29.1 > soon, so this more general job should be less urgent than fixing the > typescript modes to work with the latest grammars. > > Thanks. Yeah, I was thinking maybe we could just have a check in the major-mode init, and appending the appropriate nodes into the treesit-simple-indent-rules there, rather than in the variable itself. That way we can avoid performance regressions in the indentation code. That would mean to extract the nodes you changed in your current patches, maybe add them to a new variable with a name of your choosing, and conditionally add either-or when the mode inits. Does that make sense? Thanks, Theo From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 17 17:24:33 2023 Received: (at 64647) by debbugs.gnu.org; 17 Jul 2023 21:24:33 +0000 Received: from localhost ([127.0.0.1]:51059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLVho-00012e-BJ for submit@debbugs.gnu.org; Mon, 17 Jul 2023 17:24:33 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:47584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLVhk-00012O-CW for 64647@debbugs.gnu.org; Mon, 17 Jul 2023 17:24:31 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc63c2e84so49691825e9.3 for <64647@debbugs.gnu.org>; Mon, 17 Jul 2023 14:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689629062; x=1692221062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7/NPkgvRJg64lIFrhJ/mAyOMbdOlAYnQPn8FWpDZk0Q=; b=ojRGE0CdLdT8poMXh06IfpExtee9RDnzk7fKhTgHGR5f5gBi4xTs+n40JmpYddxZhe TtgI9uwegaqkc7457gB47vhYZb0ODsAE1BUfYULwRMlHnpsgx82k47jM7QkGyRDnh58o T+fHl6YuH+ckO5t6kseSUWj5mPRqs/sMUkx9X1Pp60oB/NNQ1digCxADBkwN7m5Zp2zD KSAjbbDZgrK+Rd4JEeNbFQ5CtaRYRb3TcQE22LHn7E/1lUf46Rx/e44Tp3WQoUmTHFtx x2WOhZ8Bt946yNVsHB+j6WFfufD4OdDutBb2aWHcrO7Ek3Ej5F36H0xrqPM12Q8Rz2ar Wjmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689629062; x=1692221062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7/NPkgvRJg64lIFrhJ/mAyOMbdOlAYnQPn8FWpDZk0Q=; b=LjureqF93ocNI3ndcAr02HXwya/iZlSBSlfql6kC4ZVyG0PRNUkSdVMFjCR/wpeTY7 xIvvrtYF2csKKI7VrfcezHEMuAe3M5J5+/y7uTdhQ1/jv0HgF8tce7BXAD711yGOfxFm oC5T6q39CyRExAAZebivlzUzectdzfCLD6swReg7nDBKfLAR0+lbJvTgyob+T5JTV3ZY 6+dCnQdGsJnOlbd9ciwAQ7IcHahR8BKinWdBBXDucB4yIiE0FvGWt7GA6NOziI/ip2+h /W8SqwaZOZM7aBsOJm+ZZTAfMCUaeWo4TRZqtG3xM85lb4h9GPAs3fQoHxeO1ce3c7W/ O8fg== X-Gm-Message-State: ABy/qLaM5WQ8OqanhdVFKtRtklPkAjhHJVjwNw55ADZ7w0o6qO67q9sw SPhuS2lbPUuPuT+Kl5eMnAw= X-Google-Smtp-Source: APBJJlHzZYPes+5N/bIR/eO35b7ZjwPhtPl6KXtZt36SnPky1EiPbpQrj/JWc7SS94wsINbjsrhMUg== X-Received: by 2002:a05:600c:364a:b0:3f6:2ae:230e with SMTP id y10-20020a05600c364a00b003f602ae230emr409124wmq.3.1689629061748; Mon, 17 Jul 2023 14:24:21 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id r1-20020adfdc81000000b0031412b685d2sm471917wrj.32.2023.07.17.14.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 14:24:21 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Mon, 17 Jul 2023 23:24:20 +0200 Message-ID: <7580204.EvYhyI6sBW@fedora> In-Reply-To: <83h6q390sl.fsf@gnu.org> References: <2171209.irdbgypaU6@fedora> <1861187.tdWV9SEqCh@fedora> <83h6q390sl.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3783623.kQq0lBPeGt" Content-Transfer-Encoding: 7Bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net, theo@thornhill.no X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart3783623.kQq0lBPeGt Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, In data domenica 16 luglio 2023 20:19:38 CEST, Eli Zaretskii ha scritto: > > From: Vincenzo Pupillo > > Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net > > Date: Sun, 16 Jul 2023 20:00:43 +0200 > > > > In my patch for java-ts-mode I used treesit-query-capture to figure out > > whether a symbol was defined or not. Check out the > > java-ts-mode--string-highlight- helper function. > > Can you do something similar in this case? That would be good enough > for Emacs 29.1. In attachment you can find the new version of the patches (similar to the patch that i made for java-ts-mode). The patches were made on the branch emacs-29. Both work with the latest grammar. The javascript version is reliable, the typescrypt version seems reliable. In fact, drum roll, with typescrypt both tests: 1. (treesit-query-capture 'typescript '((member_expression) @capture)) ;; the new node type 2. (treesit-query-capture 'typescript '((nested_identifier) @capture)) ;; the old node type both return nil !!! If you use #2, then treesitter-ts-mode font lock gives an error! This happens only for font-lock, while for indentation everything works correctly. No problem for javascript, it works as expected for font-lock. The old node type returns an error with treesit-query-capture. @Theo: I am not sure if the indentation works if I add the new rules to treesit-simple-indent-rules in the Init function. I am writing a major-mode for php and, unless I am mistaken or due to problems with the various treesitter parsers, the order seems to be important. P.S. I opened two issues (one moth ago) for tree-sitter-php because it flags variables with names in non-Western characters as errors. tree-sitter-html, after they rewrote the parse from C++ to C, it crashed when used in conjunction with other parsers. Sorry for the length of this email (and for my English) Vincenzo --nextPart3783623.kQq0lBPeGt 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 c6a93b510378756f2eff01a11ef4f9127a5e5d17 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 17 Jul 2023 22:20:44 +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.el: (js--treesit-indent-helper): indent helper function for handle different tree-sitter-javascript version * lisp/progmodes/js.el: (js--treesit-indent-rules): use the new function * lisp/progmodes/js.el: (js--treesit-font-lock-helper): font lock helper function for handle different tree-sitter-javascript version * lisp/progmodes/js.el: (js--treesit-font-lock-settings): use the new function --- lisp/progmodes/js.el | 65 ++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index a05bd758dbc..f5158195500 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3427,6 +3427,18 @@ This function is intended for use in `after-change-functions'." ;;; Tree sitter integration +(defun js--treesit-indent-helper () + "Indent rules helper, for handle different release of tree-sitter-javascript. +Check if a node type is available, then return the right indent rules." + ;; handle commit bb1f97b + (condition-case nil + (progn (treesit-query-capture 'javascript '((jsx_fragment) @capture)) + `(((match "<" "jsx_fragment") parent 0) + ((parent-is "jsx_fragment") parent js-indent-level))) + (error + `(((match "<" "jsx_text") parent 0) + ((parent-is "jsx_text") parent js-indent-level))))) + (defvar js--treesit-indent-rules (let ((switch-case (rx "switch_" (or "case" "default")))) `((javascript @@ -3462,8 +3474,9 @@ This function is intended for use in `after-change-functions'." ((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_fragment") parent 0) + ;; ((parent-is "jsx_fragment") parent js-indent-level) + (js--treesit-indent-helper) ((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent js-indent-level) ((parent-is "jsx_element") parent js-indent-level) @@ -3490,6 +3503,36 @@ This function is intended for use in `after-change-functions'." "&&" "||" "!") "JavaScript operators for tree-sitter font-locking.") +(defun js--treesit-font-lock-helper () + "Font lock rules helper, for handle different release of tree-sitter-javascript. +Check if a node type is available, then return the right font lock rules." + ;; handle commit bb1f97b + (condition-case nil + (progn (treesit-query-capture 'javascript '((member_expression) @capture)) + '((jsx_opening_element + [(member_expression (identifier)) (identifier)] + @font-lock-function-call-face) + + (jsx_closing_element + [(member_expression (identifier)) (identifier)] + @font-lock-function-call-face) + + (jsx_self_closing_element + [(member_expression (identifier)) (identifier)] + @font-lock-function-call-face))) + (error + '((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))))) + (defvar js--treesit-font-lock-settings (treesit-font-lock-rules @@ -3599,21 +3642,9 @@ This function is intended for use in `after-change-functions'." :language 'javascript :feature 'jsx - '((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)) + (append + (js--treesit-font-lock-helper) + '((jsx_attribute (property_identifier) @font-lock-constant-face))) :language 'javascript :feature 'number -- 2.41.0 --nextPart3783623.kQq0lBPeGt Content-Disposition: attachment; filename="0002-Updated-JSX-support-due-to-changes-in-tree-sitter-ty.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0002-Updated-JSX-support-due-to-changes-in-tree-sitter-ty.patch" >From 263c9f0eca3a7df7cb29306297d32358f0e6537c Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 17 Jul 2023 22:32:13 +0200 Subject: [PATCH] Updated JSX support due to changes in tree-sitter-typescript A recent change in tree-sitter-typescript grammar support for JSX (commit b893426), changed two things: 1. renamed nested_identifier to member_expression 2. removed jsx_fragment, jsx_text is used instead * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--indent-helper): indent helper function for handle different tree-sitter-javascript version * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--indent-rules): use the new function * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--font-lock-helper): font lock helper function for handle different tree-sitter-javascript version * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--font-lock-settings): use the new function --- lisp/progmodes/typescript-ts-mode.el | 64 +++++++++++++++++++++------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 5df34de0472..2de7587e43a 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -75,6 +75,18 @@ table) "Syntax table for `typescript-ts-mode'.") +(defun typescript-ts-mode--indent-helper () + "Indent rules helper, for handle different release of tree-sitter-typescript. +Check if a node type is available, then return the right indent rules." + ;; handle commit b893426 + (condition-case nil + (progn (treesit-query-capture 'javascript '((jsx_fragment) @capture)) + `(((match "<" "jsx_fragment") parent 0) + ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset))) + (error + `(((match "<" "jsx_text") parent 0) + ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset))))) + (defun typescript-ts-mode--indent-rules (language) "Rules used for indentation. Argument LANGUAGE is either `typescript' or `tsx'." @@ -110,8 +122,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) ,@(when (eq language 'tsx) - `(((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) + `((typescript-ts-mode--indent-helper) ((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent typescript-ts-mode-indent-offset) ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) @@ -142,6 +153,39 @@ Argument LANGUAGE is either `typescript' or `tsx'." "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") +(defun typescript-ts-mode--font-lock-helper () + "Font lock rules helper, for handle different release of tree-sitter-typescript. +Check if a node type is available, then return the right font lock rules." + ;; handle commit bb1f97b + ;; Warning: treesitter-query-capture says both node types are valid, + ;; but then raises an error if the wrong node type is used. So it is + ;; important to check with the new node type (member_expression) + (condition-case nil + (progn (treesit-query-capture 'typescript '((member_expression) @capture)) + '((jsx_opening_element + [(member_expression (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_closing_element + [(member_expression (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_self_closing_element + [(member_expression (identifier)) (identifier)] + @typescript-ts-jsx-tag-face))) + (error + '((jsx_opening_element + [(nested_identifier (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_closing_element + [(nested_identifier (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_self_closing_element + [(nested_identifier (identifier)) (identifier)] + @typescript-ts-jsx-tag-face))))) + (defun typescript-ts-mode--font-lock-settings (language) "Tree-sitter font-lock settings. Argument LANGUAGE is either `typescript' or `tsx'." @@ -293,19 +337,9 @@ Argument LANGUAGE is either `typescript' or `tsx'." :language language :feature 'jsx - `((jsx_opening_element - [(nested_identifier (identifier)) (identifier)] - @typescript-ts-jsx-tag-face) - - (jsx_closing_element - [(nested_identifier (identifier)) (identifier)] - @typescript-ts-jsx-tag-face) - - (jsx_self_closing_element - [(nested_identifier (identifier)) (identifier)] - @typescript-ts-jsx-tag-face) - - (jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face)) + (append + (typescript-ts-mode--font-lock-helper) + `((jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face))) :language language :feature 'number -- 2.41.0 --nextPart3783623.kQq0lBPeGt-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 01:11:19 2023 Received: (at 64647) by debbugs.gnu.org; 19 Jul 2023 05:11:20 +0000 Received: from localhost ([127.0.0.1]:54715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLzT5-0000zZ-4F for submit@debbugs.gnu.org; Wed, 19 Jul 2023 01:11:19 -0400 Received: from out-44.mta1.migadu.com ([2001:41d0:203:375::2c]:43871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLzSz-0000zM-QE for 64647@debbugs.gnu.org; Wed, 19 Jul 2023 01:11:18 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1689743472; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PppGjJcSbend/n6G9iKG/JBrv7YTSyisF69D+0qLIek=; b=N5NkoD+JHIqTReR1qnxZBQtwKWiEJNBeZgPZo0RYU8dJ5v+7BNnaRDfjQmRLluEbPbZIXP PUF+zjK/u3GYjvX/oG6qNLf7enh0XenDoVagIv8gIKtGUu7JkxUrHsr6zKPrXwNUoOw870 up9V5RvY7abychQToEYtw6TwrDNoumg0C2tIsh0jCsNcFPpbEwQhF79y0sHWOIai1tyXJS FreAnqAljC/yB7YWnOvV8GQo3/Vhf/vK8kwk78CLJdPaa+Swmd3uIfaqxXBFgsvtfYC8tR ERsdKnLZNl0SsX3p7ib9bQtW7EY8Al6K4n5GpPB8QW6BkvYSTn/leCFwcp3/mw== From: Theodor Thornhill To: Vincenzo Pupillo , Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <7580204.EvYhyI6sBW@fedora> References: <2171209.irdbgypaU6@fedora> <1861187.tdWV9SEqCh@fedora> <83h6q390sl.fsf@gnu.org> <7580204.EvYhyI6sBW@fedora> Date: Wed, 19 Jul 2023 07:11:05 +0200 Message-ID: <87fs5keb9y.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Vincenzo Pupillo writes: > Hi, > > In data domenica 16 luglio 2023 20:19:38 CEST, Eli Zaretskii ha scritto: >> > From: Vincenzo Pupillo >> > Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net >> > Date: Sun, 16 Jul 2023 20:00:43 +0200 >> > >> > In my patch for java-ts-mode I used treesit-query-capture to figure out >> > whether a symbol was defined or not. Check out the >> > java-ts-mode--string-highlight- helper function. >> >> Can you do something similar in this case? That would be good enough >> for Emacs 29.1. > > In attachment you can find the new version of the patches (similar to the patch > that i made for java-ts-mode). > The patches were made on the branch emacs-29. > > Both work with the latest grammar. The javascript version is reliable, the > typescrypt version seems reliable. In fact, drum roll, with typescrypt both > tests: > 1. (treesit-query-capture 'typescript '((member_expression) @capture)) ;; the > new node type > 2. (treesit-query-capture 'typescript '((nested_identifier) @capture)) ;; the > old node type > both return nil !!! > If you use #2, then treesitter-ts-mode font lock gives an error! > This happens only for font-lock, while for indentation everything works > correctly. For Typescript these changes should go into 'tsx-ts-mode, not 'typescript-ts-mode. That may be why you are seeing some strange results? > > No problem for javascript, it works as expected for font-lock. The old node > type returns an error with treesit-query-capture. > > @Theo: I am not sure if the indentation works if I add the new rules to > treesit-simple-indent-rules in the Init function. I am writing a major-mode > for php and, unless I am mistaken or due to problems with the various > treesitter parsers, the order seems to be important. Thanks! Some minor comments (all of which apply to both patches, even though the comment is only for one of them): > > From c6a93b510378756f2eff01a11ef4f9127a5e5d17 Mon Sep 17 00:00:00 2001 > From: Vincenzo Pupillo > Date: Mon, 17 Jul 2023 22:20:44 +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.el: (js--treesit-indent-helper): indent helper > function for handle different tree-sitter-javascript version > * lisp/progmodes/js.el: (js--treesit-indent-rules): use the new > function > * lisp/progmodes/js.el: (js--treesit-font-lock-helper): font lock > helper function for handle different tree-sitter-javascript version > * lisp/progmodes/js.el: (js--treesit-font-lock-settings): use the new > function > --- "... function to handle ..." > lisp/progmodes/js.el | 65 ++++++++++++++++++++++++++++++++------------ > 1 file changed, 48 insertions(+), 17 deletions(-) > > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > index a05bd758dbc..f5158195500 100644 > --- a/lisp/progmodes/js.el > +++ b/lisp/progmodes/js.el > @@ -3427,6 +3427,18 @@ This function is intended for use in `after-change-functions'." > > ;;; Tree sitter integration > > +(defun js--treesit-indent-helper () > + "Indent rules helper, for handle different release of tree-sitter-javascript. > +Check if a node type is available, then return the right indent rules." "Indent rules helper, to handle different releases of tree-sitter-javascript." > + ;; handle commit bb1f97b > + (condition-case nil > + (progn (treesit-query-capture 'javascript '((jsx_fragment) @capture)) > + `(((match "<" "jsx_fragment") parent 0) > + ((parent-is "jsx_fragment") parent js-indent-level))) > + (error > + `(((match "<" "jsx_text") parent 0) > + ((parent-is "jsx_text") parent js-indent-level))))) > + > (defvar js--treesit-indent-rules > (let ((switch-case (rx "switch_" (or "case" "default")))) > `((javascript > @@ -3462,8 +3474,9 @@ This function is intended for use in `after-change-functions'." > ((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_fragment") parent 0) > + ;; ((parent-is "jsx_fragment") parent js-indent-level) > + (js--treesit-indent-helper) > ((node-is "jsx_closing_element") parent 0) > ((match "jsx_element" "statement") parent js-indent-level) > ((parent-is "jsx_element") parent js-indent-level) > @@ -3490,6 +3503,36 @@ This function is intended for use in `after-change-functions'." > "&&" "||" "!") > "JavaScript operators for tree-sitter font-locking.") > > +(defun js--treesit-font-lock-helper () > + "Font lock rules helper, for handle different release of tree-sitter-javascript. > +Check if a node type is available, then return the right font lock rules." Same little comment here. > + ;; handle commit bb1f97b > + (condition-case nil > + (progn (treesit-query-capture 'javascript '((member_expression) @capture)) > + '((jsx_opening_element > + [(member_expression (identifier)) (identifier)] > + @font-lock-function-call-face) > + > + (jsx_closing_element > + [(member_expression (identifier)) (identifier)] > + @font-lock-function-call-face) > + > + (jsx_self_closing_element > + [(member_expression (identifier)) (identifier)] > + @font-lock-function-call-face))) > + (error > + '((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))))) > + The indentation here looks off. Can you format this? > (defvar js--treesit-font-lock-settings > (treesit-font-lock-rules > > @@ -3599,21 +3642,9 @@ This function is intended for use in `after-change-functions'." > > :language 'javascript > :feature 'jsx > - '((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)) > + (append > + (js--treesit-font-lock-helper) > + '((jsx_attribute (property_identifier) @font-lock-constant-face))) > > :language 'javascript > :feature 'number > -- > 2.41.0 > > From 263c9f0eca3a7df7cb29306297d32358f0e6537c Mon Sep 17 00:00:00 2001 > From: Vincenzo Pupillo > Date: Mon, 17 Jul 2023 22:32:13 +0200 > Subject: [PATCH] Updated JSX support due to changes in tree-sitter-typescript > > A recent change in tree-sitter-typescript grammar support for > JSX (commit b893426), changed two things: > 1. renamed nested_identifier to member_expression > 2. removed jsx_fragment, jsx_text is used instead > > * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--indent-helper): indent helper > function for handle different tree-sitter-javascript version > * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--indent-rules): use the new > function > * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--font-lock-helper): font lock > helper function for handle different tree-sitter-javascript version > * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--font-lock-settings): use the new > function > --- > lisp/progmodes/typescript-ts-mode.el | 64 +++++++++++++++++++++------- > 1 file changed, 49 insertions(+), 15 deletions(-) > > diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el > index 5df34de0472..2de7587e43a 100644 > --- a/lisp/progmodes/typescript-ts-mode.el > +++ b/lisp/progmodes/typescript-ts-mode.el > @@ -75,6 +75,18 @@ > table) > "Syntax table for `typescript-ts-mode'.") > This seems to not be properly converted to tsx from javascript, both in the docstring and code. Also, I think the name is wrong. Maybe it should describe its intent a little more closely, something like "tsx-ts-mode--indent-compatibility-b893426"? > +(defun typescript-ts-mode--indent-helper () ^^^^^^^tsx-ts-mode > + "Indent rules helper, for handle different release of tree-sitter-typescript. > +Check if a node type is available, then return the right indent rules." > + ;; handle commit b893426 > + (condition-case nil > + (progn (treesit-query-capture 'javascript '((jsx_fragment) @capture)) 'tsx^^^^^^^, right? > + `(((match "<" "jsx_fragment") parent 0) > + ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset))) > + (error > + `(((match "<" "jsx_text") parent 0) > + ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset))))) > + > (defun typescript-ts-mode--indent-rules (language) > "Rules used for indentation. > Argument LANGUAGE is either `typescript' or `tsx'." > @@ -110,8 +122,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." > ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) > > ,@(when (eq language 'tsx) > - `(((match "<" "jsx_fragment") parent 0) > - ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) > + `((typescript-ts-mode--indent-helper) > ((node-is "jsx_closing_element") parent 0) > ((match "jsx_element" "statement") parent typescript-ts-mode-indent-offset) > ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) > @@ -142,6 +153,39 @@ Argument LANGUAGE is either `typescript' or `tsx'." > "&&" "||" "!" "?.") > "TypeScript operators for tree-sitter font-locking.") > Same naming comment here, and the language is wrong. It should be 'tsx, not 'typescript. > +(defun typescript-ts-mode--font-lock-helper () > + "Font lock rules helper, for handle different release of tree-sitter-typescript. > +Check if a node type is available, then return the right font lock rules." > + ;; handle commit bb1f97b > + ;; Warning: treesitter-query-capture says both node types are valid, > + ;; but then raises an error if the wrong node type is used. So it is > + ;; important to check with the new node type (member_expression) > + (condition-case nil > + (progn (treesit-query-capture 'typescript '((member_expression) @capture)) > + '((jsx_opening_element > + [(member_expression (identifier)) (identifier)] > + @typescript-ts-jsx-tag-face) > + > + (jsx_closing_element > + [(member_expression (identifier)) (identifier)] > + @typescript-ts-jsx-tag-face) > + > + (jsx_self_closing_element > + [(member_expression (identifier)) (identifier)] > + @typescript-ts-jsx-tag-face))) > + (error > + '((jsx_opening_element > + [(nested_identifier (identifier)) (identifier)] > + @typescript-ts-jsx-tag-face) > + > + (jsx_closing_element > + [(nested_identifier (identifier)) (identifier)] > + @typescript-ts-jsx-tag-face) > + > + (jsx_self_closing_element > + [(nested_identifier (identifier)) (identifier)] > + @typescript-ts-jsx-tag-face))))) > + > (defun typescript-ts-mode--font-lock-settings (language) > "Tree-sitter font-lock settings. > Argument LANGUAGE is either `typescript' or `tsx'." > @@ -293,19 +337,9 @@ Argument LANGUAGE is either `typescript' or `tsx'." > > :language language > :feature 'jsx > - `((jsx_opening_element > - [(nested_identifier (identifier)) (identifier)] > - @typescript-ts-jsx-tag-face) > - > - (jsx_closing_element > - [(nested_identifier (identifier)) (identifier)] > - @typescript-ts-jsx-tag-face) > - > - (jsx_self_closing_element > - [(nested_identifier (identifier)) (identifier)] > - @typescript-ts-jsx-tag-face) > - > - (jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face)) > + (append > + (typescript-ts-mode--font-lock-helper) > + `((jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face))) > > :language language > :feature 'number > -- > 2.41.0 Thanks for the patch :) Theo From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 20 06:14:18 2023 Received: (at 64647) by debbugs.gnu.org; 20 Jul 2023 10:14:18 +0000 Received: from localhost ([127.0.0.1]:57716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMQfp-0000xa-Dh for submit@debbugs.gnu.org; Thu, 20 Jul 2023 06:14:18 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:61505) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMQfn-0000wu-4Q for 64647@debbugs.gnu.org; Thu, 20 Jul 2023 06:14:15 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-992e22c09edso95044666b.2 for <64647@debbugs.gnu.org>; Thu, 20 Jul 2023 03:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689848049; x=1690452849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=goykyrOjhu0vQ/ryK1OjSWFJ6jbwwIkl+YvCdFHuGsI=; b=lAc3kfwtOu4X5WR2owwzZZZoCV49sxTOx1yFlSgJSOzxhnZtjeX5C4JhZKu3oOm4e7 J5ynS71t0u1KmBEi8/xc5OZvMw7Z1yTfHM/q2PxRfb/M1/8Pc1jOf1t88DNGcM/YPste rs7L6c+VM2Ydn6Xjkwt04x9+gG852FKyUODwjkprWF6yiOVMcHRj63PgywSkMnwR2N1b FzGbjYcczVDl/skW4WnXaVyUB5W79+fJVUAMIQLdcTWLxP6yF+nBpOiaOjVtfUVnjHte 3izOdUY8KhOW6MbjPfrDrt6PaJj3CYFyezwbU+o+oKLwf1FfWoveLaUQjCMOys/H1zfG KlbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689848049; x=1690452849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=goykyrOjhu0vQ/ryK1OjSWFJ6jbwwIkl+YvCdFHuGsI=; b=YrFA47ji3jdhWrzuOGOn8T5Yb6pBiRjp9FDHrhzBA6Y4vB1e681/xlXNLWhHmdozwO xb0/qAbjBpiFeK8YVqyevpjE9zyk2pEhlcnMitHeJZQVvYaHtY20jXwMQCD8qGChpfRZ MceRFKtiSIjldi9tJCql570GgFB4OH1diNsCuv8RXILeIiDEBjlYWSnbVem0pZ7DYg6s JeyEaMoXexYltjb/vgYchbCv3rCsvvJP0iFP+7O4yDJnEO1UGO3MsSB3cNMXmpnPKAOT ki5qLlPnIaGtHjnIFHEhDTjOqcMTbLt222MsCYF87o8q/LhsVOP6nr5zvyU9XlV32kdk wM1A== X-Gm-Message-State: ABy/qLYwo1yATP+8E3F2oD7RbxjNJ+8EkpaE8RQflNkQwMbizDf/ytdP nSxkARopN3Y4qmpGHtJK94c= X-Google-Smtp-Source: APBJJlGe1SoXDjpeWheaHuu0sjm9iTNe0t0R8rs/+yIWqIU01ZVVUibJTMC9unqHKUYHoxyMz2a8Lg== X-Received: by 2002:a17:906:51d9:b0:993:a379:6158 with SMTP id v25-20020a17090651d900b00993a3796158mr4975663ejk.17.1689848049124; Thu, 20 Jul 2023 03:14:09 -0700 (PDT) Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191]) by smtp.gmail.com with ESMTPSA id e27-20020a170906045b00b0098e38d2e584sm486667eja.43.2023.07.20.03.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 03:14:08 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii , Theodor Thornhill Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Thu, 20 Jul 2023 12:14:07 +0200 Message-ID: <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> In-Reply-To: <87fs5keb9y.fsf@thornhill.no> References: <2171209.irdbgypaU6@fedora> <7580204.EvYhyI6sBW@fedora> <87fs5keb9y.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart22007411.EfDdHjke4D" Content-Transfer-Encoding: 7Bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart22007411.EfDdHjke4D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" In data mercoled=EC 19 luglio 2023 07:11:05 CEST, Theodor Thornhill ha scri= tto: > For Typescript these changes should go into 'tsx-ts-mode, not > 'typescript-ts-mode. That may be why you are seeing some strange results? No, exactly the same problem occurs, unfortunately. After all, the sources = of=20 libtree-sitter-tsx and libtree-sitter-typescript come from the same reposit= ory=20 and the content of tree-sitter-typescript/tsx/grammar.js is just that: const defineGrammar =3D require('../common/define-grammar'); module.exports =3D defineGrammar('tsx'); > > --- >=20 > "... function to handle ..." fixed > "Indent rules helper, to handle different releases of > tree-sitter-javascript." fixed >=20 > The indentation here looks off. Can you format this? >=20 fixed >=20 > This seems to not be properly converted to tsx from javascript, both in > the docstring and code. Also, I think the name is wrong. Maybe it > should describe its intent a little more closely, something like > "tsx-ts-mode--indent-compatibility-b893426"? Sorry for the error. I fixed them, tested and fixed the function names acco= rding to your instructions (also in js.el) Hope the patches are better now. Thanks. Vincenzo --nextPart22007411.EfDdHjke4D Content-Disposition: attachment; filename="0002-Updated-TSX-support-due-to-changes-in-tree-sitter-ty.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0002-Updated-TSX-support-due-to-changes-in-tree-sitter-ty.patch" >From 99ab9ca3e75f756c7fc9965528db6d882a383150 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Thu, 20 Jul 2023 12:06:21 +0200 Subject: [PATCH 2/2] Updated TSX support due to changes in tree-sitter-typescript A recent change in tree-sitter-typescript grammar support for TSX (commit b893426), changed two things: 1. renamed nested_identifier to member_expression 2. removed jsx_fragment, jsx_text is used instead * lisp/progmodes/typescript-ts-mode.el: (tsx-ts-mode--indent-compatibility-b893426): indent helper function for handle different tree-sitter-typescript version * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--indent-rules): use the new function to handle both jsx_fragment and jsx_text * lisp/progmodes/typescript-ts-mode.el: (tsx-ts-mode--font-lock-compatibility-bb1f97b): font lock helper function for handle different tree-sitter-typescript version * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-mode--font-lock-settings): use the new function to handle both nested_identifier and member_expression --- lisp/progmodes/typescript-ts-mode.el | 78 ++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 5df34de0472..173ec52f209 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -75,6 +75,18 @@ table) "Syntax table for `typescript-ts-mode'.") +(defun tsx-ts-mode--indent-compatibility-b893426 () + "Indent rules helper, to handle different releases of tree-sitter-tsx. +Check if a node type is available, then return the right indent rules." + ;; handle commit b893426 + (condition-case nil + (progn (treesit-query-capture 'tsx '((jsx_fragment) @capture)) + `(((match "<" "jsx_fragment") parent 0) + ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset))) + (error + `(((match "<" "jsx_text") parent 0) + ((parent-is "jsx_text") parent typescript-ts-mode-indent-offset))))) + (defun typescript-ts-mode--indent-rules (language) "Rules used for indentation. Argument LANGUAGE is either `typescript' or `tsx'." @@ -110,16 +122,15 @@ Argument LANGUAGE is either `typescript' or `tsx'." ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) ,@(when (eq language 'tsx) - `(((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) - ((node-is "jsx_closing_element") parent 0) - ((match "jsx_element" "statement") parent typescript-ts-mode-indent-offset) - ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) - ((parent-is "jsx_text") parent-bol typescript-ts-mode-indent-offset) - ((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) - ((parent-is "jsx_expression") parent-bol typescript-ts-mode-indent-offset) - ((match "/" "jsx_self_closing_element") parent 0) - ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) + (append (tsx-ts-mode--indent-compatibility-b893426) + `(((node-is "jsx_closing_element") parent 0) + ((match "jsx_element" "statement") parent typescript-ts-mode-indent-offset) + ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) + ((parent-is "jsx_text") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) + ((parent-is "jsx_expression") parent-bol typescript-ts-mode-indent-offset) + ((match "/" "jsx_self_closing_element") parent 0) + ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset)))) ;; FIXME(Theo): This no-node catch-all should be removed. When is it needed? (no-node parent-bol 0)))) @@ -142,6 +153,38 @@ Argument LANGUAGE is either `typescript' or `tsx'." "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") +(defun tsx-ts-mode--font-lock-compatibility-bb1f97b () + "Font lock rules helper, to handle different releases of tree-sitter-tsx. +Check if a node type is available, then return the right font lock rules." + ;; handle commit bb1f97b + ;; Warning: treesitter-query-capture says both node types are valid, + ;; but then raises an error if the wrong node type is used. So it is + ;; important to check with the new node type (member_expression) + (condition-case nil + (progn (treesit-query-capture 'tsx '((member_expression) @capture)) + '((jsx_opening_element + [(member_expression (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_closing_element + [(member_expression (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_self_closing_element + [(member_expression (identifier)) (identifier)] + @typescript-ts-jsx-tag-face))) + (error '((jsx_opening_element + [(nested_identifier (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_closing_element + [(nested_identifier (identifier)) (identifier)] + @typescript-ts-jsx-tag-face) + + (jsx_self_closing_element + [(nested_identifier (identifier)) (identifier)] + @typescript-ts-jsx-tag-face))))) + (defun typescript-ts-mode--font-lock-settings (language) "Tree-sitter font-lock settings. Argument LANGUAGE is either `typescript' or `tsx'." @@ -293,19 +336,8 @@ Argument LANGUAGE is either `typescript' or `tsx'." :language language :feature 'jsx - `((jsx_opening_element - [(nested_identifier (identifier)) (identifier)] - @typescript-ts-jsx-tag-face) - - (jsx_closing_element - [(nested_identifier (identifier)) (identifier)] - @typescript-ts-jsx-tag-face) - - (jsx_self_closing_element - [(nested_identifier (identifier)) (identifier)] - @typescript-ts-jsx-tag-face) - - (jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face)) + (append (tsx-ts-mode--font-lock-compatibility-bb1f97b) + `((jsx_attribute (property_identifier) @typescript-ts-jsx-attribute-face))) :language language :feature 'number -- 2.41.0 --nextPart22007411.EfDdHjke4D 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 3294c731f4a231ece6f1a82e5ea31dd1c0ef0c10 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Thu, 20 Jul 2023 12:03:11 +0200 Subject: [PATCH 1/2] 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.el: (js-jsx--treesit-indent-compatibility-bb1f97b): indent helper function for handle different tree-sitter-javascript version * lisp/progmodes/js.el: (js--treesit-indent-rules): use the new function to handle both jsx_fragment and jsx_text * lisp/progmodes/js.el: (js-jsx--treesit-font-lock-compatibility-bb1f97b): font lock helper function for handle different tree-sitter-javascript version * lisp/progmodes/js.el: (js--treesit-font-lock-settings): use the new function to handle both nested_identifier and member_expression --- lisp/progmodes/js.el | 61 ++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index a05bd758dbc..70048e5d26c 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3427,6 +3427,18 @@ This function is intended for use in `after-change-functions'." ;;; Tree sitter integration +(defun js-jsx--treesit-indent-compatibility-bb1f97b () + "Indent rules helper, to handle different releases of tree-sitter-javascript. +Check if a node type is available, then return the right indent rules." + ;; handle commit bb1f97b + (condition-case nil + (progn (treesit-query-capture 'javascript '((jsx_fragment) @capture)) + `(((match "<" "jsx_fragment") parent 0) + ((parent-is "jsx_fragment") parent js-indent-level))) + (error + `(((match "<" "jsx_text") parent 0) + ((parent-is "jsx_text") parent js-indent-level))))) + (defvar js--treesit-indent-rules (let ((switch-case (rx "switch_" (or "case" "default")))) `((javascript @@ -3462,8 +3474,7 @@ This function is intended for use in `after-change-functions'." ((parent-is "statement_block") parent-bol js-indent-level) ;; JSX - ((match "<" "jsx_fragment") parent 0) - ((parent-is "jsx_fragment") parent js-indent-level) + (js-jsx--treesit-indent-compatibility-bb1f97b) ((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent js-indent-level) ((parent-is "jsx_element") parent js-indent-level) @@ -3490,6 +3501,35 @@ This function is intended for use in `after-change-functions'." "&&" "||" "!") "JavaScript operators for tree-sitter font-locking.") +(defun js-jsx--treesit-font-lock-compatibility-bb1f97b () + "Font lock rules helper, to handle different releases of tree-sitter-javascript. +Check if a node type is available, then return the right font lock rules." + ;; handle commit bb1f97b + (condition-case nil + (progn (treesit-query-capture 'javascript '((member_expression) @capture)) + '((jsx_opening_element + [(member_expression (identifier)) (identifier)] + @font-lock-function-call-face) + + (jsx_closing_element + [(member_expression (identifier)) (identifier)] + @font-lock-function-call-face) + + (jsx_self_closing_element + [(member_expression (identifier)) (identifier)] + @font-lock-function-call-face))) + (error '((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))))) + (defvar js--treesit-font-lock-settings (treesit-font-lock-rules @@ -3599,21 +3639,8 @@ This function is intended for use in `after-change-functions'." :language 'javascript :feature 'jsx - '((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)) + (append (js-jsx--treesit-font-lock-compatibility-bb1f97b) + '((jsx_attribute (property_identifier) @font-lock-constant-face))) :language 'javascript :feature 'number -- 2.41.0 --nextPart22007411.EfDdHjke4D-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 02:40:47 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 06:40:47 +0000 Received: from localhost ([127.0.0.1]:35324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN6II-0007Qm-Rx for submit@debbugs.gnu.org; Sat, 22 Jul 2023 02:40:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN6IF-0007QX-A3 for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 02:40:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN6I8-0001hj-Dw; Sat, 22 Jul 2023 02:40:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ASKrgoGKcE8jbm4Bw/KmtAHwxwVo7pG9N0sNVBnvByU=; b=RF9ijIuXcr5S Er6pQzVGfvUFf/jJi3mmdSo1Mrh6zyZfV4C9YKqDPbwPzUfwRzAyfTWRnbD93au3SDxhtd/JKe84c l07m7unJU1zJ32cyuLCSBqgDNuUJvecqWLCWdVU+Y3rHKeChgbHYZUzvLYL4MfAzKIYZF5a4zz+zP WsHfqWgfxV024iXWoTtXOvF+rKeN/MbiTiHdT1ZOS9WO7O1Tbctn2czYqclhzyNt+WXUYFxi9bPJM mDnSUja1oc9yGyJAihx8TXxjx6PTXqY18JQJ7TFEPR5mjMzoiXc+vMuRknMv41Oua9R4US1IHLgjY DqBVJEursfJDIibcbqkfVw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN6I0-0000yv-0X; Sat, 22 Jul 2023 02:40:36 -0400 Date: Sat, 22 Jul 2023 09:41:04 +0300 Message-Id: <837cqsa1of.fsf@gnu.org> From: Eli Zaretskii To: Vincenzo Pupillo In-Reply-To: <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> (message from Vincenzo Pupillo on Thu, 20 Jul 2023 12:14:07 +0200) Subject: Re: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <7580204.EvYhyI6sBW@fedora> <87fs5keb9y.fsf@thornhill.no> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net, theo@thornhill.no X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo > Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net > Date: Thu, 20 Jul 2023 12:14:07 +0200 > > Sorry for the error. I fixed them, tested and fixed the function names according to your instructions (also in js.el) > Hope the patches are better now. Thanks. Theo, Yuan, Jostein: any further comments? If not, I'd like to install this on the release branch soon. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 03:29:35 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 07:29:35 +0000 Received: from localhost ([127.0.0.1]:35387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN73X-0000MI-IM for submit@debbugs.gnu.org; Sat, 22 Jul 2023 03:29:35 -0400 Received: from out-9.mta0.migadu.com ([91.218.175.9]:23162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN73U-0000M7-Kq for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 03:29:34 -0400 Date: Sat, 22 Jul 2023 09:29:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1690010971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1Ja/fziYvAumGKANIk4mPQb6tFSNx+Pq6bjKtuMK4s=; b=WFqyFyfEcUEQI46LE5jYztV08y9Rt55k2PIqpx8ZhzlYoI5t7O+XVmlj0bEJ0O4wRoCxeH 3lBprp83sfsCCkVTnKJpDbCi/gY7FwuGssbQhBDd8Y5V4ydY8v7AH/DoNUwW1B+P3taTI5 TnLa536Si9KYkSd3323EsEMwEK5F39gqQCfooZvN2cvQHJwNJruEGL5Aw1Kgi5Pz3f5xP5 u/KgTqtks9vd128KvFngAnBJQKN7GEtMSlfPGyWMzNosWzc6dJeQlVxU2HRWY3DaiIAp7E VpwdkMnWpERPrbsU8tKr2hcMs5MsQi+E+gPNvImvRy7n+mNN1k7nDNzGx7Y1mw== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill To: Eli Zaretskii , Vincenzo Pupillo Subject: =?US-ASCII?Q?Re=3A__Re=3A_bug=2364647=3A_treesi?= =?US-ASCII?Q?t-query-error_due_to_a_rece?= =?US-ASCII?Q?nt_change_to_tree-sitter-javascript_grammar_definition?= In-Reply-To: <837cqsa1of.fsf@gnu.org> References: <2171209.irdbgypaU6@fedora> <7580204.EvYhyI6sBW@fedora> <87fs5keb9y.fsf@thornhill.no> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> <837cqsa1of.fsf@gnu.org> Message-ID: <22147920-7D77-4492-92BF-3B71B19EB45D@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 22 July 2023 08:41:04 CEST, Eli Zaretskii wrote: >> From: Vincenzo Pupillo >> Cc: 64647@debbugs=2Egnu=2Eorg, jostein@kjonigsen=2Enet >> Date: Thu, 20 Jul 2023 12:14:07 +0200 >>=20 >> Sorry for the error=2E I fixed them, tested and fixed the function name= s according to your instructions (also in js=2Eel) >> Hope the patches are better now=2E > >Thanks=2E > >Theo, Yuan, Jostein: any further comments? If not, I'd like to >install this on the release branch soon=2E I'll look at it in a few hours, then install=2E Is that ok? From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 04:51:44 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 08:51:44 +0000 Received: from localhost ([127.0.0.1]:35447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN8L2-0005Bz-Ci for submit@debbugs.gnu.org; Sat, 22 Jul 2023 04:51:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN8L0-0005Bk-5I for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 04:51:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN8Ku-0005Hd-0W; Sat, 22 Jul 2023 04:51:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Y3MRmDgIwiUj8oyQ6ptoGnT0F6GGur2wPZ73mDFQakI=; b=orsVGry9kl5r PdZkYh4vzLkIHfo2hyC1UWHEo8cm6XeF89YFik70I7fDf7bzF8PccnYMndaaqijmVuP0DdB5+ij9o 4RwzkiO+RqacO13+Jt73laqtxBxZRoFOZR0mAssx59E6e4tELZKyZhHUH7fHBaNDTNqk9+nAA7gG1 Q6pxxJ2vuJ429ZmXYkbBlKDeyEmC7wObG2W4tTpEc+U1sKvEQ1ELEIvn/tdo6Gwj1LHl6ADGvwyWk 4UlM+rWlzyy8zrhWd3GRrGXCUD/eP6HQJoxd10mox2bUiAZlLxDvbC5P0ou42BPBcKJvfzj2Zjs1K te6fSRoMMjIPXsZ7vKdC7Q==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN8Kt-0003Je-GJ; Sat, 22 Jul 2023 04:51:35 -0400 Date: Sat, 22 Jul 2023 11:52:13 +0300 Message-Id: <83zg3o8h1e.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <22147920-7D77-4492-92BF-3B71B19EB45D@thornhill.no> (message from Theodor Thornhill on Sat, 22 Jul 2023 09:29:26 +0200) Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <7580204.EvYhyI6sBW@fedora> <87fs5keb9y.fsf@thornhill.no> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> <837cqsa1of.fsf@gnu.org> <22147920-7D77-4492-92BF-3B71B19EB45D@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, v.pupillo@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 22 Jul 2023 09:29:26 +0200 > From: Theodor Thornhill > CC: 64647@debbugs.gnu.org, jostein@kjonigsen.net > > > > On 22 July 2023 08:41:04 CEST, Eli Zaretskii wrote: > >> From: Vincenzo Pupillo > >> Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net > >> Date: Thu, 20 Jul 2023 12:14:07 +0200 > >> > >> Sorry for the error. I fixed them, tested and fixed the function names according to your instructions (also in js.el) > >> Hope the patches are better now. > > > >Thanks. > > > >Theo, Yuan, Jostein: any further comments? If not, I'd like to > >install this on the release branch soon. > > I'll look at it in a few hours, then install. Is that ok? Yes, installing this on the release branch is OK. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 07:56:11 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 11:56:12 +0000 Received: from localhost ([127.0.0.1]:35583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNBDX-00048n-Ht for submit@debbugs.gnu.org; Sat, 22 Jul 2023 07:56:11 -0400 Received: from out-49.mta1.migadu.com ([95.215.58.49]:39172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNBDU-00048d-Cv for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 07:56:10 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1690026966; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sj7X4bs8r0wF96Eu7QWG+iOPROb+7mSmEShBta7aN3U=; b=d/f1Wl0VjdKkTMrWo3oZgPiDrpAzX+qebw4cSYZ+bCJotzJqpwpDzOLQ7AKPLRoYUjjBhY VNlOpGyW1UfBc9cYpGYqfmZTUJGnQe1W1HzJHJ9unFeel9ubFY54G9m3UahmMF3ZxANmZj cVopW4TpjgbBRGWEV2b2IZQwLJq1GxkhB22cKLcHvA7dLpSr4ZVOkUGwvBkJZJWyI5O8bk IoAd6xx+Sj4Y4QW3VwJk3r9eE8UJotowUfBRUwdmJjNm28oCPzxi5RlbRCiQKgAOO16rSb E32LuFqSvhzVaQ7p7gKe5a7+5FOk0lfLY/G43dHfUbgrGfKH8+Qqm9pN/kA1Rg== From: Theodor Thornhill To: Vincenzo Pupillo , Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> References: <2171209.irdbgypaU6@fedora> <7580204.EvYhyI6sBW@fedora> <87fs5keb9y.fsf@thornhill.no> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> Date: Sat, 22 Jul 2023 13:56:04 +0200 Message-ID: <87mszoqhwr.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Vincenzo Pupillo writes: > In data mercoled=C3=AC 19 luglio 2023 07:11:05 CEST, Theodor Thornhill ha= scritto: > >> For Typescript these changes should go into 'tsx-ts-mode, not >> 'typescript-ts-mode. That may be why you are seeing some strange results? > No, exactly the same problem occurs, unfortunately. After all, the source= s of=20 > libtree-sitter-tsx and libtree-sitter-typescript come from the same repos= itory=20 > and the content of tree-sitter-typescript/tsx/grammar.js is just that: > const defineGrammar =3D require('../common/define-grammar'); > module.exports =3D defineGrammar('tsx'); > > >> > --- >>=20 >> "... function to handle ..." > > fixed Thanks for the fixes :) > > > Sorry for the error. I fixed them, tested and fixed the function names ac= cording to your instructions (also in js.el) > Hope the patches are better now. > Thanks. > Vincenzo > No worries! Am I correct in that this patch should be applied as well? If you agree, I'll just apply it myself, no need to make a new patch. Theo diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescri= pt-ts-mode.el index 173ec52f209..39fcd1de30e 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -75,10 +75,10 @@ typescript-ts-mode--syntax-table table) "Syntax table for `typescript-ts-mode'.") =20 -(defun tsx-ts-mode--indent-compatibility-b893426 () +(defun tsx-ts-mode--indent-compatibility-bb1f97b () "Indent rules helper, to handle different releases of tree-sitter-tsx. Check if a node type is available, then return the right indent rules." - ;; handle commit b893426 + ;; handle commit bb1f97b (condition-case nil (progn (treesit-query-capture 'tsx '((jsx_fragment) @capture)) `(((match "<" "jsx_fragment") parent 0) @@ -122,7 +122,7 @@ typescript-ts-mode--indent-rules ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent= -offset) =20 ,@(when (eq language 'tsx) - (append (tsx-ts-mode--indent-compatibility-b893426) + (append (tsx-ts-mode--indent-compatibility-bb1f97b) `(((node-is "jsx_closing_element") parent 0) ((match "jsx_element" "statement") parent typescript-ts-mode-indent-o= ffset) ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 10:10:33 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 14:10:33 +0000 Received: from localhost ([127.0.0.1]:37391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNDJY-0008Bv-S2 for submit@debbugs.gnu.org; Sat, 22 Jul 2023 10:10:33 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:57826) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNDJX-0008Bi-SG for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 10:10:32 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-98e011f45ffso417898466b.3 for <64647@debbugs.gnu.org>; Sat, 22 Jul 2023 07:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690035026; x=1690639826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eJuVsOi4W20iCKyKK1d4P8MhAlFgFpDtsyYMGgGROLk=; b=o8QfwErNr9lbfOYvc2TXePNOX2bJmxvvbsPSymkthR6Iynip2ex7kAgF/TkfzsRpTZ hmlld5lcC9shNK63KWHlUszWkUGRWzvWVUSxoGEMJJZ3+vxxSRYhmNqWSZN4FkF9/jTV ThvMPoa3a96Na7BwI5IC+aCCQkJRfAMk0yO6KnufiTqPcYJzD/7TlwJX0j8EHEsEManP 2tiWeqM7wvPw0jbJYmV+f7K6JaD6bdyk75PBuSncDPzU0Lz93nTg4AwVi9B0Mlh0SQqE QBfBqPUmxK51cc/uKiVqAR39kGrUmidLsRZkRLwNKZFHkY6CS5KNcV7TEnmbLFW4Y5TA /teQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690035026; x=1690639826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eJuVsOi4W20iCKyKK1d4P8MhAlFgFpDtsyYMGgGROLk=; b=hSVWlJiBm64Lx2E1N9kJh6XHN8VNIon5zw2k8UgdFP+CiQAIWur1x+kwghcMFmf5TE 4RAYtgReT8ezN6e49iFTqzS89XtT3P239Wxz4RvIe/mjkdK4rv7yHkk1Y2Kei7FHLRqZ QzYayg6tCzhSsAC/NBXgYpPBrZwQdEG2QgsruxN1jkj4SvDj6/ZDn4aAGQdSV4Vtc4Ew d0wRYcah6M0RPrn5q9QtxDgApRPtLxEsJXiOAogkmDOoXcVXdytSCA/XUkHHfhMazbEE TwGL0/aQi/0DovQ6ZsiUli2Oe66BCWyMQhTGUb3LjE0ZvkImhE31rMQz6+5LGa9QzzYy O20A== X-Gm-Message-State: ABy/qLYrYvy5XwHvn/AkLtr1InLRhMwRsq6nAW48dfs90LFo2/VcUvUx TxLeiqw1ytgYdxbpULnFeBw= X-Google-Smtp-Source: APBJJlFhcZbSzddKGUCtlV3JJ/S4Z+zAi5o60PKEtoTB/LAAerEeHO8/+FXdRlBT6nxkPnepEYvP3A== X-Received: by 2002:a17:906:7792:b0:99b:5a73:4d09 with SMTP id s18-20020a170906779200b0099b5a734d09mr4715716ejm.43.1690035025799; Sat, 22 Jul 2023 07:10:25 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id u19-20020a170906c41300b009737b8d47b6sm3550606ejz.203.2023.07.22.07.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jul 2023 07:10:25 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii , Theodor Thornhill Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Date: Sat, 22 Jul 2023 16:10:24 +0200 Message-ID: <4500046.LvFx2qVVIh@fedora> In-Reply-To: <87mszoqhwr.fsf@thornhill.no> References: <2171209.irdbgypaU6@fedora> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> <87mszoqhwr.fsf@thornhill.no> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Theo, In data sabato 22 luglio 2023 13:56:04 CEST, Theodor Thornhill ha scritto: > > Thanks for the fixes :) > Thanks you for the help. > > Sorry for the error. I fixed them, tested and fixed the function names > > according to your instructions (also in js.el) Hope the patches are > > better now. > > Thanks. > > Vincenzo > > No worries! Am I correct in that this patch should be applied as well? The changes were made with two different patches. The one that modifies the indentation is this one: https://github.com/tree-sitter/tree-sitter-typescript/commit/ b893426b82492e59388a326b824a346d829487e8 Thanks. Ciao V. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 17:22:52 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 21:22:52 +0000 Received: from localhost ([127.0.0.1]:37633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNK3v-0002iN-Q3 for submit@debbugs.gnu.org; Sat, 22 Jul 2023 17:22:52 -0400 Received: from out-32.mta1.migadu.com ([95.215.58.32]:52554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNK3t-0002iE-6E for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 17:22:50 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1690060967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3lS7t5lCp3f/H1/kmzdJvnX9RGWFslqwmL/4GqPGsRA=; b=K67GmjT9BS98YAgYK3tiCM2FmYBSRMizkkcANKDXHd39ZHUMUXsBm898zK0H09br/9VPq2 WqyIoY7R+rr8hXNlE2HkFh5ipSvW8QV4k8MEhiac7AP9tdWerpgy20Sx+saN4ts667fBIo EoL/RR9qGse9NEa35TUp2cTTSQswmDihEytCgghr92mLLa1PWu2ORtjImZX1HEjAN3T6HO ZId3xqNXoA8FlC5VdOo/qUB4T3GmxkFdyV9hoc61FTkIY/GM0n7lZREBz0I139C/rD1EKe v0RJc59F+KSjdobkANaXKjQB+7p0gDgDFrWWUL5mSwEj9edy1dlD3QMz8JiRVg== From: Theodor Thornhill To: Vincenzo Pupillo , Eli Zaretskii Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition In-Reply-To: <4500046.LvFx2qVVIh@fedora> References: <2171209.irdbgypaU6@fedora> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> <87mszoqhwr.fsf@thornhill.no> <4500046.LvFx2qVVIh@fedora> Date: Sat, 22 Jul 2023 23:22:44 +0200 Message-ID: <87jzurr68r.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Vincenzo Pupillo writes: > Hi Theo, > In data sabato 22 luglio 2023 13:56:04 CEST, Theodor Thornhill ha scritto: >> >> Thanks for the fixes :) >> > Thanks you for the help. > >> > Sorry for the error. I fixed them, tested and fixed the function names >> > according to your instructions (also in js.el) Hope the patches are >> > better now. >> > Thanks. >> > Vincenzo >> >> No worries! Am I correct in that this patch should be applied as well? > > The changes were made with two different patches. The one that modifies the > indentation is this one: > https://github.com/tree-sitter/tree-sitter-typescript/commit/ > b893426b82492e59388a326b824a346d829487e8 > > Thanks. > Ciao > V. Great! Installed and pushed the patches to emacs-29. Thanks, Vincenzo! Theo From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 22 18:59:46 2023 Received: (at 64647) by debbugs.gnu.org; 22 Jul 2023 22:59:47 +0000 Received: from localhost ([127.0.0.1]:37646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNLZi-00055l-KE for submit@debbugs.gnu.org; Sat, 22 Jul 2023 18:59:46 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:56389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNLZg-00055Y-LB for 64647@debbugs.gnu.org; Sat, 22 Jul 2023 18:59:45 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-262ea2ff59dso1375469a91.0 for <64647@debbugs.gnu.org>; Sat, 22 Jul 2023 15:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690066779; x=1690671579; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WYbw29inmAStFEyetHoOTunN+URCnPyayC8U0h1uvLw=; b=TI+J91HM3HaO2Qn0x3y848DxPjnJqUkFYGL8hRHzHgoZc5yql1wy7NzjWT9XiiYUQj aKxdj9Hq4nne2MMYSlL8tMg+Z60F1IXI+FJ0JquqX5BLApdY7RiJv9qByk29TzFjk/ww YAT56XywFRXOiqjVc0QQcx9QD8Az3IbdzXEhmf3hR+ay28T0qrFs6J+ODX9hoFc3tx/S W7sGLG852780NuqOsA7cwCdUMYwZ59lJFSUSziKx6S7G1UOjFXW0VSPttnSIxrB188x9 XXEC34CKNfHUTFI1GbF8iuLW/2PbXaxgxMssY3YBxSrErTu8WZQGQFMMvM/O4FmRlQ8t 1OGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690066779; x=1690671579; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WYbw29inmAStFEyetHoOTunN+URCnPyayC8U0h1uvLw=; b=OwQzKcC6qbQYuMHIgaECZHpkut7h5ojEbeVe+GTSvgjGdIIqrHVa48h8M/B+UN7P5n KGl016ylvA88Uz6Q6Py/EeYAoKZiW+QWryyvM46VkDkXHUAAhZY8CtOKGPAM2Mzz3jqL UOB6CM/82SZNvvC8uorufJY1cOmyEE+CYFU6VFi8kJlOLkxV3U1M+zLhti07jQ/350mM NU/uqSynOx9iaXdZJjIvTONjXESjbOV3/w1kKBBzq7tl2Uv/e+2emFZ8pKPUN2UmnqlX 4nX4s+FlImMDaZTOkwyE5SrWcM2Jw4k6lxWitJaRCxhzKu6wGtaHLI5VMSATX2NUkMrF TVNQ== X-Gm-Message-State: ABy/qLbNv5GtjnzspxRi03yOrHoCoHSQjwDe7+AgIacEuVawM2exX9+b pvyQ/9FUQRgV3NB5LWQVQSM= X-Google-Smtp-Source: APBJJlGo5fkzYhNZ6JH8cfn7oksYYTvxFCo5NxVuc06B/5bHlJ5zezgzzzurXRbpPTYpMEwJZpIbEg== X-Received: by 2002:a17:90a:d916:b0:267:fc61:5a37 with SMTP id c22-20020a17090ad91600b00267fc615a37mr1308846pjv.39.1690066778845; Sat, 22 Jul 2023 15:59:38 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id e6-20020a17090a818600b00262e485156esm5892578pjn.57.2023.07.22.15.59.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Jul 2023 15:59:38 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition From: Yuan Fu In-Reply-To: <87jzurr68r.fsf@thornhill.no> Date: Sat, 22 Jul 2023 15:59:27 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <97C9F1F2-B6C6-445E-9EAE-C8443F6AB714@gmail.com> References: <2171209.irdbgypaU6@fedora> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> <87mszoqhwr.fsf@thornhill.no> <4500046.LvFx2qVVIh@fedora> <87jzurr68r.fsf@thornhill.no> To: Theodor Thornhill X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64647 Cc: 64647@debbugs.gnu.org, Eli Zaretskii , Vincenzo Pupillo , jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > On Jul 22, 2023, at 2:22 PM, Theodor Thornhill via Bug reports for GNU = Emacs, the Swiss army knife of text editors = wrote: >=20 > Vincenzo Pupillo writes: >=20 >> Hi Theo, >> In data sabato 22 luglio 2023 13:56:04 CEST, Theodor Thornhill ha = scritto: >>>=20 >>> Thanks for the fixes :) >>>=20 >> Thanks you for the help. >>=20 >>>> Sorry for the error. I fixed them, tested and fixed the function = names >>>> according to your instructions (also in js.el) Hope the patches are >>>> better now. >>>> Thanks. >>>> Vincenzo >>>=20 >>> No worries! Am I correct in that this patch should be applied as = well? >>=20 >> The changes were made with two different patches. The one that = modifies the=20 >> indentation is this one:=20 >> https://github.com/tree-sitter/tree-sitter-typescript/commit/ >> b893426b82492e59388a326b824a346d829487e8 >>=20 >> Thanks. >> Ciao >> V. >=20 > Great! Installed and pushed the patches to emacs-29. Thanks, Vincenzo! >=20 > Theo Thanks Theo and Vincenzo :-) Yuan= From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 23 01:17:27 2023 Received: (at 64647-done) by debbugs.gnu.org; 23 Jul 2023 05:17:27 +0000 Received: from localhost ([127.0.0.1]:37789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNRTC-0006aY-S6 for submit@debbugs.gnu.org; Sun, 23 Jul 2023 01:17:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51284) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNRTA-0006aL-Vw for 64647-done@debbugs.gnu.org; Sun, 23 Jul 2023 01:17:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNRT5-0000LL-ES; Sun, 23 Jul 2023 01:17:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VP1moNZ8WgZ7RBChg+ebCXmpOVeremhbk/oaZMtKVFM=; b=Y9IDQ/QXoceT tWfvZoomBHfldoZpYksfXJhfTRCoxHLf1eNRYS3B/L1pzUilxa3QSdETatbcnDYHhVcBBN69EuJPO B3Cfry9aR0BmMvbEOreDG+FZ38wNvDZ1ibgAGrwX8FhrVs/ZT2yDWrVoKxszVrKBhgxYwBMCaMiFi a7f2eg4yiFKLhdNGiKq3SBtndWn6m3DQQxxsySHDSlEjLeWbOv4jMekt/0saOlZm8ezcd796tRVVU 345mhyf+SQXB+3A/l14TYyar/f2AxCanPyPctVDIsw+nxmQsrQss/pWqUyfU60XNZyWUGG2dksI/o B2L2PRtHIRL9fo0WgGC8Rw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNRT4-0000lH-Kw; Sun, 23 Jul 2023 01:17:19 -0400 Date: Sun, 23 Jul 2023 08:17:56 +0300 Message-Id: <83r0oz6waj.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87jzurr68r.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 22 Jul 2023 23:22:44 +0200) Subject: Re: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition References: <2171209.irdbgypaU6@fedora> <1994797.PYKUYFuaPT@3-191.divsi.unimi.it> <87mszoqhwr.fsf@thornhill.no> <4500046.LvFx2qVVIh@fedora> <87jzurr68r.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64647-done Cc: 64647-done@debbugs.gnu.org, v.pupillo@gmail.com, jostein@kjonigsen.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net > Date: Sat, 22 Jul 2023 23:22:44 +0200 > > Vincenzo Pupillo writes: > > > The changes were made with two different patches. The one that modifies the > > indentation is this one: > > https://github.com/tree-sitter/tree-sitter-typescript/commit/ > > b893426b82492e59388a326b824a346d829487e8 > > > > Thanks. > > Ciao > > V. > > Great! Installed and pushed the patches to emacs-29. Thanks, Vincenzo! Thank you all for a fast and efficient solution. (The commit needed a small fixup, though.) Closing the bug. From unknown Sat Sep 06 02:03:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 20 Aug 2023 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator