fmt: don't call command twice for successful output#422
Merged
Conversation
Owner
Author
|
Just remembered that there was a problem with Vim's own history when we try to replace it, but again it could be something entire different. I'm going to use this for a couple of days extensively to catch any errors before I merge this PR. |
Previously we were calling gofmt/goimports twice when the command was successful. First we call it so we can catch any errors and display it(in quickfix window), if there is no errors, we called it again, purely so we could pipe the commands output (which in our case is the formatted output) directly to the current buffer. This was very fast for gofmt, but with goimports it was slow. Now, we don't call the command again if it's successful, instead we just replace the output of the first command with the current buffer. This is actually so obvious and I'm thinking why I didn't I this in the first place. Humans ...
Owner
Author
|
This is good to go. No significant problems found yet. |
fatih
added a commit
that referenced
this pull request
May 14, 2015
fmt: don't call command twice for successful output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously we were calling gofmt/goimports twice when the command was
successful. First we call it so we can catch any errors and display
it(in quickfix window), if there is no errors, we called it again,
purely so we could pipe the commands output (which in our case is the
formatted output) directly to the current buffer. This was very fast
for gofmt, but with goimports it was slow.
Now, we don't call the command again if it's successful, instead we
just replace the output of the first command with the current buffer.
This is actually so obvious and I'm thinking why I didn't I this in the
first place. Humans ...