turbanoff / RunConfigurationAsAction

Provides a way to use IntelliJ run configurations as buttons
24 stars 3 forks source link

Run Configuration - Macro Variable not working #9

Closed mvenghaus closed 3 years ago

mvenghaus commented 3 years ago

Hey,

really nice plugin!

But one litte thing. I've created a run configration with the following argument: --standard=PSR12 $FilePathRelativeToProjectRoot$

The keyboard shortcut works but then the macro/variable has always the value from the last run triggered outside your plugin.

Would be nice if you can fix this.

Regards Marcus

turbanoff commented 3 years ago

I've never used macros in Run Configurations. Can you please explain in more details,what configuration you have,what do you want to achieve, and what IntelliJ do if you run it directly?

mvenghaus commented 3 years ago

I am using PHPStorm not IntelliJ. I want to have a keyboard shortcut for phpcbf (PHP Code Beautifier Fixer). The only other way I found is through External Tools. But External Tools are global and I have different configurations for different projects.

So the command is "vendor/bin/phpcbf --standard=PSR12 $FilePathRelativeToProjectRoot$"

Steps to reproduce:

  1. create run configuration with macro of active editor file
  2. click the icon in the toolbar and everything works fine
  3. when i now press the keyboard shortcut with your plugin the task run's again
  4. but when i now change to another file in editor and press the shortcut the old file is used when I click the icon in the toolbar it runs with the new active file
skogler commented 3 years ago

I am currently affected by the same problem. The use case for me is to run a project-specific linter on the current file, which works as a run configuration, but does not work when run via this plugin.

Basically, it is running a python script with arguments --config-file setup.cfg $FilePath$

skogler commented 3 years ago

I think it is easy to fix by adding the DataContext argument to ExecutionUtil.runConfiguration here:

https://github.com/turbanoff/RunConfigurationAsAction/blob/ca8906a7f995f1d23e22b208a5f7b2405f3e50d9/src/org/turbanov/actions/RunConfigurationAsAction.java#L63

My guess for how this would look is:

        ExecutionUtil.doRunConfiguration(runConfig, executor, target, null, e.getDataContext());