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

adds more standart html tags in snippets #244

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

BKR-dev
Copy link
Contributor

@BKR-dev BKR-dev commented Oct 20, 2023

hey, found that there are some html tags that would be nice to have around, i know that there is a "default empty" tag that can be used but i thought having more makes it nicer to get going.

hopefully you find this helpful or can give some feedback.

im only starting to work with templ and im amazed by the tooling around it and its LSP, im super excited!

cheers!

@BKR-dev BKR-dev mentioned this pull request Oct 20, 2023
@a-h a-h merged commit faa36c1 into a-h:main Oct 23, 2023
@a-h
Copy link
Owner

a-h commented Oct 23, 2023

Looks good, but why so few? Do you think we should add more?

The built-in HTML support includes a larger set of tag snippets. I'm not sure if it's contextual, in that it's aware of the parent tag etc.

image

It seems I just added a placeholder for future thinking in this area. I'll merge for now, and we can revisit later.

@BKR-dev
Copy link
Contributor Author

BKR-dev commented Oct 23, 2023

Thanks for merging!

Looks good, but why so few? Do you think we should add more?

this where just he ones i thought of immediately when starting to work with it. im working on a PoC of my Org so im keeping the perspective of "a fresh new user without knowledge", which also means that in my setup i dont have additional lsp or plugin for html support, so i look at it "what can / should templ lsp provide" vs should not be.

i work with a fairly small neovim setup and since i already have templ installed i naturally concluded i would use its lsp capability (which i love btw, so cool!) to write the html part. so from that point i would think that there are tags "missing" but than the question is should the templ lsp part also provide complete html support, im not actually sure, maybe you have a thought about it?

(i can see the argument for having all html tags in a separate lsp for html and therefore maybe providing htmx tags?)

@a-h
Copy link
Owner

a-h commented Oct 23, 2023

Yes, I think that's right. There's a way to have multiple LSPs attached to a single buffer, e.g. https://templ.guide/commands-and-tools/ide-support#tailwind-css-intellisense-1

So, I think the right way forward is to work on integrating existing HTML tooling etc. into the templ tooling so that it works together well.

I haven't tried the CSS intellisense myself, and worked out how it works yet. VS Code has an example of embedded language support here https://code.visualstudio.com/api/language-extensions/embedded-languages

However, I haven't tried it (yet). It may be that the templ lsp could be significantly simplified by passing the source code mapping and other tasks to this embedded language support...

@BKR-dev
Copy link
Contributor Author

BKR-dev commented Oct 24, 2023

Thanks for the feedback!

Do I understand you correctly in the way that you want to incorporate additional html lsp and css lsp into the templ tooling? would that then mean to add htmx tags into the templ lsp?

I have joined the templ slack so we can discuss this on there when it's more about finding the way forward and not strictly tied to a merged PR.

Thank for your time and input!

@a-h
Copy link
Owner

a-h commented Oct 24, 2023

Yes, I think it's possible to add more tooling into the VS Code extension or LSP by using the sample that Microsoft provide.

So I don't think there's a need to anything htmx specific to the LSP.

@BKR-dev
Copy link
Contributor Author

BKR-dev commented Oct 25, 2023

Im not sure i understand clearly what you mean. Do you mean to find a way to incorporate existing html and css lsp to Templ to provide that functionality? Im not sure there is an existing htmx lsp out there in the wild but adding that too would be nice as well. I saw your talk at gopherconUK yesterday and that helped to understand how the lsp works, very insightful!

I would look into that as im working with it and find the need to have something like that working within my nvim setup.

@a-h
Copy link
Owner

a-h commented Oct 25, 2023

Yes, I think that there's a way to incorporate existing LSPs as per https://code.visualstudio.com/api/language-extensions/embedded-languages

Given that templ is basically a way to combine HTML + Go + CSS + JS, then I was wondering if the same approach I've used to proxy to the Go LSP would work, or whether the samples on that page ^ might be easier.

Glad the Gophercon talk had the desired effect. 😁

@BKR-dev
Copy link
Contributor Author

BKR-dev commented Oct 25, 2023

Okay, i understand! Thanks for clarifying and taking the time to spell it out for me 😄

@joerdav
Copy link
Collaborator

joerdav commented Oct 25, 2023

Also worth noting there is a htmx LSP under development already at github.com/ThePrimeagen/htmx-lsp

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.

3 participants