-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add 'buf format' #70
Add 'buf format' #70
Conversation
src/formatter.ts
Outdated
|
||
// Use spawn instead of exec to avoid maxBufferExceeded error | ||
const p = cp.spawn(this.binaryPath, [document.fileName], { cwd }); | ||
// TODO: We need to use the CancellationToken. |
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.
See this.
Since buf doesn't yet support reading from stdin for formatting, this require some hacky work around of temporary files.
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.
Looks great - just a few comments, but otherwise looks nearly ready to go.
If we add support for |
Looks great - as long as you've verified this all works locally (i.e. formatting on save). I can't stamp because I'm the original author, but feel free to approve on your end (as a formality on my behalf) and we can merge from there. After this lands, we can create an issue here that says to adapt the implementation to using stdin with that feature exists. |
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.
self-approving, w00t!
This adds a
DocumentFormattingEditProvider
that addsbuf format
to the extension.A lot of the code here is referenced from Go's old
goFormat.ts
.