From: Randy Taylor <dev@rjt.dev>
To: sskostyaev@gmail.com
Cc: 61006@debbugs.gnu.org
Subject: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Wed, 25 Jan 2023 02:35:20 +0000 [thread overview]
Message-ID: <i4EUpaCSiAz1ayuSJYiUZlfEP_Pn1l1Frt0Ah-xd3mUQFn7IyDA3WQ_kk6GNSJ3K-uhzcEwCGchD0_zRaDFT_EypsOpkuz2SUEdJW2wLu2k=@rjt.dev> (raw)
In-Reply-To: <4e1f92dc54d94cf4860490c643b5fd565deb0e1a.camel@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 968 bytes --]
On Sunday, January 22nd, 2023 at 05:00, sskostyaev@gmail.com <sskostyaev@gmail.com> wrote:
>
> Hi. Thank you all for great work.
> In go-ts-mode indentation breaks in function or method definition if
> arguments placed on separate lines like this:
> `func transform( s string, ) string {`
> This code should be indented like this:
> `func transform( s string, ) string {`
Thanks for the report. I've attached a patch that fixes this.
> Also `go-ts-mode-indent-offset' should be 8 by default. In go world there is gofmt which is a real standart for code indentation. It would be great if emacs will provide the same indentation out of the box.
And addresses this.
> There is also other issue - sometimes go-ts-mode syntax highliting breaks when I actively use it with` lsp-mode`- refactorings, auto formatting etc. But I can't reproduce it with`eglot`.
Seems like an `lsp-mode` problem then? I only use `eglot` and haven't noticed anything amiss.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-go-ts-mode-parameter-indentation-and-set-indent-.patch --]
[-- Type: text/x-patch; name=0001-Fix-go-ts-mode-parameter-indentation-and-set-indent-.patch, Size: 1474 bytes --]
From 6595a4592c2ea2d9cff4203d53d91dccae8dc1cd Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Tue, 24 Jan 2023 21:20:48 -0500
Subject: [PATCH] Fix go-ts-mode parameter indentation and set indent offset to
8
* lisp/progmodes/go-ts-mode.el (go-ts-mode-indent-offset): Change it
to 8.
(go-ts-mode--indent-rules): Add indentation for parameters.
(Bug#61006)
---
lisp/progmodes/go-ts-mode.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
index d552e1360e0..5a97aa5d680 100644
--- a/lisp/progmodes/go-ts-mode.el
+++ b/lisp/progmodes/go-ts-mode.el
@@ -38,7 +38,7 @@
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-search-subtree "treesit.c")
-(defcustom go-ts-mode-indent-offset 4
+(defcustom go-ts-mode-indent-offset 8
"Number of spaces for each indentation step in `go-ts-mode'."
:version "29.1"
:type 'integer
@@ -80,6 +80,7 @@ go-ts-mode--indent-rules
((parent-is "import_spec_list") parent-bol go-ts-mode-indent-offset)
((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset)
((parent-is "literal_value") parent-bol go-ts-mode-indent-offset)
+ ((parent-is "parameter_list") parent-bol go-ts-mode-indent-offset)
((parent-is "type_spec") parent-bol go-ts-mode-indent-offset)
((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset)
(no-node parent-bol 0)))
--
2.39.1
next prev parent reply other threads:[~2023-01-25 2:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-22 10:00 bug#61006: 29.0.60; Wrong indentation in go-ts-mode sskostyaev
2023-01-25 2:35 ` Randy Taylor [this message]
2023-01-25 2:46 ` Randy Taylor
2023-01-25 4:06 ` sskostyaev
2023-01-26 2:39 ` Randy Taylor
2023-01-26 8:30 ` Eli Zaretskii
2023-01-25 9:54 ` sskostyaev
2023-01-25 10:13 ` sskostyaev
2023-01-26 2:41 ` Randy Taylor
2023-01-26 4:43 ` Sergey Kostyaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='i4EUpaCSiAz1ayuSJYiUZlfEP_Pn1l1Frt0Ah-xd3mUQFn7IyDA3WQ_kk6GNSJ3K-uhzcEwCGchD0_zRaDFT_EypsOpkuz2SUEdJW2wLu2k=@rjt.dev' \
--to=dev@rjt.dev \
--cc=61006@debbugs.gnu.org \
--cc=sskostyaev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).