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

lsp: report errors for component call without parentheses #676

Closed
qdm12 opened this issue Apr 8, 2024 · 1 comment · Fixed by #690
Closed

lsp: report errors for component call without parentheses #676

qdm12 opened this issue Apr 8, 2024 · 1 comment · Fixed by #690
Labels
enhancement New feature or request lsp NeedsInvestigation Issue needs some investigation before being fixed

Comments

@qdm12
Copy link

qdm12 commented Apr 8, 2024

Hi there, just learning this wonderful library! 👍

I encountered a little problem (using VSCode, templ v0.2.648 and vscode extension v0.0.22), where I (silly me) used @subcomponent instead of @subcomponent() and the extension wouldn't complain about it, but the generated code would be invalid (since it generates subcomponent.Render instead of subcomponent().Render. Example:

templ Bad() {
	<html>
		@subcomponent
	</html>
}

templ subcomponent() {
	<div>Hello</div>
}

Although the extension should watch out for components given as arguments which can be called without parentheses. By the way, why is this? 🤔 Shouldn't we make it consistent and force the developer to use @subcomponent() in all cases? 🤔

@joerdav joerdav changed the title VSCode extension should highlight error for component call without parentheses lsp: report errors for component call without parentheses Apr 9, 2024
@joerdav joerdav added enhancement New feature or request lsp NeedsInvestigation Issue needs some investigation before being fixed labels Apr 9, 2024
@joerdav
Copy link
Collaborator

joerdav commented Apr 18, 2024

Oddly, I do get an error, but its at the end of the file. Is it the same for you @qdm12 ?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lsp NeedsInvestigation Issue needs some investigation before being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants