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

Run Configuration - Macro Variable not working #9

Closed
mvenghaus opened this issue Apr 27, 2021 · 4 comments
Closed

Run Configuration - Macro Variable not working #9

mvenghaus opened this issue Apr 27, 2021 · 4 comments

Comments

@mvenghaus
Copy link

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
Copy link
Owner

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
Copy link
Author

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
Copy link

skogler commented Jun 1, 2021

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
Copy link

skogler commented Jun 1, 2021

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

ExecutionUtil.runConfiguration(runConfig, executor, target);

My guess for how this would look is:

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

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

3 participants