-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
autoload/go/template.vim
Outdated
@@ -5,6 +5,9 @@ set cpo&vim | |||
let s:current_file = expand("<sfile>") | |||
|
|||
function! go#template#create() abort | |||
if !&modifiable | |||
return | |||
endif |
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.
Given that this function does not write the file, why is this change necessary?
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.
Added some clarification on related issue; but maybe the check should be somewhere else in the call stack?
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.
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
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.
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.
Fixes #2096