From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62371: [PATCH] Fix go-ts-mode incorrect docstring inserted for methods Date: Sat, 25 Mar 2023 15:17:48 +0300 Message-ID: <83o7ohc9eb.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36691"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62371@debbugs.gnu.org To: Evgeni Kolev , Randy Taylor , Dmitry Gutov , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 13:18:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pg2qc-0009IW-4j for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 13:18:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg2qQ-0006TT-K8; Sat, 25 Mar 2023 08:18:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg2qP-0006TG-Uz for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:18:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg2qP-0002qK-NG for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:18:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg2qP-0004fk-IQ for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 12:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62371 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62371-submit@debbugs.gnu.org id=B62371.167974668117954 (code B ref 62371); Sat, 25 Mar 2023 12:18:01 +0000 Original-Received: (at 62371) by debbugs.gnu.org; 25 Mar 2023 12:18:01 +0000 Original-Received: from localhost ([127.0.0.1]:41985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg2qO-0004fW-Ld for submit@debbugs.gnu.org; Sat, 25 Mar 2023 08:18:00 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg2qN-0004fK-Gf for 62371@debbugs.gnu.org; Sat, 25 Mar 2023 08:17:59 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg2qH-0002oN-7Z; Sat, 25 Mar 2023 08:17:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DZeP4gmq7dJY2HBBuoJ2C6BeVFB3fuGSXKuLNoZh4jk=; b=LPuyb+hKyF/O dBcsHcJEMVDFb4VlPolRypUP1ksYQiElJ7tUoq46ldRbR7O+butAgOws6MEEB+sTedYdWY0Jjb/kn avAAFth5gyTz3fD8kCN2jMkuEfve2n4AzNpeMuEKUlay9w5BX2MVdKXiZ9+XUV9lYmijSXRsR4Kdl MM6XSmM9nwsjfTp6dnMAeaP97mwcqlFIv718U2myohSJRJc9QrlEe+CyBt7zPu4b9eQVTzLkHko8N 22hS+Z6mRTmfDSGov2j8HLyXTDWR7DBzTrKOVVDDUC8ExE2uDvh0r6Hi4AsQVXvpLgkP8slQdovQk AApKPFyv7Xipszb8EMrPJg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg2qG-0002Ey-13; Sat, 25 Mar 2023 08:17:52 -0400 In-Reply-To: (message from Evgeni Kolev on Wed, 22 Mar 2023 10:05:56 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258549 Archived-At: > From: Evgeni Kolev > 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?