unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Randy Taylor <dev@rjt.dev>
Cc: Eli Zaretskii <eliz@gnu.org>, theo@thornhill.no, 60025@debbugs.gnu.org
Subject: bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode
Date: Wed, 14 Dec 2022 11:55:06 -0800	[thread overview]
Message-ID: <B377A51D-368E-4253-895A-9FAA31B85416@gmail.com> (raw)
In-Reply-To: <5HEX4A0JH8fd_VGG1FbzJ8QtBZXlHLKtuAGgc_TUHvzKCzU2Q3PYbbi3rUWeLOBoJzg0qsQgVhwGZCF86A2Xg--I2ep5d1KjKoUoHrxXpqA=@rjt.dev>



> On Dec 14, 2022, at 8:21 AM, Randy Taylor <dev@rjt.dev> wrote:
> 
> On Wednesday, December 14th, 2022 at 07:02, Eli Zaretskii <eliz@gnu.org> wrote:
>> 
>>> Date: Tue, 13 Dec 2022 19:39:18 +0000
>> 
>>> From: Randy Taylor dev@rjt.dev
>>> Cc: 60025@debbugs.gnu.org, theo@thornhill.no, casouri@gmail.com
>>> 
>>> +** New major mode 'go-mod-ts-mode'.
>>> +A major mode based on the tree-sitter library for editing go.mod
>>> +files. It includes support for font-locking and indentation. This
>>> +mode will be auto-enabled for go.mod files.
>> 
>> 
>> Please quote go.mod as 'go.mod' (we quote file names and symbols in
>> NEWS).
>> 
>> Otherwise, this LGTM, thanks.
>> 
> 
> Thanks, here's the new patch. I double-quoted it since that's what other file names and extensions have in NEWS - hopefully that's right. Assuming that's OK, should be good to install.
> 
> Yuan, did you see my original post in this thread? I'm wondering how to go about tackling that indentation problem (I'm probably missing something very simple and obvious).

Ah, oops, replies below:

> I am having a tiny bit of trouble with a go.mod indentation rule. Using the patch, create a go.mod file anywhere, activate go-mod-ts-mode and add the following:
> 
> require ()
> 
> Place point inside the parens, and then hit enter. The expectation is that point will end up indented inside that block. If you add the text "test v1.0.0" and hit TAB, it will indent properly (and if you hit enter after that text it will indent properly for the next entry). If you go to the end of the line for the top paren and hit enter, it will not indent (and we want it to). It seems to give us no-node in that circumstance. Is there a simple indent rule that can match exactly that that I'm missing?

I think you can just test for the parent? In C, if point is at an empty line after a statement in a block, like this:

int main() {
  return 0;
  |
}

The matched rule is (parent-is “compond_statement”), where compound_statement is the block. In your case, I guess you can test if parent is the argument list.

Yuan




  reply	other threads:[~2022-12-14 19:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  2:13 bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode Randy Taylor
2022-12-13 12:25 ` Eli Zaretskii
2022-12-13 19:39   ` Randy Taylor
2022-12-14 12:02     ` Eli Zaretskii
2022-12-14 16:21       ` Randy Taylor
2022-12-14 19:55         ` Yuan Fu [this message]
2022-12-14 20:54           ` Randy Taylor
2022-12-14 21:27             ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 21:56               ` Randy Taylor
2022-12-15  2:15               ` Randy Taylor
2022-12-15  7:20                 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 16:40                   ` Randy Taylor
2022-12-15 18:06                     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 19:45                       ` Randy Taylor
2022-12-15 19:59                         ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 20:09                           ` Randy Taylor
2022-12-15 22:22                             ` Randy Taylor
2022-12-14  2:22 ` Yuan Fu
2022-12-16  1:22 ` Yuan Fu
2022-12-16  2:05   ` Randy Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B377A51D-368E-4253-895A-9FAA31B85416@gmail.com \
    --to=casouri@gmail.com \
    --cc=60025@debbugs.gnu.org \
    --cc=dev@rjt.dev \
    --cc=eliz@gnu.org \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).