From: Randy Taylor <dev@rjt.dev>
To: Roi Martin <jroi.martin@gmail.com>
Cc: 75362@debbugs.gnu.org
Subject: bug#75362: 29.4; go-ts-mode.el: wrong indentation inside var list
Date: Sun, 05 Jan 2025 22:05:09 +0000 [thread overview]
Message-ID: <zCI9Jr9K64psV3fLGw15EX5fh47mg_WOTtNXKc5gtfsuNAjZydRw5Oma0A_SgsMqf4XBq4b5h67On8loF98ysSqFvUJ1M8w6m0SCgVJNNR0=@rjt.dev> (raw)
In-Reply-To: <87h66e8u59.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
On Saturday, January 4th, 2025 at 10:40, Roi Martin <jroi.martin@gmail.com> wrote:
>
> When using the Go tree-sitter grammar v0.23.4 from
> https://github.com/tree-sitter/tree-sitter-go.git, indentation inside
> var lists does not work correctly.
>
> For instance, the following code is indented as:
>
> `var ( one = 1 )`
>
> Instead of:
>
> `var ( one = 1 )`
>
> Just in case it can help, I think this stopped working with grammar
> version `v0.21.1`, that introduced `var_spec_list`:
>
> https://github.com/tree-sitter/tree-sitter-go/compare/v0.21.0...v0.21.1
>
> Please, take it with a pinch of salt because I'm not very familiar with
> tree-sitter.
>
> [...]
>
Thanks for the report.
The attached patch fixes it for me.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-go-ts-mode-var-spec-indentation-Bug-75362.patch --]
[-- Type: text/x-patch; name=0001-Fix-go-ts-mode-var-spec-indentation-Bug-75362.patch, Size: 1010 bytes --]
From ecb80b849c3bc490085a4146b8f8d499949220c2 Mon Sep 17 00:00:00 2001
From: Randy Taylor <dev@rjt.dev>
Date: Sun, 5 Jan 2025 16:48:00 -0500
Subject: [PATCH] Fix go-ts-mode var spec indentation (Bug#75362)
v0.21.1 and onwards changed how this was indented.
* lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules):
Add rule for var_spec_list.
---
lisp/progmodes/go-ts-mode.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
index 747bf9a9da8..ccfdcb909e5 100644
--- a/lisp/progmodes/go-ts-mode.el
+++ b/lisp/progmodes/go-ts-mode.el
@@ -106,6 +106,7 @@ go-ts-mode--indent-rules
((parent-is "type_spec") parent-bol go-ts-mode-indent-offset)
((parent-is "type_switch_statement") parent-bol 0)
((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset)
+ ((parent-is "var_spec_list") parent-bol go-ts-mode-indent-offset)
(no-node parent-bol 0)))
"Tree-sitter indent rules for `go-ts-mode'.")
--
2.47.1
next prev parent reply other threads:[~2025-01-05 22:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 15:40 bug#75362: 29.4; go-ts-mode.el: wrong indentation inside var list Roi Martin
2025-01-05 22:05 ` Randy Taylor [this message]
2025-01-08 6:18 ` Yuan Fu
2025-01-08 13:02 ` Eli Zaretskii
2025-01-08 13:20 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='zCI9Jr9K64psV3fLGw15EX5fh47mg_WOTtNXKc5gtfsuNAjZydRw5Oma0A_SgsMqf4XBq4b5h67On8loF98ysSqFvUJ1M8w6m0SCgVJNNR0=@rjt.dev' \
--to=dev@rjt.dev \
--cc=75362@debbugs.gnu.org \
--cc=jroi.martin@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.