idanarye / vim-dutyl

Coordinate D tools to work together for you
http://www.vim.org/scripts/script.php?script_id=5003
79 stars 13 forks source link

compiler plugins #2

Closed ghost closed 10 years ago

ghost commented 10 years ago

i wrote the other day a simple function that sets errorformat and makeprg for d buffers. it sets makeprg differently depending on presence of a makefile or dub.json or neigther in the current directory or anywhere above it. now that i've glanced through some more docs i think the function should be split into a few compiler plugins, right? so i wonder if compiler plugins are within the scope of dutyl and if so could you at least add some stubs so that i know where to put my code (it's rather primitive since i'm both a vimscript and d noob but still).

idanarye commented 10 years ago

I don't think Dutyl is the right place for such functionality. Dutyl's purpose is to generate input and parse the output of different D tools without caring which tools they are as long as they provide the required functionality while your function cares very much what the build system is. Also Dutyl's functionality is ran upon request(save for setting the omnyfunc) while your function runs automatically to change the settings.

I don't think Dutyl can benefit from your function, and I don't see how your function can benefit from Dutyl. Both can be beneficial to users - but in their own way, and I wouldn't like to bunde your function in Dutyl and force the auto-setting-changing on Dutyl users, nor do I see a point in making your function depend on Dutyl(for what?) and forcing your users to get Dutyl.

This sounds more like the area of Makeshift, which already implemented the functionality you talk about. It supports Make, and you can easily send a pull request to add DUB support. It only sets the makeprg though - if you want to automatically set errorformat you can leave it at the ftplugin level, or alternatively you can try my Erroneous which can parse the output of Make(and various other build systems) do determine exactly which compiler caused the build to fail and set errorformat accordingly.

ghost commented 10 years ago

thanks for the detailed clarification.