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
Refactored runtime/ftplugin/zig.vim, removed upstream comment, and removed aucmd and auto formatting support. #13803
base: master
Are you sure you want to change the base?
Conversation
…and auto formatting support.
I believe autocmd that does autoformat should absolutely not happen by default. |
I would also avoid all
On windows gvim Should be either opt-in or just a ftplugin help entry on how to set up |
Is there a reason not to send your more general changes through the maintainer's repo? |
They might disagree with the proposed changes, but yeah it needs to be addressed there too(first?). PS, |
The general changes can be added to the zig.vim plugin after the fact, if they want them. And please note that I am only referring to |
Just as an example, the go ft plugin was split into two, one bare bones and one more ide-like. Edit: And again, the rust ftplugin implementation also has exactly the same problem as noted. We have merged a lot of special and opinionated support for rust fmt and cargo, which I don't believe should be a part of the vim runtime either. |
let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' | ||
let b:undo_ftplugin = 'setl isk< fo< sua< mp< def<' | ||
|
||
if get(g:, 'zig_recommended_style', 1) |
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.
if get(g:, 'zig_recommended_style', 1)
That variable should be documented. Please place a short section into runtime/doc/syntax.txt (e.g. see how it is done for other synax files, like :h ft-python-syntax
. Don't forget to add a tag and update the last change header please.
https://github.com/ziglang/zig.vim added auto formatting and linting (and population of the qflist) on save as a aucmd with an opt-out configuration, and was then merged into vim runtime. This seems to me like something that should be left up to that plugin and not be a part of vim.
It should probably be:
opt-in, as it is very unexpected behavior and uncharacteristic of vim to do something like this automatically
or removed entirely, as it should be left up to the user to register that kind of behavior if they want it through a plugin.
This PR does the latter.
I could not find any concrete guidelines of what built in file type plugins should and should not do, I am personally fine with whatever, opt-in, or remove the format/astcheck functionality. But in any case I think it should not register any aucmds by default without opting in to it (i.e. the check for opt in should be for registering the aucmd, not for running the formatter or not). I have noted that the rust filetype support also has a lot of options available as opt-in, and it also always registers an aucmd.
Is this the direction vim is moving in? i.e. upstreaming oppinionated plugins for integrating languages tightly?
My expectation before going down this rabbit hole was that built-in language supports only provided: filetype, filetype detection, syntax, indentation, and a makeprg.
The
zig.vim
plugin wants to be an ide-like plugin, and this PR removes the upstream dependency for the ftplugin implementation. I also made some consistency changes to the code in how undo_ftplugin is handled and added thezig_recommended_style
as consistent with other ftplugins. The only significant thing left is the g:zig_std_dir/path and execution of zig env, which might also be up for discussion if it should be removed.