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

templ-vscode: code highlighting breaks when using structs or chaining functions #1059

Open
tim-rus opened this issue Jan 29, 2025 · 3 comments

Comments

@tim-rus
Copy link

tim-rus commented Jan 29, 2025

Code highlighting breaks when using structs or chaining functions.

Here is an example:

Image

templ-vscode v0.0.30
templ v0.3.819

@joerdav
Copy link
Collaborator

joerdav commented Jan 30, 2025

I took a quick look into this. Seems it will be slightly more complex than I expected as the syntax grammer doesn't support new lines in the "begin" capture. So will need something a bit more involved.

@tim-rus
Copy link
Author

tim-rus commented Jan 30, 2025

@joerdav Well that's a bummer :(

But it's about chaining on new lines. What about structs? Any chance for a quick fix?
As I see it, highlighting reacts on parenthesis - if there's none it doesn't work.

SomeFunc() {} <- that works
SomeStruct{} {} <- that doesn't.

@joerdav
Copy link
Collaborator

joerdav commented Feb 3, 2025

It's probably a quick fix, I would just have to get my head back into textMate syntax again! As you can see the rules currently are quite dumb: https://github.com/templ-go/templ-vscode/blob/main/syntaxes/templ.tmLanguage.json#L539

They don't account for many more complex cases, just simple @hello.world() { type cases.

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