You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When i put the cursor starts highlighting random places. Like on the images below
I did this on an html file and almost never highlight. The one that i found was when i put the cursor on a div and it highlights the div and the closing div. Like below
The text was updated successfully, but these errors were encountered:
Hi @ross96D - thanks for raising this. The issue was that templ proxies LSP requests through to gopls in order to get results from the generated Go code. I did a talk about how it works at Gophercon UK this year.
In this case, there's no sensible mapping between things you're highlighting in VS Code, and the underlying Go code.
There's a web server option in the templ LSP that shows you the underlying mapping. In this case, by adding to the logs, and looking at the view, I could see that when I was highlighting something in VS Code, it was sending it through to the templ LSP, and that was highlighting the positions of various bits of underlying Go code, so it looks totally random!
I think the most sensible thing to do here is to not return any highlights from templ. Later on, if we want, we could implement some templ specific highlighting, but since tokens aren't often repeated, it's probably not very useful in templ.
No change is needed in the VS Code plugin, it's just a change to the templ CLI which runs the LSP.
Thanks again!
ross96D
pushed a commit
to ross96D/templ
that referenced
this issue
Nov 14, 2023
When i put the cursor starts highlighting random places. Like on the images below
I did this on an html file and almost never highlight. The one that i found was when i put the cursor on a div and it highlights the div and the closing div. Like below
The text was updated successfully, but these errors were encountered: