GNU bug report logs - #67710
[PATCH] 29.1.50 missing indent rule for parameter list in csharp-ts-mode

Previous Next

Package: emacs;

Reported by: Jacob Leeming <jacobtophatleeming <at> gmail.com>

Date: Fri, 8 Dec 2023 14:19:03 UTC

Severity: wishlist

Tags: patch

Merged with 67709

Found in version 29.1.50

To reply to this bug, email your comments to 67710 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67710; Package emacs. (Fri, 08 Dec 2023 14:19:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jacob Leeming <jacobtophatleeming <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 08 Dec 2023 14:19:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jacob Leeming <jacobtophatleeming <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 29.1.50 missing indent rule for parameter list in
 csharp-ts-mode
Date: Fri, 8 Dec 2023 14:12:28 +0000
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:

void ExampleFunction(
    int arg1,
  int arg2,
 int arg3,
int arg4,
    int arg5
)
{
    Console.WriteLine(arg1);
}

Try to indent the parameters of the function with
indent-for-tab-command. Nothing will happen.

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..8cc4e95 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -704,7 +704,8 @@ csharp-ts-mode--indent-rules
      ((parent-is "object_type") parent-bol csharp-ts-mode-indent-offset)
      ((parent-is "enum_body") parent-bol csharp-ts-mode-indent-offset)
      ((parent-is "arrow_function") parent-bol csharp-ts-mode-indent-offset)
-     ((parent-is "parenthesized_expression") parent-bol
csharp-ts-mode-indent-offset))))
+     ((parent-is "parenthesized_expression") parent-bol
csharp-ts-mode-indent-offset)
+     ((parent-is "parameter_list") parent-bol csharp-ts-mode-indent-offset))))

 (defvar csharp-ts-mode--keywords
   '("using" "namespace" "class" "if" "else" "throw" "new" "for"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67710; Package emacs. (Fri, 08 Dec 2023 14:38:03 GMT) Full text and rfc822 format available.

Message #8 received at 67710 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jacob Leeming <jacobtophatleeming <at> gmail.com>
Cc: 67710 <at> debbugs.gnu.org
Subject: Re: bug#67710: [PATCH] 29.1.50 missing indent rule for parameter list
 in csharp-ts-mode
Date: Fri, 08 Dec 2023 16:37:11 +0200
merge 67710 67709
thanks

> From: Jacob Leeming <jacobtophatleeming <at> gmail.com>
> Date: Fri, 8 Dec 2023 14:12:28 +0000
> 
> >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:
> 
> void ExampleFunction(
>     int arg1,
>   int arg2,
>  int arg3,
> int arg4,
>     int arg5
> )
> {
>     Console.WriteLine(arg1);
> }
> 
> Try to indent the parameters of the function with
> indent-for-tab-command. Nothing will happen.
> 
> 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..8cc4e95 100644
> --- a/lisp/progmodes/csharp-mode.el
> +++ b/lisp/progmodes/csharp-mode.el
> @@ -704,7 +704,8 @@ csharp-ts-mode--indent-rules
>       ((parent-is "object_type") parent-bol csharp-ts-mode-indent-offset)
>       ((parent-is "enum_body") parent-bol csharp-ts-mode-indent-offset)
>       ((parent-is "arrow_function") parent-bol csharp-ts-mode-indent-offset)
> -     ((parent-is "parenthesized_expression") parent-bol
> csharp-ts-mode-indent-offset))))
> +     ((parent-is "parenthesized_expression") parent-bol
> csharp-ts-mode-indent-offset)
> +     ((parent-is "parameter_list") parent-bol csharp-ts-mode-indent-offset))))
> 
>  (defvar csharp-ts-mode--keywords
>    '("using" "namespace" "class" "if" "else" "throw" "new" "for"

This is an exact duplicate of bug#67709.  Merging.




Merged 67709 67710. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 08 Dec 2023 14:40:03 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 13 Feb 2025 07:07:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67710; Package emacs. (Sun, 23 Feb 2025 06:03:03 GMT) Full text and rfc822 format available.

Message #15 received at 67710 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67710 <at> debbugs.gnu.org,
 jacobtophatleeming <at> gmail.com, 67709 <at> debbugs.gnu.org
Subject: Re: bug#67709: 29.1.50; [patch] missing indent rule for parameter
 list in csharp-ts-mode
Date: Sun, 23 Feb 2025 06:02:15 +0000
Theodor Thornhill <theo <at> thornhill.no> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> Ping!  Theo, could you please look into this?
>>
>
> Absolutely, thanks!
>
> Theo

Theo, did you ever get the chance to look into this?

>>> Cc: 67709 <at> debbugs.gnu.org
>>> Date: Sat, 16 Dec 2023 13:39:58 +0200
>>> From: Eli Zaretskii <eliz <at> gnu.org>
>>>
>>> > From: Jacob Leeming <jacobtophatleeming <at> gmail.com>
>>> > Date: Fri, 8 Dec 2023 13:44:14 +0000
>>> >
>>> > >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:
>>> >
>>> > void ExampleFunction(
>>> >     int arg1,
>>> >   int arg2,
>>> >  int arg3,
>>> > int arg4,
>>> >     int arg5
>>> > )
>>> > {
>>> >     Console.WriteLine(arg1);
>>> > }
>>> >
>>> > Try to indent the parameters of the function with
>>> > indent-for-tab-command. Nothing will happen.
>>> >
>>> > 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..8cc4e95 100644
>>> > --- a/lisp/progmodes/csharp-mode.el
>>> > +++ b/lisp/progmodes/csharp-mode.el
>>> > @@ -704,7 +704,8 @@ csharp-ts-mode--indent-rules
>>> >       ((parent-is "object_type") parent-bol csharp-ts-mode-indent-offset)
>>> >       ((parent-is "enum_body") parent-bol csharp-ts-mode-indent-offset)
>>> >       ((parent-is "arrow_function") parent-bol csharp-ts-mode-indent-offset)
>>> > -     ((parent-is "parenthesized_expression") parent-bol
>>> > csharp-ts-mode-indent-offset))))
>>> > +     ((parent-is "parenthesized_expression") parent-bol
>>> > csharp-ts-mode-indent-offset)
>>> > +     ((parent-is "parameter_list") parent-bol csharp-ts-mode-indent-offset))))
>>> >
>>> >  (defvar csharp-ts-mode--keywords
>>> >    '("using" "namespace" "class" "if" "else" "throw" "new" "for"
>>>
>>> Theo, any comments?  Should I install this?
>>>
>>> Thanks.
>>>
>>>
>>>
>>>




This bug report was last modified 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.