From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jacob Leeming 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 22:38:00 +0100 Message-ID: <8734rmnqkd.fsf@jacobDebianWorkLaptop.mail-host-address-is-not-set> References: <87o7afod31.fsf@gmail.com> <87mspusb5k.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36334"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70345@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 16 01:41:15 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 1rwVwp-0009GX-2H for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Apr 2024 01:41:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwVwV-00024o-TN; Mon, 15 Apr 2024 19:40:55 -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 1rwVwQ-00024Q-SO for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 19:40:51 -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 1rwVwQ-0000Jd-8C for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 19:40:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwVwb-00070Y-S1 for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 19:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jacob Leeming Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Apr 2024 23:41:01 +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.171322441026516 (code B ref 70345); Mon, 15 Apr 2024 23:41:01 +0000 Original-Received: (at 70345) by debbugs.gnu.org; 15 Apr 2024 23:40:10 +0000 Original-Received: from localhost ([127.0.0.1]:40318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwVvl-0006tc-KZ for submit@debbugs.gnu.org; Mon, 15 Apr 2024 19:40:09 -0400 Original-Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:42478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwVvj-0006s5-9Q for 70345@debbugs.gnu.org; Mon, 15 Apr 2024 19:40:08 -0400 Original-Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4187991d01bso6528225e9.1 for <70345@debbugs.gnu.org>; Mon, 15 Apr 2024 16:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713224388; x=1713829188; darn=debbugs.gnu.org; h=mime-version:message-id:cc:user-agent:references:lines:date :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BigdgMX3GDgZM/dBpwETeciIJslcUVwj1JOba7dMq88=; b=Nc45PSgd3cgn22i/vuADuWCtFZ3pNXDj59ZFfTImgSa4xQuRrQW06SJXTee9zskt6y XRien8DXYQe4L0s8Ux+Ajxmo0TEG9UfnVoWdL3IL0pArzOYoAfwXv6jmLPFxIjkbV4N4 f71ciqY0TM9S7VywpAbagihzcLRlayBiiZc2i1SL5F8nf0IWElrpjtGzVzZMuPR/4y/b xxKXidp214qTzcUW7JnSkZw8Qh/Y/QfYWrSXuOgqDEKL0Ofxhnn3my8fCu9FhRG65sCp V98WLi/yeyS6NZRejaG9GFOAel+m/iUAoHc+wQHNp4gQhq3ivDfPFqAlFrgPc//JcJwB zwMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713224388; x=1713829188; h=mime-version:message-id:cc:user-agent:references:lines:date :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=BigdgMX3GDgZM/dBpwETeciIJslcUVwj1JOba7dMq88=; b=fckivR/nL9VSVGLvneKmJ6V4BvHtngSn2aid5Gtwr0CxwepDkgkhvfbNKQYAVkgf63 nQ6MNWBcY6b5eKUWKWxoOTDb/axlCfc0jnORISQUKCqljLsWVc/Q1idaed4SANWjja6y umHcNn6n3h+ObqcTiYmdBKNpX7zci+ij2Zic9H1ps+LjCdDPLhfUjDW46JCZmhpFpKuJ Kg2Ok5eoA3zbJHzo2rMszjSj8r7f2t279cfJ6bkT2ITlDf5esjsgsDXQh7gmxW4FdFnU ghgR2p1IfmI0SYU84IPmBekH6ShgiNMfznBuGfmyhIKBM68khMznEzqmao0Z9AYc9e/T jyGg== X-Gm-Message-State: AOJu0YzDyWwVDYrPLVWsAVzdonYI1JJQeGpqAT1DDzQ9Nq89MF8Rgbxj YNb/tpbBBHXD3dsS2swzEh9YUd4aZP7jX8R3uwrwxa05enlNIHC7RW0fyA== X-Google-Smtp-Source: AGHT+IH+z93R/OeQdvjbdRP7N+TcjpftdFNz7Jcz+j19TRVN3sDLo0irBBqqHieiCG5qsSbXLmIxsw== X-Received: by 2002:a7b:c3d6:0:b0:418:91ae:befc with SMTP id t22-20020a7bc3d6000000b0041891aebefcmr220111wmj.0.1713224388210; Mon, 15 Apr 2024 16:39:48 -0700 (PDT) Original-Received: from jacobDebianWorkLaptop ([2a00:23c7:238a:701:ff8a:6fe9:c7f8:fb19]) by smtp.gmail.com with ESMTPSA id m2-20020a05600c4f4200b0041892c774bcsm296377wmq.2.2024.04.15.16.39.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 16:39:47 -0700 (PDT) In-Reply-To: <87mspusb5k.fsf@thornhill.no> (Theodor Thornhill's message of "Mon, 15 Apr 2024 21:01:27 +0200") Original-Lines: 57 X-From-Line: nobody Mon Apr 15 22:38:02 2024 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:283401 Archived-At: Theodor Thornhill writes: >> 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 I'm willing, where can I find other tests for csharp-ts-mode? Had a quick look round the emacs repo but could not find any. Cheers, Jacob