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

Issues with Debugging #72

Closed
djschilling opened this issue Jan 9, 2024 · 7 comments · Fixed by #75
Closed

Issues with Debugging #72

djschilling opened this issue Jan 9, 2024 · 7 comments · Fixed by #75
Labels
bug 🐞 Something isn't working

Comments

@djschilling
Copy link

When using this lib debugging gets harder.
I cannot set a breakpoint in a File that gets proxied from this lib.

Can this be improved? I am using PHPStorm.

@WalterWoshid
Copy link
Contributor

WalterWoshid commented Jan 9, 2024

That's weird, for me it worked. I am using PhpStorm as well. Can you tell me what PhpStorm version you are using and your OS?

@WalterWoshid WalterWoshid added the bug 🐞 Something isn't working label Jan 9, 2024
@djschilling
Copy link
Author

djschilling commented Jan 9, 2024

PhpStorm 2023.3.2
MacOS: Sonoma 14.1.1 (23B81)

My Debugging Settings:

Bildschirmfoto 2024-01-09 um 09 45 53

I can step into the library Code and eventually come to the proxied file, but that is very complicated.

Maybe the cacheDir is the problem?
This is how my kernel looks like:

<?php

namespace Churchtools\Lib\Aop;

use Churchtools\Lib\Config\Environment;
use Okapi\Aop\AopKernel;

class CTAopKernel extends AopKernel {
    protected array $aspects = [];

    protected function preInit(): void {
        $this->cacheDir = sys_get_temp_dir() . '/ct-aop-cache/' . BUILD_VERSION;
        parent::preInit();
    }

    protected function configureOptions(): void {
        $this->environment = Environment::isLocal()
            ? \Okapi\CodeTransformer\Core\Options\Environment::DEVELOPMENT
            : \Okapi\CodeTransformer\Core\Options\Environment::PRODUCTION;
    }
}

@WalterWoshid
Copy link
Contributor

I'll check it out. Can you also tell me in if the file you're trying to debug the line number of the breakpoint corresponds to the same line number in the proxy file? For example echo "Hello"; on line 27 should have the same code in the proxy on line 27.

@WalterWoshid
Copy link
Contributor

WalterWoshid commented Jan 9, 2024

I see what the problem is, cached files return the path to their location while non-cached files are passed through the StreamFilter WITH their original file path. I have to route all files through the StreamFilter first and then it should work

Just to make sure this is not a MacOS problem, could you delete your cache directory and test if the very first run of your code debugs the original file?

@djschilling
Copy link
Author

Just tested it. Without the cache it is working.

@djschilling
Copy link
Author

Any updates here? Would be really good if debugging would work properly.

@WalterWoshid
Copy link
Contributor

Hi @djschilling,

sorry for the late reply, had some health problems I needed to take care of first.

I fixed it and tested it on Windows, let me know if this works for you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants