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 integration on feature/tree-sitter Date: Sat, 07 May 2022 21:48:12 +0300 Message-ID: <837d6xxjpv.fsf@gnu.org> References: <9E6D13F6-7E50-44EE-A357-C971A11A3636@gmail.com> <837d6xzpac.fsf@gnu.org> <7B1F29B4-045A-420E-8FD7-C7C72FF14DDC@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7536"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 07 20:49:17 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 1nnPUT-0001pE-IG for ged-emacs-devel@m.gmane-mx.org; Sat, 07 May 2022 20:49:17 +0200 Original-Received: from localhost ([::1]:48094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPUS-0007OL-A8 for ged-emacs-devel@m.gmane-mx.org; Sat, 07 May 2022 14:49:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPTZ-0006d9-P1 for emacs-devel@gnu.org; Sat, 07 May 2022 14:48:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPTZ-0007Qs-Fu; Sat, 07 May 2022 14:48: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=/vNlkFoizGX4/sSsf1KSVjnUrN85Xh56wmHqknBlcNM=; b=ZvfPSwn2iCBV KdZ0laRYn9AYUs3TVl4WzDwfMU3dOPbMbni8c/SQsiCcJ0aH6ROD94HShOYN7xWGCEVoLyorWawk+ kx6hCf0oUKNyDW4BrlFy4wcLYqoypNEyFAN+Zs61XW3/o57uGAg5yBR2yrVU8ESifG1It214GgQdU Hc4pMcy53fQT+rgjWpm7hER7qi8nmRDWlqlZ3U/QU9oaRGWAKXitFWlSWyp89vHdN7aUXQB6uVEBv /QGfjBF4bdEup9RBZ4uKJCerWqrcw/lIkVc5HcepJN8dGfyDRHQ8H1NaOSV8dWx2PpNniP/mOltnD nYctymlUwAIKIaYl1wuyug==; Original-Received: from [87.69.77.57] (port=4242 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 1nnPTY-0003KU-Vn; Sat, 07 May 2022 14:48:21 -0400 In-Reply-To: <7B1F29B4-045A-420E-8FD7-C7C72FF14DDC@gmail.com> (message from Yuan Fu on Sat, 7 May 2022 11:27:11 -0700) 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" Xref: news.gmane.io gmane.emacs.devel:289425 Archived-At: > From: Yuan Fu > Date: Sat, 7 May 2022 11:27:11 -0700 > Cc: emacs-devel@gnu.org > > > Would you please suggest how to "play with it"? What features to turn > > on and how, what commands and displays to try, etc. Posting such > > instructions should allow all of us get to testing this branch much > > sooner and easier. > > Some suggestions on top of my head: > > - Load the attached treesit-demo.el which contains a very basic C major mode, ts-c-mode, that gives you some font-locking and indentation using tree-sitter features. > - Get a C file, change its extension to .tsc, and open it > - The major mode should be ts-c-mode, and it should have some basic fontification. > - Type M-x treesit-show-buffer-tree RET to see the AST of the C file, probably want to use this on a smaller C file. > - Type M-x treesit-inspect-mode RET to display the AST of the node at point in the mode-line, see more explanation in its doctoring. > - Set treesit--indent-verbose to t, and try to indent some lines, and see which indentation rule is matched. > > Is this the sort of things you are looking for? Yes, thanks. However, I hoped that the font-lock and indentation are already integrated with tree-sitter, and all that is needed for a given major-mode to use it is to flip some variable. I didn't expect to need a completely separate major mode for C sources, for example. It sounds like we are farther from the goal that I thought we were, and some serious work is still ahead of us to get this integrated into the existing major modes.