New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: better format defaults #45
Conversation
3982c3c
to
df8b4a4
Compare
formatters/basic/config.go
Outdated
LineEnding: lineBreakStyle, | ||
Indent: 2, | ||
LineEnding: lineBreakStyle, | ||
RetainLineBreaks: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rule has been that if there's a feature that has to hack around a shortcoming of the yaml library, I have it turned off by default to make the most stable possible default experience (despite weird behaviours from the library).
Does the vscode extension not read from the working directory's .yamlfmt
or accept options from settings.json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it's fine. I suppose everybody needs the feature and I could make it default in vscode.
@@ -122,7 +122,7 @@ func RunCommand( | |||
if err != nil { | |||
return err | |||
} | |||
fmt.Println(string(out)) | |||
fmt.Print(string(out)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea, I didn't think of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, how about this PR only changes this line 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be fine with me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. it's done.
Each time saving the file, the format result will always insert a new line at the end, which is annoying.
df8b4a4
to
98a64ba
Compare
Now I bundle the binary as a vscode extension. I use the stdin method to do the job and set the editor settings
formatOnSave
true. Each time saving the file, the format result will always insert a new line at the end, which is annoying.So, this PR: