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

Can this plugin run code in docker container and get the result in quickfix list? #273

Open
meicale opened this issue Mar 1, 2023 · 2 comments

Comments

@meicale
Copy link

meicale commented Mar 1, 2023

It is a cool plugin and I like it. I use docker container as the development environment as well, which is easy to share and manage. How can I run the code in this docker container and can consume put the result in the quick-fix list as well. Maybe, I can be done by substitute the command to command with prefix “docker exec [args]". Where can I change the command actually run by this plugin? The other thing is how to get the result generated in docker container can copy it back to the host and set it in quick-fix list.
Thank you in advance!

@skywind3000
Copy link
Owner

skywind3000 commented Mar 2, 2023

What you need is the command modifier: https://github.com/skywind3000/asyncrun.vim#command-modifier

you can define a new modifier in a standalone script in ~/.vim/autoload/asyncrun/program or any sub-directory named autoload/asyncrun/program inside a runtime-path.

here is an example: https://github.com/skywind3000/asyncrun.vim/blob/master/autoload/asyncrun/program/shebang.vim

this script allows you use:

:AsyncRun -program=shebang  ls -la

the command ls -la will be processed and replaced by shebang.vim before execution.

@meicale
Copy link
Author

meicale commented Mar 4, 2023

I don't think it is that straightforward. I use a compiler to deal with my python traceback and I have to use the same file directory between host and container. Can this be solved to provide something like path_mapping in neovim dap debugger remote? We can sed the result and replace with the right file path of the trace back result. I think it is quite common and helpful if we can support running code in docker easily. Path mapping and helper function can be one of the solutions to this. I know little about the vim script and can this done using lua? How should we put the result in the quickfix list using neovim api or lua function?

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

No branches or pull requests

2 participants