From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: tree-sitter version? Date: Fri, 25 Nov 2022 13:52:28 +0200 Message-ID: <83k03juu83.fsf@gnu.org> References: <70973BD9-26D2-4833-A429-8434FC03026B@gmail.com> <87cz9cevns.fsf@gnu.org> <8B97AC7B-54CF-41AC-9EF7-0A83F1709B98@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29050"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tsdh@gnu.org, raman@google.com, emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 25 12:53:08 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 1oyXGV-0007Jh-Pp for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Nov 2022 12:53:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyXFZ-00050e-Pl; Fri, 25 Nov 2022 06:52:09 -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 1oyXFY-00050O-CA for emacs-devel@gnu.org; Fri, 25 Nov 2022 06:52:08 -0500 Original-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 1oyXFY-00036A-35; Fri, 25 Nov 2022 06:52:08 -0500 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=t6VLFTds0EzNCSliuIdIzgpEb4FV5B7cealUPBLIpg0=; b=Aa8GzWvXdys1 mEyh6OcUohit2pFlrYwYeLfAR9LXsocn/R6a3YtOrglU25a/Fe/4CFUINXOxBja3AMmXUCrB99NRM PTf/OaYf1O9r4vZGC3mcT9hth6WtAeoyLI1dylg0hd5M/FOREienVe4Sz5S5SfL0ax9xiMLGbrAkQ IwzM2BijEu3zpVynV+F6biAv+3QMjjeCyTg3x0IeumoF7hfyTYq/MTjfbA6geSeOnSoWdFI+ExQ3T vs8tDzmSGFETCCbFmexJFOaSvpUZUQJL0Ld1yfyZMB+aFJks+WaSD6flaVUsHqusVSCKrDwjJEzUx gdk0cYTX3jgaq3tdRv1l1g==; Original-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 1oyXFW-0005sv-EY; Fri, 25 Nov 2022 06:52:06 -0500 In-Reply-To: <8B97AC7B-54CF-41AC-9EF7-0A83F1709B98@gmail.com> (message from Yuan Fu on Fri, 25 Nov 2022 01:43:39 -0800) 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300476 Archived-At: > From: Yuan Fu > Date: Fri, 25 Nov 2022 01:43:39 -0800 > Cc: "T.V Raman" , > emacs-devel@gnu.org > > > BTW, how can a user decide that tree-sitter modes should be used? For > > example, when I open a json file I get js-json-mode, not json-ts-mode, > > which also works, so support is available. Should user's augment > > auto-mode-alist? Or is there some "enable TS whenever possible and the > > devs think its support is in a usable state for that language" toggle? > > There is no global toggle, unfortunately. You could use auto-mode-alist or major-mode-remap-alist to enable tree-sitter modes, yes. I imagine there could be a third-party package that automatically enables tree-sitter for all supported nodes, maybe. I'm not sure a global toggle would make sense at this time: even if the user has the tree-sitter library installed, there's no guarantee that the grammar for a particular language is also installed. Only the user knows whether it is or isn't. Enabling a mode just to get an error message makes little sense. Perhaps in the future distros will catch up and provide installation of grammars that includes everything available, but until they do, we are better off with individual toggles. There's also a question of user preferences: some might prefer the non-TS versions for whatever reasons. IMO, per-mode toggles is currently the best compromise, given that we don't yet have enough user feedback and experience to decide on more general knobs.