Skip to content
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

Why not add a build.lua? #20

Open
winstxnhdw opened this issue Jan 28, 2024 · 4 comments
Open

Why not add a build.lua? #20

winstxnhdw opened this issue Jan 28, 2024 · 4 comments

Comments

@winstxnhdw
Copy link

winstxnhdw commented Jan 28, 2024

This way we can avoid the build step.

@f3fora
Copy link
Owner

f3fora commented Jan 29, 2024

at the time, build.lua wasn't a thing.
feel free to open a PR!

@winstxnhdw
Copy link
Author

Done.

@f3fora
Copy link
Owner

f3fora commented Mar 2, 2024

I personally think that adding build.lua or any other building script is not worth the effort, since

  • build.lua is Lazy.nvim specific.
  • the go build ... is a small string which changes a lot depending on the machine and the user preferences, and so a default value is not so useful.
  • the code to execute a shell command needs to be implemented and maintained.

Plugins managers already implement solid command execution, which I do not believe it is worth re-implement.
For exemple, the ideal way to execute go build will be via vim.loop.spawn (using cwd option to set the correct folder.) as already done by Lazy.nvim and others.

In the end, the only changes with a build.lua will be the introduction of a build flag in the plugin config and so to have a configuration that looks like this:

{
    'f3fora/nvim-texlabconfig',
    opts = {
        build = 'go build --whatever-flags',
        ...
    },
}

instead of this:

{
    'f3fora/nvim-texlabconfig',
    opts = {
        ...
    },
    build = 'go build --whatever-flags',
}

since I personally use different flags depending on what machine I use.

@winstxnhdw
Copy link
Author

Sure, but you're making users do a lot of work just to setup a simple plugin, especially since go build without flags don't work OOTB.

If we use build.lua, they only need to add their Lazy dir to PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants