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

x/tools/gopls: support language features for text/template, html/template #36911

Open
stamblerre opened this issue Jan 30, 2020 · 4 comments
Open

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jan 30, 2020

See discussion on microsoft/vscode-go#228.

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 14, 2021

Change https://golang.org/cl/301493 mentions this issue: text/template/parse: add mode to skip func-check on parsing

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 14, 2021

Change https://golang.org/cl/301493 mentions this issue: text/template/parse: add a mode to skip func-check on parsing

@a-h
Copy link
Contributor

@a-h a-h commented Apr 4, 2021

I was looking into this and noticed that Goland has IDE-level support for this. It requires the use of a comment to specify the embedded type.

{{- /*gotype: package/import/path.type_name*/ -}}.

I can't see a way to support language features without some sort of "type hint" for template files, so maybe this is something to consider making standard.

https://blog.jetbrains.com/go/2018/12/14/go-templates-made-easy/

@inliquid
Copy link

@inliquid inliquid commented Apr 4, 2021

@a-h it actually works quite nice even without these magic comments. I never used them. It has almost everything you expect when working with html templating languages out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants