Skip to content

Support for parser for blade component attributes #344

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

N1ebieski
Copy link
Contributor

@N1ebieski N1ebieski commented Mar 20, 2025

From laravel/vs-code-php-parser-cli#13:

This PR adds support for parser for blade component attributes. Every attribute with a function supported by the extension has a link to the target file.

Before:

before

After:

after

Works with and without blade prefix/suffix statements.

Most of the logic is in the laravel/vs-code-php-parser-cli#13 but for proper display of values in hover, we need to change the calculation of linkRange to exclude double quote from the attribute:

<x-my-component
    attribute-for-label-with-prefix="{{ trans('example.label') }}"

linkRange should return range of:

'example.label'

not:

"{{ trans('example.label') }}"

This PR adds an additional negative lookbehind for the regex to fix this issue.

Fixes #370

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

Successfully merging this pull request may close these issues.

[Bug]: Translation Linting is not greedy enough
1 participant