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: conceptional problem solvable at Emacs' level? Date: Sat, 11 Feb 2023 10:43:12 +0200 Message-ID: <83lel4k2xr.fsf@gnu.org> References: <87zg9n45ig.fsf@yahoo.com> <0DDF6978-D75A-4137-9D93-6200908675B6@gmail.com> <837cwplxni.fsf@gnu.org> <83zg9lkagi.fsf@gnu.org> <87ttzt0wtv.fsf@yahoo.com> <357e68eacfb7931fae08704ebfcbe1178a08fd69.camel@yandex.ru> <0768E0D7-6D58-40AC-A1D4-784C27CE0D7F@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14027"; mail-complaints-to="usenet@ciao.gmane.io" Cc: theo@thornhill.no, emacs-devel@gnu.org, luangruo@yahoo.com, holgerschurig@gmail.com To: Konstantin Kharlamov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 11 09:44:12 2023 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 1pQlUR-0003RX-K6 for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Feb 2023 09:44:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQlU1-0000bh-4d; Sat, 11 Feb 2023 03:43:45 -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 1pQlTz-0000bZ-Vb for emacs-devel@gnu.org; Sat, 11 Feb 2023 03:43:43 -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 1pQlTz-0008B2-Hv; Sat, 11 Feb 2023 03:43:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=WV+GWWnW0FMmgIfQLaRj4wrnMRsXlsR+Q9oTMXb4Zjw=; b=J891qPySlcyg17QA59cy EKnBQLmNpOBWsr0kUTBg/RGOIx7DpEZKEBkhnYSv1enUYXxdY8wY1OwQUJE7L98c6p6CHpoDm6KPO vnIuwm1PtLujFfsjhaEhYvV7AE/+Y46Wbp3qV09bmZK4JZ/1SJGtZc5a6sq1s/mUBLoULbdrerIKy ssxgV5zoU/oLaPBe3iievbCmQR0ETrbyePD0wY3InyqrFaZEvvZ9LYnjSiCCWhwYzcsOFjfBPH78F EL484se6/1w+03DC2WPtQZk1G10cERy0C3mdCs/1XL7v1M9C76YcQWJkKvTSmpUEOHpO5eVFFv2tv 9sW9aSbh+jrrWQ==; 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 1pQlTy-0004lA-3r; Sat, 11 Feb 2023 03:43:43 -0500 In-Reply-To: (message from Konstantin Kharlamov on Sat, 11 Feb 2023 10:11:24 +0300) 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:303130 Archived-At: > From: Konstantin Kharlamov > Cc: Holger Schurig > Date: Sat, 11 Feb 2023 10:11:24 +0300 > > On Sat, 2023-02-11 at 07:51 +0100, Theodor Thornhill wrote: > > > > > > On 11 February 2023 07:36:26 CET, Konstantin Kharlamov > > wrote: > > > On Sat, 2023-02-11 at 09:25 +0300, Konstantin Kharlamov wrote: > > > > On Sat, 2023-02-11 at 10:17 +0800, Po Lu wrote: > > > > > Eli Zaretskii writes: > > > > > > > > > > > However, I meant the IDEs which are using tree-sitter and support > > > > > > developing C/C++ programs.  I believe some do. > > > > > > > > > > I think most of those have similar problems supporting macros. > > > > > Who knows their names? I may be able to ask some of their users. > > > > > > > > From my experience on and off work, there are just two IDEs (as in, not > > > > editors) > > > > used most widely for C++ code: QtCreator and Visual Studio. The first you > > > > discussed, the second is proprietary. > > > > > > > > Then again, people most often code in C++ and C with text editors, in that > > > > case > > > > popular choices from my experience: Sublime Text and VS Code. These two > > > > have > > > > don't use tree-sitter either. > > > > > > I installed Sublime Text on my Archlinux and tested with the C++ code OP > > > posted. > > > > > > What I see is that ST does seem confused about indentation, while trying to > > > make > > > a newline right after `slots:` line. > > > > > > However, if you try to make a newline after the `void someSlot() {};` line, > > > it > > > will use the indentation used on the previous line. > > > > > > The default cc-mode in Emacs works similarly. The cc-ts-mode on the other > > > hand > > > doesn't make use of the previous indentation, and I think it should. It > > > would > > > resolve that problem and others, because in my experience it happens very > > > often > > > in C and C++ code that you want some custom indentation level, so you just > > > make > > > one and you expect the editor to keep it while creating more new lines. > > > > > > > That last statement sounds easily solvable. Can you send me a short example > > describing exactly what you want in a code snippet and I'll add it. > > > > Thanks, > > Theo > > Thank you! The example is below, but please wait a bit just to make sure there's no opposition from other people, because I don't know if it works like this on purpose, or not. Since we are close to a pretest, I think we should have a defcustom which controls this behavior, and leave to users whether to turn this on or off.