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

[Feature Request]: support for preLaunchTask #227

Closed
honeyspoon opened this issue Aug 4, 2020 · 2 comments
Closed

[Feature Request]: support for preLaunchTask #227

honeyspoon opened this issue Aug 4, 2020 · 2 comments

Comments

@honeyspoon
Copy link

Vscode has the preLaunchTask option in the json for launch configurations.

If we could have this option that would be perfect.
I realize that it would require a whole task system and dependency resolution which would be outside the scope of this project.
There does not seem to be a plugin that replicates the task system of vscode.
I'm currently using AsyncTasks even if there is no task dependency system and they don't plan on adding it.
An integration with this plugin or the ability to run a vim command specified in the preLaunchTask would be great.

The common use case is to build before running. If you have any other way to fix this please let me know.

@puremourning
Copy link
Owner

Use :make | call vimspector#Launch() ? Make a custom command to do that ?

depending on the complexity, you can use a 'variable' to run a shell command prior to starting debugging, such as this:

{
   "configurations": {
      "test": {
        "variables":
        {
            "MAKE_IGNORED": { "shell": "make -C ${workspaceRoot} ${fileBasenameNoExtension}" }
        },
        ....
    }
}

I'm not going to implement a whole task system as that's way out of scope for this plugin.

You can do that with other things such as custom function, custom commands, mappings etc., or just a exit_cb on a job: job_start( ..., #{ ..., exit_cb: { id, status -> call vimspector#Launch() } } )

@honeyspoon
Copy link
Author

I'm not going to implement a whole task system as that's way out of scope for this plugin.

Completely agree

I forgot about the pipe in vim to run commands.

For anyone using Asynctask, here's my setup.
When using asynctask the pipe is ignored if you use the command
:AsyncTask ninja | call vimspector#Launch()
so you have to use this variant.
:execute 'AsyncTask ninja' | call vimspector#Launch()

you also have to set the mode in the the task config to vim which makes it synchronous and defeats the async part of the plugin but I mainly use it as a place to store common tasks.

My build task looks like this.

[configure_release]
command=cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
cwd=$(VIM_ROOT)/build
save=2

[ninja]
command=ninja -C build
cwd=$(VIM_ROOT)
save=2

[sync-ninja]
command=ninja -C build
cwd=$(VIM_ROOT)
mode=vim
save=2

and I run the debugger with this :execute 'AsyncTask sync-ninja' | call vimspector#Launch()

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants