plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Feature Request]: Exclude specific files/paths from helper code generation

Open pindab0ter opened this issue 5 months ago • 8 comments

Feature Description

The issue

When generating helper code we currently get warnings for fixture classes in our test directory.

Image

First of all the tables cannot be found as the migrations are part of the specific test setup.

Secondly, these are test fixtures and I don't need or want to be indexed by the plugin.

The request

I would like a way to exclude specific files, paths and/or patterns from being indexed.

pindab0ter avatar Aug 04 '25 09:08 pindab0ter

Thank you for taking the time to share your request! I've added it into internal feature tracker.

First of all the tables cannot be found as the migrations

This warning shown only if helper generation is setup with db connection search

these are test fixtures and I don't need or want to be indexed by the plugin.

Do tests/ folder marked as test sources? We may add check to skip search in test roots

gorbunov avatar Aug 04 '25 11:08 gorbunov

The classes are in a fixtures directory which is indeed an ancestor of a "Test Sources Root" directory (./tests/).

pindab0ter avatar Aug 04 '25 12:08 pindab0ter

Hi, I'm seeing the same warning with my test models. It would be helpful to have an annotation on the model class to exclude it from helper code generation.

Image

alexkart avatar Aug 05 '25 09:08 alexkart

Hi, I'm seeing the same warning with my test models. It would be helpful to have an annotation on the model class to exclude it from helper code generation.

Image

This is exactly our case as well. Tests with migrations in the setup of the test, which means they are not available during helper code generation.

pindab0ter avatar Aug 05 '25 10:08 pindab0ter

In current release, you can create ide.json file in root of the project with following contents (adjust your class names or namespaces):

{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "helperCode": {
        "eloquent": {
            "ignoreClasses": [],
            "ignoreNamespaces": ["Tests\\Feature\\"]
        }
    }
}

It will ignore this models in Helper Code Generation. See if it will help for your cases. We will think of providing a way to do it through GUI settings

gorbunov avatar Aug 05 '25 10:08 gorbunov

@gorbunov doesn't seem to work

Image

alexkart avatar Aug 05 '25 11:08 alexkart

OK, after several runs it worked, thanks.

alexkart avatar Aug 05 '25 11:08 alexkart

Awesome, that worked for me. I had already looked for this in ide.json, but this workaround is currently undocumented.

pindab0ter avatar Aug 06 '25 08:08 pindab0ter