From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59637: 29.0.50; Should treesit-range-settings support the possibility of separate parser for each region? Date: Mon, 28 Nov 2022 14:51:30 -0800 Message-ID: References: <87v8n0b9th.fsf@miha-pc> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38125"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59637@debbugs.gnu.org, miha@kamnitnik.top To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 28 23:52:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ozmzF-0009gM-5Y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Nov 2022 23:52:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozmz2-0001NU-Aw; Mon, 28 Nov 2022 17:52:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozmyo-0001MH-Dg for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 17:52:14 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozmyn-0001mf-QM for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 17:52:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozmyn-00082k-MR for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 17:52:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87v8n0b9th.fsf@miha-pc> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Nov 2022 22:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59637 X-GNU-PR-Package: emacs Original-Received: via spool by 59637-submit@debbugs.gnu.org id=B59637.166967590130907 (code B ref 59637); Mon, 28 Nov 2022 22:52:01 +0000 Original-Received: (at 59637) by debbugs.gnu.org; 28 Nov 2022 22:51:41 +0000 Original-Received: from localhost ([127.0.0.1]:51435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozmyS-00082R-KM for submit@debbugs.gnu.org; Mon, 28 Nov 2022 17:51:41 -0500 Original-Received: from mail-pg1-f177.google.com ([209.85.215.177]:41853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozmyQ-00082L-5u for 59637@debbugs.gnu.org; Mon, 28 Nov 2022 17:51:39 -0500 Original-Received: by mail-pg1-f177.google.com with SMTP id q71so11284147pgq.8 for <59637@debbugs.gnu.org>; Mon, 28 Nov 2022 14:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=I+cFP7TCQHh2YpwTIZ7Cksr/Vws5flGkvOf3GjsMKxA=; b=ce5NKbWkrMq5lyKOxFaAaTagkBQVt2dCiR3XbseMIV0RuWo2C/wMw6nV5P1Z0rf8Ee sY5tl5mNJTkmGrxJ++UMZTqR/KhuNGfD97XfJZgb7ahE3fsTAP6+X51+PF6q77QSUxCW vFwSDH92Lnpm2jKFJc3w3CRv5GIsLP1t1+1QVhvtz3yK0CVTlpnumVFO5fGGKrOWl9Nr w/ZKeEs6RhKoovASpUuZBk0F9aloiGYd59ggitVox7/Xb3RmFcYFhmM3Gq/5ny1X0agS 4YxrXEgS7P/80ZjtHnxn0uLigyNm9tu6LpRUh42SpSTSIA3u6J1IgB+TJdquq9vrpR/7 +bDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I+cFP7TCQHh2YpwTIZ7Cksr/Vws5flGkvOf3GjsMKxA=; b=iCtLEJJE0YD9ai8BEkdKq2atFLgpqR8rG1+yPRcuXcIWIYcnWOpfcJGSaWajr3ZbVR tywd16rIxX2HdiETIyqvL+tTo25y4EsdyC5bY0+XX6F74y5DEKhFBtUQt39FpAQKJ1XE fHsTR63wJUQukcTmxVtGLplI28DgGyvqubIDn6VPmJEt3/OUtnnij7sXv574U31S12on qfmchejepnK2AuDT5zsKGAeQ2hhUiux86/Ghnveeb7ag6NilNCQD3dfsQZxaCTkD4U89 m6vuYVY+C8bzOzLpVDM+etAGgfd8kR4edatTTCO82Iil0bRK2Hlr7xsatcPEKABWJuce tTYA== X-Gm-Message-State: ANoB5pnwa3TO+bIcOrt+tW9opb1HtpiHe4DQYtfUxx0ffkuqUsbE2BWL +6dn6PYK1DzhJWmB6AS/5rk= X-Google-Smtp-Source: AA0mqf6iFs9F0Df/XuaQ2rMbiS5mVQ/sN5dGmJ5gsnTVPwUW63G5pumEeIE+tHGohbIqwTD32iffvQ== X-Received: by 2002:a05:6a00:2396:b0:572:698b:5fa9 with SMTP id f22-20020a056a00239600b00572698b5fa9mr33867067pfc.28.1669675892253; Mon, 28 Nov 2022 14:51:32 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id q6-20020a170902a3c600b0017e64da44c5sm9296089plb.203.2022.11.28.14.51.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2022 14:51:31 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249349 Archived-At: Stefan Kangas writes: > miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text > editors" writes: > >> As far as I understand, the current behaviour of >> treesit-parser-set-included-ranges is that the concatenation of text >> from different regions in the same range set is considered as one >> program. This means that for this html program >> >> >> >> >> >> >> treesitter would consider "alert('hello');" to be inside a comment = and >> the second script tag would contain an error about missing comment >> end. >> >> However, testing this in Firefox, it seems that the first script tag = is >> the erroneous one here and the alert function call isn't inside a >> comment. So I guess the correct way to parse this html document would = be >> to have two instances of javascript parser, one for each region. On = the >> other hand, we should consider if this is worth the added complexity = and >> performance degradation. >> >> Thanks and best regards. Yeah it makes sense, but as you say the isolation comes at a cost and I don=E2=80=99t know if it can be justified right now, because the = complexity in assinging different parsers for each range which can disappear/appear as the user edits the buffer. Plus the current framework kind of assumes one parser for each language, so we need some non-trivial change to make "one parser per range" work smoothly. For now, I think it=E2=80=99s best to just turn off error highlighting = and rely on tree-sitter=E2=80=99s error recovery. I think that=E2=80=99s what = everybody else does. In the future if we make the framework more flexible and makes "one parser per range" easier to implement we can try adding support for it. > > Copying in Yuan Fu. Thanks :-) Yuan