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

Is there a way to add custom blade directives for autocompletion? #8

Closed
angeljqv opened this issue Mar 2, 2022 · 5 comments
Closed

Comments

@angeljqv
Copy link

angeljqv commented Mar 2, 2022

Is there a way to add custom blade directives for autocompletion?
Many Laravel packages come with their own directives, is there a setting to add these directives to autocomplete?

Thanks in advance

@haidubogdan
Copy link
Owner

It's not yet implemented, but I think it can be developed like a project option where paths to php files with custom directives are added.

@angeljqv
Copy link
Author

angeljqv commented Mar 3, 2022

that would be great 👍

Also there are custom directives which have closing tags
For example: laravel-permission

https://github.com/spatie/laravel-permission/blob/20dd894eb64e5b02de9dfa28aa13af0643b2e456/src/PermissionServiceProvider.php#L88-L100
@role @elserole @endrole

https://github.com/spatie/laravel-permission/blob/20dd894eb64e5b02de9dfa28aa13af0643b2e456/src/PermissionServiceProvider.php#L102-L109
@hasrole @endhasrole

@angeljqv
Copy link
Author

angeljqv commented Apr 11, 2022

custom directive file configuration - here you can add a php file where you define the new directive. So far just the name autocomplete is available. No declaration link feature or parameter hint is available.

Where is that?? on options?? i can't find the option

@haidubogdan
Copy link
Owner

haidubogdan commented Aug 16, 2022

Hi sorry for the late answer. I didn't have time to work on the plugin for some while and I noticed the custom directiveautocomplete flow was buggy

The Option for custom directive file path is in Project Properties
image
After adding the file to the list, on the blade template autocomplete process you should have the hint for custom directives names.
The method directive from such a service file can be static or direct.

@angeljqv
Copy link
Author

angeljqv commented Aug 17, 2022

@haidubogdan amazing, thank you, works great

Maybe it is not possible, but what about this idea

It doesn't work with relative paths
Files with custom directives always are inside project root path, so, we can use relative paths instead of absolute paths(same with views path)

After that, what if instead of saving in private.properties it save it in project.properties, so it could be on the repository tree,
everyone with the plugin could use custom directives autocompletion automatically

It is just an idea, it is working now, thanks

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

2 participants