From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#61368: [PATCH] Extend go-ts-mode with support for pre-filling return statements Date: Sat, 18 Feb 2023 12:14:49 +0000 Message-ID: References: <83edr0nmq6.fsf@gnu.org> <83357flzys.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f28c7d05f4f860df" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6948"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Randy Taylor , Eli Zaretskii , Theodor Thornhill , 61368@debbugs.gnu.org To: Evgeni Kolev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 18 13:16:20 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 1pTM8a-0001fb-2I for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Feb 2023 13:16:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTM8L-0003gJ-Dj; Sat, 18 Feb 2023 07:16:05 -0500 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 1pTM8J-0003fo-7W for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 07:16:03 -0500 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 1pTM8I-0003Iw-HF for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 07:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTM8I-00028q-6Z for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 07:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Feb 2023 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61368 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61368-submit@debbugs.gnu.org id=B61368.16767225068162 (code B ref 61368); Sat, 18 Feb 2023 12:16:02 +0000 Original-Received: (at 61368) by debbugs.gnu.org; 18 Feb 2023 12:15:06 +0000 Original-Received: from localhost ([127.0.0.1]:42722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTM7O-00027X-8e for submit@debbugs.gnu.org; Sat, 18 Feb 2023 07:15:06 -0500 Original-Received: from mail-oi1-f174.google.com ([209.85.167.174]:35579) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTM7M-00026l-PQ for 61368@debbugs.gnu.org; Sat, 18 Feb 2023 07:15:05 -0500 Original-Received: by mail-oi1-f174.google.com with SMTP id bp9so1349733oib.2 for <61368@debbugs.gnu.org>; Sat, 18 Feb 2023 04:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=w5EJA5zRniAjz5Wyb1cPrSgJCoM5U413AjH5fAql5Tc=; b=dqMEZzyS2LH+RK+oREuM0NSNeJ0sMX3/wrsOVinlCoGK77nKqCzS14zG5Bbg5gjV3v NkpD8aHmfaU4l68Y+YIbjDLiV3k4mPkE1gMkBDrBAZ/nByFAMSwypXo5fhlptc9o0vfI ylWfE9nvg/DI1xsFh8yJv0VpNoERonTNNCtkEcbprHB1WERWyDN2yU2Z4UWRMtXVXZXM +n80kuvStURAMqaenCj/SviRSMOT9w/JSH5aFaPiDZysPpIfO6f6rURrihs1ILCQROMS TFiUBssQoOksxgNui1ps3vkqLFojdXR7xcTMWWELY5SCLwx5ME6yBuVKC6eegSnHpP3/ fz6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w5EJA5zRniAjz5Wyb1cPrSgJCoM5U413AjH5fAql5Tc=; b=Hll+2COSTIZknaG9X3gt4WoxLKEI/5uWWYLQpr7srmJPJ3xWDR2SWfvkxMPHOw38Sq Lh9FUVyiKCzbJSyrqhiAMJocd/m0cwk4ANHJJ+bJl4u7mmQHdY0N1s+apPe93kxrQg87 Msy8SIL5s6x7bcxxNSbH9q+jtRnCSt3z6nzZVN5/XePPhqs3RxgwiPhVr4ct8hEkEfFY K96KZ4L/STCQKWibo51onqdNdc5aTu4RN5RWgxpcCm8jHG2V1Mq2ujJAT5RciOa32wyQ 2PzUR4YkZj3BByf0oFxmxqgrbornjdz/f+rCg6sB2DlLanGjLhe26v+EdSCwLsZZVd2C aaeA== X-Gm-Message-State: AO0yUKUUAUYEuowgLZwT/F1VNP7+6uKiv0MtxPkyE0ilxVXldoxYLttu G8X5TmQJFediVdgzaotuWPwsqgWS515Puegy2+M= X-Google-Smtp-Source: AK7set9hnKBJABGKy5s+KYhWPUu4yjjyvYTJxFH82g5+yyLAQaVgFh5qkosh5PKFVaWOmtMGPr0Sep5XSO/NhqfYyJw= X-Received: by 2002:a05:6808:128b:b0:37b:9a3:136f with SMTP id a11-20020a056808128b00b0037b09a3136fmr11801oiw.6.1676722499126; Sat, 18 Feb 2023 04:14:59 -0800 (PST) In-Reply-To: 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:255963 Archived-At: --000000000000f28c7d05f4f860df Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Feb 18, 2023, 11:46 Evgeni Kolev wrote: > + Jo=C3=A3o, author of yasnippet. > > Hi, Jo=C3=A3o, I'd appreciate any suggestions you might have. I'm aiming = to > extend go-ts-mode with a snippet-like feature. go-ts-mode would be > able to insert a "smart / context-aware" return statement. My question > is - is there a way for major modes to provide yasnippet snippets? My > understanding is the snippets are either created by each user > individually, or distributed as a collection of snippets (e.g. > yasnippet-snippets). Snippets can be distributed as files, but that's not a very good way as I see it today. One of the reasons might be too leverage the TAB and menu expansion of the yasnippet system. But probably you don't want this, and snippets can also be defined programmatically, albeit not with a beautiful language. Are there any major modes which provide snippets > (I wasn't able to find any in emacs' repo)? > That's because yasnippet is not part of the Emacs repo proper, i.e. the "core". So adding snippets to major modes in the core would introduce into the core a dependency on an non-core ELPA package. Nevertheless, there are ways to conditionally provide functionality based on whether the non-core package is detected. A soft dependency. In my opinion it makes sense for popular non-core packages: company, markdown-mode, yasnippet, etc. Look at Eglot, for example. Jo=C3=A3o Jo=C3=A3o --000000000000f28c7d05f4f860df Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Feb 18, 2023, 11:46 Evgeni Kolev <evgenysw@gmail.com> wrote:
+ Jo=C3=A3o, author of yasnippet.

Hi, Jo=C3=A3o, I'd appreciate any suggestions you might have. I'm a= iming to
extend go-ts-mode with a snippet-like feature. go-ts-mode would be
able to insert a "smart / context-aware" return statement. My que= stion
is - is there a way for major modes to provide yasnippet snippets? My
understanding is the snippets are either created by each user
individually, or distributed as a collection of snippets (e.g.
yasnippet-snippets).

Snippets can be distributed as files, but that's not a = very good way as I see it today. One of the=C2=A0 reasons might be too leve= rage the TAB and menu expansion of the yasnippet system. But probably you d= on't want this, and snippets can also be defined programmatically, albe= it not with a beautiful language.=C2=A0

A= re there any major modes which provide snippets
(I wasn't able to find any in emacs' repo)?
<= /div>

That's because yasni= ppet is not part of the Emacs repo proper, i.e. the "core". So ad= ding snippets to major modes in the core would introduce into the core a de= pendency on an non-core ELPA package.

Nevertheless, there are ways to conditionally provide functio= nality based on whether the non-core package is detected.=C2=A0 A soft depe= ndency. In my opinion it makes sense for popular non-core packages: company= , markdown-mode, yasnippet, etc. Look at Eglot, for example.

Jo=C3=A3o

=
Jo=C3=A3o
--000000000000f28c7d05f4f860df--