From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70345: [PATCH] 29.1.50; csharp-ts-mode indentation of if statements with single-statement body Date: Mon, 15 Apr 2024 21:01:27 +0200 Message-ID: <87mspusb5k.fsf@thornhill.no> References: <87o7afod31.fsf@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2465"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70345@debbugs.gnu.org To: Jacob Leeming Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 15 21:02:48 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rwRbL-0000QC-4j for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Apr 2024 21:02:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwRaj-00059q-2y; Mon, 15 Apr 2024 15:02:09 -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 1rwRaW-00055N-H0 for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 15:02:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwRaU-0004hw-9B for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 15:01:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwRaf-00012s-UR for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 15:02:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Apr 2024 19:02:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70345 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70345-submit@debbugs.gnu.org id=B70345.17132077173728 (code B ref 70345); Mon, 15 Apr 2024 19:02:05 +0000 Original-Received: (at 70345) by debbugs.gnu.org; 15 Apr 2024 19:01:57 +0000 Original-Received: from localhost ([127.0.0.1]:39026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwRaV-0000ww-1p for submit@debbugs.gnu.org; Mon, 15 Apr 2024 15:01:56 -0400 Original-Received: from out-189.mta0.migadu.com ([91.218.175.189]:58240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwRaP-0000oK-4c for 70345@debbugs.gnu.org; Mon, 15 Apr 2024 15:01:51 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1713207690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DVZJbvniHwjXDMDpcuvvBJTLiG4xFPrQ28Tq213NipY=; b=svLOInecFXTLlB0MABMkAe0tIGS5JGzVSdaqEmSNmck9DjrmT9fmXQyJgPBIIcb7aAH/Ze 1MBv984UKrgLia1Vt4i8kQayVahwkiAlge/qyu20/9B9oMYbPQfsVcy73K8JKjRUJm9Mta Ixk+CqMDZ+AAVghDJ8K+D+EURPPeLNgp8ck2SblSYl3qCoyf3/eGhVBLKvP4EBKgees7nd 592wdrUEDwcdEXkB1znGs8UBPxdtXm0ust8IQB/CXvL+7StmsYM/bS6q9J9Zpt8kiR6hBr Av+j7vyGzA1CWPFFLa1/45sGirPabiyzfPs5uGD75j27WNmmZHypR3JWpFTEDg== In-Reply-To: <87o7afod31.fsf@gmail.com> (Jacob Leeming's message of "Thu, 11 Apr 2024 21:32:02 +0100") X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283391 Archived-At: > Hi all, > Hi, Jacob! >>>From emacs -Q: > > Evaluate this elisp to set up treesitter for csharp: > > (setq treesit-language-source-alist '((c-sharp > "https://github.com/tree-sitter/tree-sitter-c-sharp" "master" "src")) > treesit-load-name-override-list '((c-sharp > "libtree-sitter-csharp" "tree_sitter_c_sharp")) > major-mode-remap-alist '((csharp-mode . csharp-ts-mode))) > > Insert the following text into a csharp-ts-mode buffer: > > if (true) > var x = 2; > > Try to indent the variable declaration of the function with > indent-for-tab-command. Nothing will happen. I'd expect to see this: > > if (true) > var x = 2; > > This issue can be fixed with the following patch: > > diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el > index 53c52e6..1a7d535 100644 > --- a/lisp/progmodes/csharp-mode.el > +++ b/lisp/progmodes/csharp-mode.el > @@ -678,7 +678,8 @@ csharp-ts-mode--indent-rules > ((parent-is "binary_expression") parent 0) > ((parent-is "block") parent-bol csharp-ts-mode-indent-offset) > ((parent-is "local_function_statement") parent-bol 0) > - ((parent-is "if_statement") parent-bol 0) > + ((match "block" "if_statement") parent-bol 0) > + ((parent-is "if_statement") parent-bol csharp-ts-mode-indent-offset) > ((parent-is "for_statement") parent-bol 0) > ((parent-is "for_each_statement") parent-bol 0) > ((parent-is "while_statement") parent-bol 0) > Looks good to me. Are you willing to pack this up with a nice test confirming the behavior? All the best, Theo