Skip to content
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

Fix breaking non-modifiable buffers in some cases #2097

Merged
merged 3 commits into from
Dec 24, 2018

Conversation

mixedCase
Copy link
Contributor

Fixes #2096

@@ -5,6 +5,9 @@ set cpo&vim
let s:current_file = expand("<sfile>")

function! go#template#create() abort
if !&modifiable
return
endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this function does not write the file, why is this change necessary?

Copy link
Contributor Author

@mixedCase mixedCase Dec 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some clarification on related issue; but maybe the check should be somewhere else in the call stack?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of returning early here, it's may be better to return early in https://github.com/fatih/vim-go/blob/master/plugin/go.vim#L278-L283

Copy link
Contributor Author

@mixedCase mixedCase Dec 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Opted for an additional check instead of early return since I felt it was still clear given the var name and context, but please let me know if you'd still prefer it as an early return.

@bhcleek bhcleek merged commit c893efa into fatih:master Dec 24, 2018
bhcleek added a commit that referenced this pull request Dec 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants