[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode
From: |
Yuan Fu |
Subject: |
bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode |
Date: |
Wed, 14 Dec 2022 11:55:06 -0800 |
> 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
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/12
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Eli Zaretskii, 2022/12/13
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/13
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Eli Zaretskii, 2022/12/14
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/14
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode,
Yuan Fu <=
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/14
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Theodor Thornhill, 2022/12/14
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/14
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/14
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Theodor Thornhill, 2022/12/15
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/15
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Theodor Thornhill, 2022/12/15
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/15
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Theodor Thornhill, 2022/12/15
- bug#60025: [PATCH] Add go-ts-mode and go-mod-ts-mode, Randy Taylor, 2022/12/15