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

Can't navigate to component file without trailing characters on opening tag line #35

Open
tylerdak opened this issue Dec 11, 2024 · 0 comments

Comments

@tylerdak
Copy link
Contributor

tylerdak commented Dec 11, 2024

Hi!

Given the following component,
<x-button class="btn" />

I want to format that onto multiple lines like so, to make the markup more vertical:

<x-button
    class="btn"
/>

I've found that the navigation does not work because blade-nav is not able to find the component name. If I add a single whitespace character at the end of that line, the navigation works as expected. I think the key is to edit the strategy for finding a start and end position in gf.lua:274.

I have a pull request here. I added a fallback regex that just looks for the end of the line instead of the name-ending characters in the original:
local start_pos, end_pos = text:find("[,%s>%)]", col) or text:find("$", col), text:find("$", col)

This provides the last character index of the line as the start_pos and end_pos (which is fine because start_pos is replaced in the backwards search anyway). However, I'm very open to suggestions for this solution.

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

1 participant