-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Goland templ plugin crash #1015
Comments
This is the most annoying issue. I've been struggling with it since the very beginning when the templ plugin appeared, regardless of the Goland or templ version. At some point, Goland's control crashes, and all unsaved files are lost into oblivion. This isn't exclusive to Goland — VSCode and Zed behave similarly, though instead of freezing, they stop launching the language server and lose autocomplete. I have a feeling the problem isn't in the environment but lies somewhere within templ itself. |
Do you have a solid reproduction of the issue, or any logs that might point to the cause? There's a log option that writes log entries to disk, and a verbose option to increase log verbosity. Usual causes of unresponsive programs are deadlocks, memory leaks, infinite loops, bad regexp, running out of handles etc. Adding a profile endpoint could help in those cases. |
In general, there is nothing particularly special in the usage cases. The only thing I do not run is the --watch mode because I build a binary, and my build system handles this; it simply runs a command before building the binary. At some random point during project work, an error occurs in Goland (in this context), and it stops responding to input, with the interface freezing. Neither local file history nor copying is available, and I lose what I have written. In other editors, the ability to highlight *.templ files simply disappears. The error points to a problem with the plugin, but I feel that the issue might be with gopls, or with configuring templ to work with it, because there are many releases of gopls. |
In the upcoming release, I've switched out the logging library and JSON marshalling library to use stdlib (slog instead of zap and stdlib json instead). I've also vendored the LSP code so we can make changes freely. However these are unlikely to be major changes in stability. We could have issues between data structure shapes not being properly marshalled / unmarshalled, but without logs it's hard to say what the issue could be. |
Here's the docs on how to enable logging: https://templ.guide/developer-tools/ide-support#enable-lsp-logging Note that you can enable gopls and templ logs. It's quite a lot of data, so it can be hard to see what's going on. I like to try and work out if there's a specific command related to it hanging. I was thinking about updating the templ LSP web server to include a nicer way to look at / filter recent logs. |
Sorry I didn't collect all the info requested in the bug report. The ticket can be deleted if it doesn't help resolve the bug.
Before you begin
Please make sure you're using the latest version of the templ CLI (
go install github.com/a-h/templ/cmd/templ@latest
), and have upgraded your project to use the latest version of the templ runtime (go get -u github.com/a-h/templ@latest
)Describe the bug
A clear and concise description of what the bug is.
Plugin Templ is 0.0.15
Crash happened when I was writing a func in templ file.
To Reproduce
A small, self-container, complete reproduction, uploaded to a Github repo, containing the minimum amount of files required to reproduce the behaviour, along with a list of commands that need to be run. Keep it simple.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots or screen captures to help explain your problem.
Logs
If the issue is related to IDE support, run through the LSP troubleshooting section at https://templ.guide/commands-and-tools/ide-support/#troubleshooting-1 and include logs from templ
templ info
outputRun
templ info
and include the output.Desktop (please complete the following information):
templ version
)go version
)gopls
version (gopls version
)Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: