Skip to content

Commit 66ae207

Browse files
authored
devconfig: use two spaces instead of tab (#1589)
The default hujson formatting uses tabs, which causes a bunch of whitespace changes for existing configs. Most JSON formatters/LSP servers also tend to default to 2 spaces. Add a simple replace all to change all tabs to " ", which should be safe since raw tab characters are not allowed in valid JSON values.
1 parent 2c6bdd8 commit 66ae207

File tree

2 files changed

+161
-159
lines changed

2 files changed

+161
-159
lines changed

internal/devconfig/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package devconfig
55

66
import (
7+
"bytes"
78
"encoding/json"
89
"io"
910
"net/http"
@@ -87,7 +88,8 @@ func DefaultConfig() *Config {
8788
}
8889

8990
func (c *Config) Bytes() []byte {
90-
return c.ast.root.Pack()
91+
b := c.ast.root.Pack()
92+
return bytes.ReplaceAll(b, []byte("\t"), []byte(" "))
9193
}
9294

9395
func (c *Config) Hash() (string, error) {

0 commit comments

Comments
 (0)