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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
Subject: bug#62371: closed (Re: bug#62371: [PATCH] Fix go-ts-mode
 incorrect docstring inserted for methods)
Date: Sun, 26 Mar 2023 12:06:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 62371 <at> debbugs.gnu.org.

-- 
62371: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62371
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Randy Taylor <dev <at> rjt.dev>
Cc: evgeni.d.kolev <at> gmail.com, 62371-done <at> debbugs.gnu.org, casouri <at> gmail.com,
 dgutov <at> yandex.ru
Subject: Re: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted
 for methods
Date: Sun, 26 Mar 2023 15:05:48 +0300
> Date: Sun, 26 Mar 2023 11:44:05 +0000
> From: Randy Taylor <dev <at> rjt.dev>
> Cc: evgeni.d.kolev <at> gmail.com, dgutov <at> yandex.ru, casouri <at> gmail.com, 62371 <at> debbugs.gnu.org
> 
> > > 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?
> 
> It's for master, this feature didn't make it in to emacs-29.

Thanks, now installed on master, and closing the bug.

[Message part 3 (message/rfc822, inline)]
From: Evgeni Kolev <evgeni.d.kolev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods
Date: Wed, 22 Mar 2023 10:05:56 +0200
[Message part 4 (text/plain, inline)]
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).
[0001-Fix-go-ts-mode-incorrect-docstring-inserted-for-meth.patch (application/octet-stream, attachment)]

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

Previous Next


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