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

hx-on unbound namespace in Jetbrains IDEs #3038

Open
bavjackson opened this issue Nov 25, 2024 · 3 comments
Open

hx-on unbound namespace in Jetbrains IDEs #3038

bavjackson opened this issue Nov 25, 2024 · 3 comments

Comments

@bavjackson
Copy link

bavjackson commented Nov 25, 2024

I'm having issues with the hx-on attribute when working on html in Pycharm.

This only seems to be an issue with hx-on, every other attribute is fine.

image

Is there any easy fix to silence the IDE?

@bavjackson
Copy link
Author

Looks like this needs to be added to the web-types file?

@Telroshan
Copy link
Collaborator

Looks like this needs to be added to the web-types file?

Probably, if you feel like investigating, a fix PR would be welcome! 😄

Other than that, looking at the highlighted error, there could be an issue with the attribute's syntax (as only hx-on seems to be underlined here and not the full attribute hx-on::after-settle), in which case you might want to try the trick mentioned in the docs:

Finally, in order to make this feature compatible with some templating languages (e.g. JSX) that do not like having a colon (:) in HTML attributes, you may use dashes in the place of colons for both the long form and the shorthand form:

<!-- These two are equivalent -->
<button hx-get="/info" hx-on-htmx-before-request="alert('Making a request!')">
    Get Info!
</button>

<button hx-get="/info" hx-on--before-request="alert('Making a request!')">
    Get Info!
</button>

@bavjackson
Copy link
Author

Probably, if you feel like investigating, a fix PR would be welcome! 😄

I might give this a try at the weekend.

Finally, in order to make this feature compatible with some templating languages (e.g. JSX) that do not like having a colon (:) in HTML attributes, you may use dashes in the place of colons for both the long form and the shorthand form:

This is working for 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