Motivation: Reduce the feedback loop when writing new code as much as possible.
Currently, I need to do a full bazel build of my project whenever I have made changes. However, often the mistakes I have made when first writing code would be evident just from compiling the current file.
For autocompletion, I build a compile_commands.json file using bazel. If I grep for the current file in that, there is a compile command in there that takes less than a second if I put it in a separate file and chmod +x
it. The question is, how can I best integrate this in Vim? I was unable to find any plugins that already do this.
compile_commands.json is generated for an LSP-client plugin; I currently use CoC. So it might be logical to build this as an extension of the LSP client plugin.
I think it wouldn't be logical to set the makeprg, since that is normally used to compile the whole project.
json_decode()
, get the compilation command associated to the current file, and momentarily set&makeprg
with this value to run:make
.plugin
tag? I'm asking if there are plugins that do this, and if possible, how to integrate it in some existing LSP plugins. If you know more about what that tag should and shouldn't be used for, could you write that in the tag guidance?