templ: Getting multiple error message when parsing a simple templ file

Hi, I have a very simple (copied from the examples) template:

package templates

templ Hello(name string) {
    <div>Hello, { name }</div>
}

Which causes multiple repeating popups when the file in question is in a visible VSCode tab, namely:

[Error - 12:13:45 PM] Request textDocument/hover failed.
  Message: no package metadata for file file:///home/user/Dev/templTest/templates/main.templ
  Code: 0 
[Error - 12:13:46 PM] Request textDocument/semanticTokens/range failed.
  Message: semantictokens are disabled
  Code: 0
[Error - 12:13:46 PM] Request textDocument/semanticTokens/full failed.
  Message: semantictokens are disabled
  Code: 0 
[Error - 12:16:41 PM] Request textDocument/semanticTokens/range failed.
  Message: semantictokens are disabled
  Code: 0 
[Error - 12:16:42 PM] Request textDocument/semanticTokens/full failed.
  Message: semantictokens are disabled
  Code: 0 

These popups happen every time I switch to the template in the editor, and on every change to the templ file in question.

I’ve installed the VSCode extension and the templ cli application.

Can you think of anything I’ve missed that would cause this?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 23 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I can confirm latest binary solves the issues. Thank you @a-h

oops it didnt notify me that you have joined i am sorry

9am UK time, I can drop a Google hangout link in here and anyone can join. Otherwise, some convenient time next week?

To be honest, changing the theme has ‘fixed’ it enough for me to carry on with checking this all out. Thanks for looking at the issue.

It seems it may have something to do with the theme I was using in VSCode. I switched theme (after doing a tad of googling) and the errors have disappeared.

The original theme I was using was the new Dark Modern theme supplied with VSCode. I’ve switched to using ‘Noctis (Obscuro)’ and the error messages no longer appear.

So it seems it’s not an issue with this extension.