From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.devel Subject: Re: tree-sitter: conceptional problem solvable at Emacs' level? Date: Sun, 16 Apr 2023 22:21:03 +0300 Message-ID: <4b31fd663886857221ec88cec2b0ae6644cf94b6.camel@yandex.ru> 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: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4357"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.46.4 Cc: Holger Schurig To: Theodor Thornhill , emacs-devel@gnu.org, Po Lu , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 16 21:21:57 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 1po7wi-0000wG-Lf for ged-emacs-devel@m.gmane-mx.org; Sun, 16 Apr 2023 21:21:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1po7w3-0001ia-Cx; Sun, 16 Apr 2023 15:21:15 -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 1po7w2-0001iO-LF for emacs-devel@gnu.org; Sun, 16 Apr 2023 15:21:14 -0400 Original-Received: from forward500a.mail.yandex.net ([178.154.239.80]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1po7vz-0000WN-RS; Sun, 16 Apr 2023 15:21:14 -0400 Original-Received: from mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0f:26a7:0:640:a2d5:0]) by forward500a.mail.yandex.net (Yandex) with ESMTP id C35B65E84C; Sun, 16 Apr 2023 22:21:04 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 3LgutAnDe4Y0-0gZmMd5g; Sun, 16 Apr 2023 22:21:04 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1681672864; bh=pJmCBu8zopkqENoXj1dLAKyl/pL3rrxClECVSkM8pzg=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=pb6ufeD6gSFcVP2iie7CHtQ7AM+ot5AIGVRNPBfShAtZ5uYmGcfyN+t1BBDxd3EMG ArXvEj8z9p2bCMxRvCco+sqEnEFQ9JRfK0xdGl/x/MiQYim9a/Z9V6wIKxC86mJaGa yr1z5yrqmravbSvLqDNlNXEw+msCeL/mrIYXnRvE= Authentication-Results: mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <0768E0D7-6D58-40AC-A1D4-784C27CE0D7F@thornhill.no> Received-SPF: pass client-ip=178.154.239.80; envelope-from=hi-angel@yandex.ru; helo=forward500a.mail.yandex.net 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, T_SCC_BODY_TEXT_LINE=-0.01 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: , 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:305347 Archived-At: 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.=C2=A0 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, n= ot > > > 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 t= wo > > > have > > > don't use tree-sitter either. > > > > I installed Sublime Text on my Archlinux and tested with the C++ code O= P > > posted. > > > > What I see is that ST does seem confused about indentation, while tryin= g to > > make > > a newline right after `slots:` line. > > > > However, if you try to make a newline after the `void someSlot() {};` l= ine, > > it > > will use the indentation used on the previous line. > > > > The default cc-mode in Emacs works similarly. The cc-ts-mode on the oth= er > > 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 ve= ry > > often > > in C and C++ code that you want some custom indentation level, so you j= ust > > 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 examp= le > describing exactly what you want in a code snippet and I'll add it. > > Thanks, > Theo Incidentally, I'm reading Stefan Monnier's paper presenting SMIE=C2=B9, and= it has the following example: > [=E2=80=A6] It also means that the indentation code should strive to obey= previous choices > that the user made. For example if the user wants to indent its code in t= he > following unconventional way: > > longfunctionname(argument1, argument2, > argument3, > argument4); > > while the user should not be surprised if the auto-indenter tries to alig= n > =E2=80=98argument3=E2=80=99 with =E2=80=98argument1=E2=80=99, it would be= reasonable for them to expect that > =E2=80=98argument4=E2=80=99 stays put by simply aligning it with its near= est sibling rather than > with the earlier =E2=80=98argument1=E2=80=99. That is to say: yeah, the previous indentation level should be used by defa= ult if=C2=A0 present. 1: https://arxiv.org/abs/2006.03103