-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feature proposal] Add more possible commands in build_systems #2
Comments
I made the implementation and application in my branch add_dune if you want to see it. |
TLDR: All build systems suck and I couldn't hide them behind a consistent interface. If you have a solution to the problems I've ran into (see below), I will listen. I just removed an almost identical feature a while ago, see c0f0c26. But unlike your proposal I used the content of - \ 'build' : 'dune build',
- \ 'clean' : 'dune clean',
- \ 'run' : 'dune exec %RELPATH%/%HEAD%.exe',
+ \ 'build' : 'build',
+ \ 'clean' : 'clean',
+ \ 'run' : 'exec %RELPATH%/%HEAD%.exe', It had a few problems tough. If
I agree, the idea of this plugin is just to be able to run " somewhere in the config:
\ "build": "my-maker --fast --build-all" Now " E.g. GNU Make:
\ "build": "" Both :Build build build Not only that, but depending on the replacement strings the following commands may do completely different things: :Build clean
:Build build clean
:Build build --custom=true
:Build --custom=true This is confusing to new users without making it obvious why. This particular issue may be solved by always requiring to specify the build target. E.g. just plain But I'm not sure if thats the right way to go. Every argument passed to Now I can at least guarantee that
What if you want to run a different file from the file you are editing? How does it fit your workflow? |
So I started by answering your points one by one but a general point of view emerged from my answers. Here is how I think this plugin could be used:
Subcommands should not be specific to the underlying build system. Arguments to subcommands should be specific to the underlying build system and should be used by the user for more advanced tweaking. The plugin should not take care of them and only pass them to the underlying build system. Given that framework to answers your individual points:
If you want to call
In my proposal, the first argument passed to
As I said earlier, whether
I don't want to use As for actually running a different file, my proposal provides two solutions: I think this plugin is good because its scope is small: abstract away common tasks behind an homogeneous interface. |
Your views on what a sub-command should be make a lot of sense. The
I can see the need for having a run command which depends on the current buffers name. I don't know if it would interfere with anything, but it would definitely open a lot of doors to other build systems where you want to run the tests from the current file only. I will be happy to merge such a feature if you implement it. These things are important to me:
The function |
Very happy to see that it fits you.
I already implemented a proof of concept but it does not fit all those requirements, I will work on this. |
I'm not sure the same could be said for
|
Would you like to migrate all available build systems to this new configuration mode (while still keeping the old one available) ? EDIT: Actually as I look at writing help for the new feature I realize how hard it is to explain both systems together because the new one reflect the behavior of the plugin when there is no build system, while the old one reflect the semantic of |
The more I read the sources and the doc, the more I realize how similar are what I added and what you did for fallbacks and I think you really did a good job for that. |
On 10/4/20 10:45 PM, Théo Cavignac wrote:
I don't know what you mean with keeping "the old one available". There should be only one way to declare build systems. If you have to move the old ones to this new system, then do it. Just don't forget to do the same with
Yes, it will probably end up like this. Fallback commands won't have a |
This should be solvable by removing the "old" system. The subcommand way of doing it is consistent, superior and should be the only way to do it. |
Fixed on master. |
Hello,
In order to implement properly #1 I need the Build command to do be able to use different command templates depending on its parameters.
For example if I add the following to the s:build_systems dict:
Basically nothing work as expected:
Build
command produce the dune help messageBuild run
initialize the build directory but do nothing moreBuild build
actually build the projectBuild exec ./%:r.exe
would actually run the current file if it is defined in a dune file as an executable to be buit and the only dune file is in the current working directory of vim.So for a retro compatible fix of this I would propose that the
'command'
item of a build system could be either a string, in which case nothing changes, or a dictionary of specific commands.This dictionary would be similar to
s:language_cmds
items:Build
command, and'build'
would be used by defaults:prepare_cmd_for_shell
) and ran from the location of the first build system file foundAlso, a new magic should be added to
s:prepare_cmd_for_shell
:%RELPATH%
being the relative path directory where the command will be ran to the current file.This way I could implement my previous example as:
Eventually, a
'base'
key could be added to the'command'
dict (in this case the value would be 'dune') which would allow handling unknown arguments toBuild
(:Build runtest
would expand todune runtest
using'base'
).I would happily implement all of this but I do not want to take over your project @AlxHnr so what do you think ?
Does this conform to what you want for this plugin ?
The text was updated successfully, but these errors were encountered: