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

Automatically install extension when it gets activated by the lsp #48

Open
itepastra opened this issue Mar 5, 2024 · 3 comments
Open

Comments

@itepastra
Copy link
Contributor

when the client lets the server autocomplete one of the hx-ext="{extension}" and the header is specified in the current tree, add the script source to it.
ex. Add
<script src="https://unpkg.com/htmx.org/dist/ext/event-header.js"></script>
to the header when the extension is completed using the lsp:

<button hx-ext="event-header">
   Click Me!
</button>
@MNThomson
Copy link
Collaborator

I like the idea of supporting quasi "auto imports" but don't think that adding a script tag to the head is the answer. Now my personal usage of htmx is purely script tags in <head>, but htmx also supports npm-like imports and I'm sure there are other people who want to lazy load extensions. This behaviour would probably annoy a certain subset of users.

We could support an "informational" code action on the extension usage if we don't see the extension imported in the head, but I also think that would raise a bunch of false positives (once again when other loading strategies are used). I like the idea, but am not sure how to eliminate annoyance.

@itepastra
Copy link
Contributor Author

In that case it doesn't seem like the best way. Maybe a code action (or multiple) when hovering around the hx-ext tag?

@itepastra
Copy link
Contributor Author

Can you have code actions that don't raise 'errors'.

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