Skip to content

fix: non-function import expression syntax highlighting #39

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

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

alehechka
Copy link
Contributor

Overview

This is a follow-up to #38 from a recommendation in a-h/templ#566. This adds support for syntax highlighting on non-function components such as the following:

templ higherOrderTemplate(a, b templ.Component) {
	<div class="left">
		@a
	</div>
	<div class="right">
		@b
	</div>
}

Before

Screenshot 2024-02-28 at 2 08 19 PM

After

Screenshot 2024-02-28 at 2 07 18 PM

Caveat

However, since this is reusing the current import-expression pattern it passes the function name into source.go which marks the syntax as a variable instead of a function since it doesn't have an open parenthesis. Just wanted to point this out to make sure this is okay or if we'd like to override this scenario to force the function syntax token?

Screenshot 2024-02-28 at 2 07 05 PM

@joerdav
Copy link
Contributor

joerdav commented Feb 29, 2024

Had a quick look, this looks good. A side note though, what is it you're using for the textmate debugs?

@alehechka
Copy link
Contributor Author

A side note though, what is it you're using for the textmate debugs?

@joerdav that's the VSCode built-in inspector, to start it open the command pallet and run Developer: Inspect Editor Tokens and Scopes.

@alehechka
Copy link
Contributor Author

@joerdav before you ship the next version of the extension can you check out #35?

It's adding an important fix to inline script tags. I left one comment to also fix inline style tags and would love to see both of those fixed for the next release.

@joerdav
Copy link
Contributor

joerdav commented Feb 29, 2024

That's a useful command, thanks!

Yes will take a look at that first.

@joerdav
Copy link
Contributor

joerdav commented Feb 29, 2024

On the caveat, I think that's acceptable, no need to override form my understanding.

@joerdav joerdav merged commit e33c522 into templ-go:main Feb 29, 2024
@alehechka alehechka deleted the issue_566b branch February 29, 2024 14:38
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.

2 participants