[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 6a64cbf 439/495: Fix indentation for composite lit
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 6a64cbf 439/495: Fix indentation for composite literal keys. |
Date: |
Sat, 7 Aug 2021 09:06:04 -0400 (EDT) |
branch: elpa/go-mode
commit 6a64cbfbccbab64bed321ebf119f832cce25f9eb
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fix indentation for composite literal keys.
Incomplete composite literal keys were indenting like labels:
Foo{
Bar:
instead of
Foo{
Bar:
This became very noticeable after adding ":" to the electric indent
characters. Fix by not doing the label indent if point is in a
composite literal.
Closes: #291 [via git-merge-pr]
---
go-mode.el | 3 ++-
test/testdata/indentation_tests/composite_literal_key.go | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/go-mode.el b/go-mode.el
index d669442..de361e0 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -887,7 +887,8 @@ INDENT is the normal indent of this line, i.e. that of the
case body."
(looking-at (concat go-label-regexp
":\\([[:space:]]*/.+\\)?$\\|" go--case-or-default-regexp))
;; don't think last part of multiline case statement is a label
(not (go-previous-line-has-dangling-op-p))
- (not (go--in-case-clause-list-p)))
+ (not (go--in-case-clause-list-p))
+ (not (go--in-composite-literal-p)))
;; comment attached above a "case" statement
(go--case-comment-p indent))
diff --git a/test/testdata/indentation_tests/composite_literal_key.go
b/test/testdata/indentation_tests/composite_literal_key.go
new file mode 100644
index 0000000..d8160db
--- /dev/null
+++ b/test/testdata/indentation_tests/composite_literal_key.go
@@ -0,0 +1,5 @@
+func _() {
+ Foo{
+ Bar:
+ }
+}
- [nongnu] elpa/go-mode 5056b85 403/495: Use xref functions if available, (continued)
- [nongnu] elpa/go-mode 5056b85 403/495: Use xref functions if available, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3f02a16 406/495: Add go-guru-definition-other-window, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7eb5b3d 409/495: Delete go-mode-autoloads.el, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2d1d33a 407/495: Fix off-by-one in point calculations, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7f87c32 416/495: Permit empty guru scope, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode be9186c 417/495: Support remote files in `gofmt', ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 287595a 420/495: Don't traverse symlinks when recursing directories, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b990645 425/495: Fix call expr indenting after dangling operator., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode ac6dd8c 430/495: Fix go-remove-unused-imports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e8674fe 437/495: Expand electric indent config a bit, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6a64cbf 439/495: Fix indentation for composite literal keys.,
ELPA Syncer <=
- [nongnu] elpa/go-mode fb1272c 441/495: indent: fix performance in giant comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c020e2c 456/495: Fontify type names in more places., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2a1584f 454/495: Readme: add note recommending goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 57becfb 460/495: Fontify type names in interface declarations, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cf53daa 459/495: Fix indentation in naked blocks., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f872781 466/495: Fontify variable names., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode acec0aa 471/495: Fix Content-Type for https://play.golang.org/share, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cad6d0a 472/495: Fix fontification performance issue, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1fbe6a8 490/495: Fix comment filling at start of buffer., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 5186c83 491/495: Support basic indenting in multiline comments., ELPA Syncer, 2021/08/07