unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#67710: [PATCH] 29.1.50 missing indent rule for parameter list in csharp-ts-mode
@ 2023-12-08 14:12 Jacob Leeming
  2023-12-08 14:37 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Jacob Leeming @ 2023-12-08 14:12 UTC (permalink / raw)
  To: 67710

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"





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#67710: [PATCH] 29.1.50 missing indent rule for parameter list in csharp-ts-mode
  2023-12-08 14:12 bug#67710: [PATCH] 29.1.50 missing indent rule for parameter list in csharp-ts-mode Jacob Leeming
@ 2023-12-08 14:37 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-12-08 14:37 UTC (permalink / raw)
  To: Jacob Leeming; +Cc: 67710

merge 67710 67709
thanks

> From: Jacob Leeming <jacobtophatleeming@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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-08 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-08 14:12 bug#67710: [PATCH] 29.1.50 missing indent rule for parameter list in csharp-ts-mode Jacob Leeming
2023-12-08 14:37 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).