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

Themosis Framework: loader paths #47

Open
cknott opened this issue Oct 29, 2024 · 3 comments
Open

Themosis Framework: loader paths #47

cknott opened this issue Oct 29, 2024 · 3 comments
Labels
feature New feature or request

Comments

@cknott
Copy link

cknott commented Oct 29, 2024

I am using twiggy in neovim and am very pleased with the overall features and experience.

However i was wondering if its possible to somehow point the "Go to definition" action for a template in a custom namespace (eg. @atoms/template/template.twig) to the correct path in the filesystem?

Thanks a lot
Christian

@moetelo
Copy link
Owner

moetelo commented Oct 30, 2024

Hello!

If you're using Symfony, it should gather custom namespaces by running the debug:twig command.

async #loadEnvironment(): Promise<TwigEnvironment | null> {
const result = await this.#runSymfonyCommand<SymfonyTwigDebugJsonOutput>('debug:twig');
if (!result) {
return null;
}
return parseDebugTwigOutput(result);
}

If not, let me know which framework you’re using

@moetelo moetelo added the question Further information is requested label Oct 30, 2024
@cknott
Copy link
Author

cknott commented Oct 30, 2024

Thanks, im using the Themosis Framework which incorporates a Laravel environment to a Wordpress installation. Would it be possible to create a custom configuration / FrameworkEnvironment for this use case?

@moetelo
Copy link
Owner

moetelo commented Oct 31, 2024

Is there a way to programmatically resolve namespaces? For example, Symfony provides a CLI tool which has an option to query all the info about the current environment:

$ php bin/console debug:twig --format json

{
    ...
    "loader_paths": {
        ...
        "@Twig": [
            "templates\/bundles\/TwigBundle"
        ],
        "@!Twig": [
            "templates\/bundles\/TwigBundle"
        ],
        "(None)": [
            "templates"
        ]
    }
}

Or maybe the overall file structure is predefined?


Otherwise, we'll have to add an option to manually pass loader paths to the extension. This would also cover the cases like #2

@moetelo moetelo changed the title How to resolve templates in a custom namespace? Themosis Framework: loader paths Oct 31, 2024
@moetelo moetelo added feature New feature or request and removed question Further information is requested labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants