GNU bug report logs - #61006
29.0.60; Wrong indentation in go-ts-mode

Previous Next

Package: emacs;

Reported by: sskostyaev <at> gmail.com

Date: Sun, 22 Jan 2023 13:40:01 UTC

Severity: normal

Found in version 29.0.60

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61006 in the body.
You can then email your comments to 61006 AT debbugs.gnu.org in the normal way.

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#61006; Package emacs. (Sun, 22 Jan 2023 13:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to sskostyaev <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 22 Jan 2023 13:40:02 GMT) Full text and rfc822 format available.

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

From: sskostyaev <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; Wrong indentation in go-ts-mode
Date: Sun, 22 Jan 2023 17:00:09 +0700
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 {
```
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.

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`.

In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.36, cairo version 1.17.6) of 2023-01-11 built on feofanlaptop
Repository revision: 384504edf35751eec2be9b52be5d3b250217d68f
Repository branch: makepkg
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-native-compilation=aot --with-
pgtk
 --without-xaw3d --with-sound=no --with-tree-sitter --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PGTK
PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP XIM GTK3 ZLIB

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LANG: ru_RU.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Go

Minor modes in effect:
  shell-dirtrack-mode: t
  eglot--managed-mode: t
  pixel-scroll-precision-mode: t
  flymake-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug find-dired go-ts-mode treesit face-
remap
display-line-numbers files-x hippie-exp misearch multi-isearch shell
pcomplete vc-dir log-edit message sendmail mailcap yank-media puny
dired
dired-loaddefs rfc822 mml mml-sec epa epg rfc6068 epg-config gnus-util
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-
util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader add-
log
vc-hg vc-bzr vc-src vc-sccs vc-cvs vc-rcs log-view pcvs-util smerge-
mode
diff vc vc-git diff-mode vc-dispatcher tabify apropos cus-edit cus-
start
cus-load wid-edit time dune skeleton vc-svn eglot external-completion
array filenotify jsonrpc ert ewoc debug backtrace url-util url-parse
auth-source eieio eieio-core password-cache json map url-vars imenu
tuareg tuareg-compat tuareg-opam smie find-file pixel-scroll cua-base
gopcaml-mode merlin-xref xref merlin-cap merlin easy-mmode advice pcase
crm ocp-indent cl gopcaml bookmark pp edmacro kmacro derived find-func
use-package-core time-date checkdoc lisp-mnt flymake-proc flymake
project byte-opt compile text-property-search comint ansi-osc ansi-
color
ring thingatpt comp comp-cstr warnings icons subr-x rx cl-seq cl-macs
gv
cl-extra help-mode bytecomp byte-compile icomplete cl-loaddefs cl-lib
elec-pair misterioso-theme rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-
generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 324901 69046)
 (symbols 48 17609 6)
 (strings 32 55854 8316)
 (string-bytes 1 1941813)
 (vectors 16 45873)
 (vector-slots 8 1509242 228698)
 (floats 8 261 571)
 (intervals 56 23782 309)
 (buffers 984 54))

-- 
Best regards,
Sergey Kostyaev




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Wed, 25 Jan 2023 02:36:01 GMT) Full text and rfc822 format available.

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

From: Randy Taylor <dev <at> rjt.dev>
To: sskostyaev <at> gmail.com
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Wed, 25 Jan 2023 02:35:20 +0000
[Message part 1 (text/plain, inline)]
On Sunday, January 22nd, 2023 at 05:00, sskostyaev <at> gmail.com <sskostyaev <at> 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.
[0001-Fix-go-ts-mode-parameter-indentation-and-set-indent-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Wed, 25 Jan 2023 02:47:01 GMT) Full text and rfc822 format available.

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

From: Randy Taylor <dev <at> rjt.dev>
To: sskostyaev <at> gmail.com
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Wed, 25 Jan 2023 02:46:05 +0000
[Message part 1 (text/plain, inline)]
On Tuesday, January 24th, 2023 at 21:35, Randy Taylor <dev <at> rjt.dev> wrote:
> 
> On Sunday, January 22nd, 2023 at 05:00, sskostyaev <at> gmail.com sskostyaev <at> 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.

Addendum to my last patch: added indentation support for interfaces as it was missing. Everything else is the same.
[0001-Fix-go-ts-mode-indentation-and-set-indent-offset-to-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Wed, 25 Jan 2023 05:32:02 GMT) Full text and rfc822 format available.

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

From: sskostyaev <at> gmail.com
To: Randy Taylor <dev <at> rjt.dev>
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Wed, 25 Jan 2023 11:06:45 +0700
Thank you!

Fixed now.

В Ср, 25/01/2023 в 02:46 +0000, Randy Taylor пишет:
> On Tuesday, January 24th, 2023 at 21:35, Randy Taylor <dev <at> rjt.dev>
> wrote:
> > 
> > On Sunday, January 22nd, 2023 at 05:00,
> > sskostyaev <at> gmail.com sskostyaev <at> 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.
> 
> Addendum to my last patch: added indentation support for interfaces
> as it was missing. Everything else is the same.


-- 


Best regards,
Sergey Kostyaev





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Wed, 25 Jan 2023 09:55:01 GMT) Full text and rfc822 format available.

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

From: sskostyaev <at> gmail.com
To: Randy Taylor <dev <at> rjt.dev>
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Wed, 25 Jan 2023 16:54:34 +0700
В Ср, 25/01/2023 в 02:35 +0000, Randy Taylor пишет:
> On Sunday, January 22nd, 2023 at 05:00,
> sskostyaev <at> gmail.com <sskostyaev <at> gmail.com> wrote:
> 
> 
> > 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.

I have reproduced this issue with eglot. But I can't share my working
code screenshots and can't provide easy way to reproduce. Not sure how
can I help to localize the problem then. This issue is not related to
indentation.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Wed, 25 Jan 2023 10:14:02 GMT) Full text and rfc822 format available.

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

From: sskostyaev <at> gmail.com
To: Randy Taylor <dev <at> rjt.dev>
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Wed, 25 Jan 2023 17:13:12 +0700
[Message part 1 (text/plain, inline)]
В Ср, 25/01/2023 в 16:54 +0700, sskostyaev <at> gmail.com пишет:
> В Ср, 25/01/2023 в 02:35 +0000, Randy Taylor пишет:
> > On Sunday, January 22nd, 2023 at 05:00,
> > sskostyaev <at> gmail.com <sskostyaev <at> gmail.com> wrote:
> > 
> > 
> > > 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.
> 
> I have reproduced this issue with eglot. But I can't share my working
> code screenshots and can't provide easy way to reproduce. Not sure
> how
> can I help to localize the problem then. This issue is not related to
> indentation.

Screenshot attached.
-- 
Best Regards,
Sergey Kostyaev
[go-ts-mode-broken-hl.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Thu, 26 Jan 2023 02:41:01 GMT) Full text and rfc822 format available.

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

From: Randy Taylor <dev <at> rjt.dev>
To: sskostyaev <at> gmail.com
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Thu, 26 Jan 2023 02:39:46 +0000
On Tuesday, January 24th, 2023 at 23:06, sskostyaev <at> gmail.com <sskostyaev <at> gmail.com> wrote:
> 
> Thank you!
> 
> Fixed now.

Thanks for testing. Can someone install the patch to emacs-29?

> 
> В Ср, 25/01/2023 в 02:46 +0000, Randy Taylor пишет:
> 
> > On Tuesday, January 24th, 2023 at 21:35, Randy Taylor dev <at> rjt.dev
> > wrote:
> > 
> > > On Sunday, January 22nd, 2023 at 05:00,
> > > sskostyaev <at> gmail.com sskostyaev <at> 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.
> > 
> > Addendum to my last patch: added indentation support for interfaces
> > as it was missing. Everything else is the same.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Thu, 26 Jan 2023 02:42:02 GMT) Full text and rfc822 format available.

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

From: Randy Taylor <dev <at> rjt.dev>
To: sskostyaev <at> gmail.com
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Thu, 26 Jan 2023 02:41:33 +0000
On Wednesday, January 25th, 2023 at 05:13, sskostyaev <at> gmail.com <sskostyaev <at> gmail.com> wrote:
> 
> В Ср, 25/01/2023 в 16:54 +0700, sskostyaev <at> gmail.com пишет:
> 
> > В Ср, 25/01/2023 в 02:35 +0000, Randy Taylor пишет:
> > 
> > > On Sunday, January 22nd, 2023 at 05:00,
> > > sskostyaev <at> gmail.com sskostyaev <at> gmail.com wrote:
> > > 
> > > > 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.
> > 
> > I have reproduced this issue with eglot. But I can't share my working
> > code screenshots and can't provide easy way to reproduce. Not sure
> > how
> > can I help to localize the problem then. This issue is not related to
> > indentation.
> 
> 
> Screenshot attached.
> --
> Best Regards,
> Sergey Kostyaev

Thanks. Can you please open a new bug for this? Please also see if you can reproduce it with emacs -Q. We can continue the discussion in the new bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61006; Package emacs. (Thu, 26 Jan 2023 04:45:02 GMT) Full text and rfc822 format available.

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

From: Sergey Kostyaev <sskostyaev <at> gmail.com>
To: Randy Taylor <dev <at> rjt.dev>
Cc: 61006 <at> debbugs.gnu.org
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Thu, 26 Jan 2023 04:43:54 +0000
[Message part 1 (text/plain, inline)]
I will try to reproduce it with emacs -Q and then fill new bug. Thank you.

--
Best regards,
Sergey Kostyaev

26 января 2023 г. 02:41:33 UTC, Randy Taylor <dev <at> rjt.dev> пишет:
>On Wednesday, January 25th, 2023 at 05:13, sskostyaev <at> gmail.com <sskostyaev <at> gmail.com> wrote:
>> 
>> В Ср, 25/01/2023 в 16:54 +0700, sskostyaev <at> gmail.com пишет:
>> 
>> > В Ср, 25/01/2023 в 02:35 +0000, Randy Taylor пишет:
>> > 
>> > > On Sunday, January 22nd, 2023 at 05:00,
>> > > sskostyaev <at> gmail.com sskostyaev <at> gmail.com wrote:
>> > > 
>> > > > 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.
>> > 
>> > I have reproduced this issue with eglot. But I can't share my working
>> > code screenshots and can't provide easy way to reproduce. Not sure
>> > how
>> > can I help to localize the problem then. This issue is not related to
>> > indentation.
>> 
>> 
>> Screenshot attached.
>> --
>> Best Regards,
>> Sergey Kostyaev
>
>Thanks. Can you please open a new bug for this? Please also see if you can reproduce it with emacs -Q. We can continue the discussion in the new bug.
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Thu, 26 Jan 2023 08:31:02 GMT) Full text and rfc822 format available.

Notification sent to sskostyaev <at> gmail.com:
bug acknowledged by developer. (Thu, 26 Jan 2023 08:31:03 GMT) Full text and rfc822 format available.

Message #34 received at 61006-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Randy Taylor <dev <at> rjt.dev>
Cc: 61006-done <at> debbugs.gnu.org, sskostyaev <at> gmail.com
Subject: Re: bug#61006: 29.0.60; Wrong indentation in go-ts-mode
Date: Thu, 26 Jan 2023 10:30:41 +0200
> Cc: 61006 <at> debbugs.gnu.org
> Date: Thu, 26 Jan 2023 02:39:46 +0000
> From: Randy Taylor <dev <at> rjt.dev>
> 
> On Tuesday, January 24th, 2023 at 23:06, sskostyaev <at> gmail.com <sskostyaev <at> gmail.com> wrote:
> > 
> > Thank you!
> > 
> > Fixed now.
> 
> Thanks for testing. Can someone install the patch to emacs-29?

Done, thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 23 Feb 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 62 days ago.

Previous Next


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