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.devel Subject: Re: Average-user-facing interface for tree-sitter Date: Fri, 28 Oct 2022 01:02:25 -0700 Message-ID: <0EC738A0-DE09-4ACC-A482-31B0607AF98B@gmail.com> References: <8BAAB6CC-C8BA-4255-9E60-8963A828BE31@gmail.com> <41838564-B3F1-46C8-A316-EE888C4B9968@gmail.com> <1E3B06A0-46B0-495B-90B0-618CCA5D1C59@gmail.com> <486B2CA9-058E-4842-B9FB-0393F3D5F079@gmail.com> 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="17337"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Theodor Thornhill , Lars Ingebrigtsen , emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 28 10:03:52 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ooKLI-0004MK-S7 for ged-emacs-devel@m.gmane-mx.org; Fri, 28 Oct 2022 10:03:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooKK8-00081W-S3; Fri, 28 Oct 2022 04:02:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooKJy-0007zQ-JG for emacs-devel@gnu.org; Fri, 28 Oct 2022 04:02:36 -0400 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ooKJx-0001gk-2v for emacs-devel@gnu.org; Fri, 28 Oct 2022 04:02:30 -0400 Original-Received: by mail-pg1-x52e.google.com with SMTP id f193so4241414pgc.0 for ; Fri, 28 Oct 2022 01:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=ASK5zj85hBBaRshVDLxyISqhwYJ0Kwh2PYExn8uItqg=; b=hUwg2yjCvxC/q2VkS+TWQx9OgxRZg/JC89ayWnAzPRzKcAebHZn9zqJzggISWe6oiQ L1og5+ptAdm2VSaCMVSP4RjLznlOEVSizLvN2sOt1Q06WwllFQNGa+mx+cJ04O0bFV5x 2LMhc7dH1nOE8oA35vqCaOR/wss7+cKOA/skvE9lTph9GVEfbQTeX+j0mef/Oxmz+rfx /z601kTFfg+V+tK2kOFrhQbk0ANhhXyM4dPgViyW26SeLMydINCj1U0BHQSlk75wCKPA dJk/UHIqONAjaRxKDJyqJLYVaFKjBHsA89tto+ty2Tm09x8M4SwAhizCNqdfFlqOYisS QAxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=ASK5zj85hBBaRshVDLxyISqhwYJ0Kwh2PYExn8uItqg=; b=gtQ1/8Q24YiX9tL3HCOyIQY4/H/8ix5DzDYpMCfLyEOOm8rkq59jGO0719PVKiZzVJ zeOXRqax3ZMhZmQlGu0LxtP9Ro/AF+hrgwyncHgKX4IQcp8sv44uL9vPQNZQ6ub+Qq/f TcOm+W0vShbVcLsny6ou/Rk92JXmcwaN7qrtF0RPxNMzYctop/fkJ9lINsPm1re4oPVE /vp87yu++vuc7BhG+aCPKE30cb8mchDpOJzCvooeSGI/SmADgrC4LJZ+Bh1f+/2uJEWz Ekyd2Mhuywx7kBj90K1L+cX6SvAQptLxZoMZbhVVDVghSrlh+5LSb3hLIZjusK5DvIy3 ywfQ== X-Gm-Message-State: ACrzQf1G0lEAQf9S4lR0clDAQi1EGHPS+kiELwGL6X5/jKafK9Hpu8vi sM90+qcPc25CMC6bPqUDVKY= X-Google-Smtp-Source: AMsMyM5Mz7Wo2jxWntOZJHyPRnXwcxwjRYmPzrUprbU5H59Mue+x54wGGzO9f/QghtBoEt7tu4vwKw== X-Received: by 2002:a63:1b58:0:b0:45f:e7ba:a223 with SMTP id b24-20020a631b58000000b0045fe7baa223mr44070285pgm.548.1666944147384; Fri, 28 Oct 2022 01:02:27 -0700 (PDT) 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 g135-20020a62528d000000b0056262811c5fsm2326440pfb.59.2022.10.28.01.02.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Oct 2022 01:02:26 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=casouri@gmail.com; helo=mail-pg1-x52e.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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298661 Archived-At: > On Oct 27, 2022, at 8:29 AM, Dmitry Gutov wrote: >=20 > On 27.10.2022 18:21, Stefan Monnier wrote: >>> Yes, there are indeed some non-trivial tradeoffs here. >> Reading some old bug report made me realize another problem: what if >> a derived-mode of js-mode, A-mode expects cc-mode stuff to be setup = by >> js-mode, but js-mode doesn=E2=80=99t setup cc-mode because it=E2=80=99s= using tree-sitter? >=20 > js2-mode also derives from js-mode, and I think it might be rather = surprised to encounter TreeSitter integration in its buffers. >=20 > Not sure how much it's going to conflict in practice, but using two = different parsers at the same time sounds problematic. Yes, I think there are roughly two types of derived modes, one that only = add minor change or even personal settings to the parent mode, like = python-mode w/ my-python-mode; the other derives from a mode that is = essentially another language, like ts-mode w/ js-mode, or json-mode with = js-mode. The first kind probably wants parent mode=E2=80=99s tree-sitter setup = (if it is enabled by the user), but the second one probably don=E2=80=99t,= and they might need non-tree-sitter setup made by the parent mode. I think derived major modes should have a way to opt-in to parent = mode=E2=80=99s tree-sitter setups. It doesn=E2=80=99t need to be a = user-facing option, but something a major mode configures upon = definition. Yuan=