-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/tools/gopls: recognize templ user agent in telemetry #70205
Comments
Does that mean that snippets of Go syntax within Templ files are handled by delegating the RPC from one language server to another? Do Templ template appear within Go string literals (or are they usually standalone files)? If so, should gopls similarly delegate queries for Templ strings within Go files to the Templ language server? Or should we support some limited subset of queries directly, as we currently do (sort of) for text/template? |
I agree that it would be good to recognize templ, but why can't templ simply specify a unique user agent for communication with gopls. I don't see a need to capture the user agent that is interacting with templ. |
Do you mean the gopls team is not interested in what editor invokes templ (more likely there will be another gopls in the report) and gopls shouldn't change its behavior based on editor. So templ can just set the client info to 'templ' and drop the editor name? As long as there is no more behavior change based on client ( https://github.com/golang/tools/blob/f1f7c26696be8f94198beafd05b36843515ac2ba/gopls/internal/cache/snapshot.go#L950) I think that will work. |
Thinking more, I am more convinced that gopls shouldn't use the |
@hyangah agreed: having VS Code inject a setting would have been a better solution. |
Opened #70285 to track switching to an explicit setting. Backlogged as not a high priority, but we can state that we won't specialize behavior in this way any more. |
ClientInfo.Name
per discussion in github.com/golang/go/issues/70205
Templ language server uses gopls to process go syntax.
Currently, gopls spawned by Templ language server is not distinguishable from gopls editors manage directly.
As Templ is getting popular, I think it is beneficial for both gopls and templ teams to track templ's gopls usage more closely. Hopefully, this information can help when we need to track the protocol compatibility and minimize accidental breakages like in golang/vscode-go#3435 (comment).
In a-h/templ#966 I am proposing to adjust the client info so we can record the chain of lsp participants. I use
;
but I am open to other characters. Or even other fields if there are.Whatever format is chosen, we also need to adjust gopls side to process this format. For example,
https://github.com/golang/tools/blob/f1f7c26696be8f94198beafd05b36843515ac2ba/gopls/internal/cache/snapshot.go#L950
and telemetry.
The text was updated successfully, but these errors were encountered: