-
-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Before you begin
I've installed the latest version of the templ CLI (go install github.com/a-h/templ/cmd/templ@latest), and have upgraded my project to use the latest version of the templ runtime (go get -u github.com/a-h/templ@latest).
Describe the bug
LSP auto-completion doesn't trigger properly when initially writing control structures (if statements, for loops) in Templ components. Completions only appear after you've already written the control structure, then modify an existing variable.
To Reproduce
- Create a simple templ component with a variable
- Try to write an if statement or for loop using that variable
- Notice that LSP completions don't appear during initial typing
- After completing the control structure, delete part of a variable name and start typing again
- Now LSP completions will appear correctly
This happens in both VS Code and Neovim with nvim-cmp.
Expected behavior
LSP completions should appear during the initial writing of control structures, just like they do when modifying existing code.
Screenshots
I have a screen recording demonstrating this issue that I can provide if needed.
Desktop (please complete the following information):
- OS: macOS 15.0
- templ CLI version: v0.3.833
- Go version: go1.24.0 darwin/arm64
goplsversion: v0.18.1
Additional context
This issue affects both the latest release and the most recent commit of templ. The problem is consistent across different editors (VS Code and Neovim).