You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a Go compiler directive //line, which can be used to reference other files. Historically gopls would support this directive, but subsequently dropped support golang/go#55043
There is an issue in gopls to propose reintroducing this golang/go#65001
It could be valuable for templ to implement this directive for the future, so that if this directive is implemented in gopls it'll work with generated templ files.
Solution
In *_templ.go files, all symbols that could be referenced by .go files should be defined with the //line directive, for example:
This should apply to code generated by all keywords templ, css and script.
The text was updated successfully, but these errors were encountered:
joerdav
changed the title
Implement the go line compiler directive in generated files
generator: Implement the go line compiler directive in generated files
Jan 19, 2024
For now I think we should close this, the implementation did work but the go line directive also affected other parts of the application in unexpected ways.
There is a Go compiler directive
//line
, which can be used to reference other files. Historicallygopls
would support this directive, but subsequently dropped support golang/go#55043There is an issue in
gopls
to propose reintroducing this golang/go#65001It could be valuable for templ to implement this directive for the future, so that if this directive is implemented in
gopls
it'll work with generated templ files.Solution
In
*_templ.go
files, all symbols that could be referenced by.go
files should be defined with the//line
directive, for example:Generated file
This should apply to code generated by all keywords
templ
,css
andscript
.The text was updated successfully, but these errors were encountered: