GNU bug report logs - #62371
[PATCH] Fix go-ts-mode incorrect docstring inserted for methods

Previous Next

Package: emacs;

Reported by: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>

Date: Wed, 22 Mar 2023 08:07:01 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: evgeni.d.kolev <at> gmail.com, Randy Taylor <dev <at> rjt.dev>
Cc: casouri <at> gmail.com, 62371 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods
Date: Sun, 26 Mar 2023 07:34:00 +0300
> Date: Sat, 25 Mar 2023 19:37:17 +0000
> From: Randy Taylor <dev <at> rjt.dev>
> Cc: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>, Dmitry Gutov <dgutov <at> yandex.ru>, Yuan Fu <casouri <at> gmail.com>, 62371 <at> debbugs.gnu.org
> 
> On Saturday, March 25th, 2023 at 08:17, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > 
> > > From: Evgeni Kolev evgeni.d.kolev <at> gmail.com
> > 
> > > Date: Wed, 22 Mar 2023 10:05:56 +0200
> > > 
> > > The docstring inserted with go-ts-mode's C-c C-d was incorrectly
> > > prefixed with the receiver "(myStruct).":
> > > 
> > > // (myStruct).act
> > > func (m *myStruct) act () {...}
> > > 
> > > The above docstring is not correct because the receiver "myStruct"
> > > should not be in the docstring.
> > > 
> > > The issue is caused by imenu and go-ts-mode--defun-name using the same
> > > code to determine the defun name. Instead, they should produce
> > > different results - imenu should show the "myStruct" prefix, but the
> > > docstring should not.
> > > 
> > > This commit fixes the incorrect behavior by introducing an optional
> > > SKIP-PREFIX parameter to (go-ts-mode--defun-name). Pressing C-c C-d
> > > now inserts just the method name:
> > > 
> > > // act
> > > func (m *myStruct) act () {...}
> > > 
> > > * lisp/progmodes/go-ts-mode.el (go-ts-mode--defun-name): New optional
> > > parameter SKIP-PREFIX. (go-ts-mode-docstring):
> > > Call (go-ts-mode--defun-name t) instead of (treesit-defun-name).
> > 
> > 
> > Thanks.
> > 
> > Dmitry, Yuan, Randy: any comments?
> 
> I guess my email yesterday didn't make it through or got missed?

It didn't.  But gnu.org had severe DNS problems all day yesterday, so
many email messages were delivered with a long delay.  I wrote the
above before I saw your response.

> It looks good to me, feel free to install.

I tried, but it failed to apply.  Evgeni, could you please resubmit,
relative to the emacs-29 branch?




This bug report was last modified 2 years and 56 days ago.

Previous Next


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