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

✅ Solution for CodeCoverage and the initial error ✅ #39

Open
jorgecc opened this issue Mar 5, 2022 · 0 comments
Open

✅ Solution for CodeCoverage and the initial error ✅ #39

jorgecc opened this issue Mar 5, 2022 · 0 comments

Comments

@jorgecc
Copy link

jorgecc commented Mar 5, 2022

  1. This library uses a really old version of the jetbrains SDK, so it is not as simply as patch or update the plugins.

  2. It is a hacky solution:

Edited the file:
src/cc/takacs/php_codeverage_display/ApplicationPlugin.java

And it is the changes:

public class ApplicationPlugin implements ApplicationComponent {
    @Override
    public void initComponent() {
        ApplicationManager.getApplication().executeOnPooledThread(() -> {
            try {
                TimeUnit.SECONDS.sleep(30);
            } catch (InterruptedException e) {
            }
            AnAction toolbarButton = ActionManager.getInstance().getAction("cc.takacs.php_codeverage_display.toolbar.enable");
            final boolean enabled = PropertiesComponent.getInstance().getBoolean("cc.takacs.php_codeverage_display.enabled", true);
            new ToggleIconService().toggleIcon(toolbarButton.getTemplatePresentation(), enabled);

        });
    }
// and the rest of the code.

What it does?. It waits 30 seconds (async) and loads the library and apparently it works, however we must wait 30 seconds to call this plugins but who opens the ide and start a test with coverage in 30 seconds?

It doesn't delay the load of the IDE because it is asyncronous.

  1. The code (of the class in java is here)

https://gist.github.com/jorgecc/c9bec0c17bac4df51b2ac58bc3ff01b3

  1. And the plugins compiled is here <-- 😉 (tl/dr use this one)

https://github.com/jorgecc/phpunit_codecoverage_display/blob/master/phpunit_codecoverage_display.jar

How to install it?

In PHPStorm -> plugins -> (the wheel menu) -> Install Plugins from disk -> select the file and restart PHPStorm. It should replace the old plugins.

And what if it fails? Shrug.

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

1 participant