Skip to content

Commit ec733e3

Browse files
committed
feat: Implement the go line compiler directive
1 parent 092884b commit ec733e3

File tree

56 files changed

+139
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+139
-0
lines changed

benchmarks/templ/template_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/templ/generatecmd/testwatch/testdata/templates_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/templ/lspcmd/httpdebug/list_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/templ/visualize/sourcemapvisualisation_templ.go

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/blog/posts_templ.go

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/counter-basic/components_templ.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/counter/components/components_templ.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/external-libraries/components_templ.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/hello-world-ssr/hello_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/hello-world-static/hello_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration-chi/home_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration-echo/home_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration-gin/home_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration-go-echarts/components_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration-gofiber/home_templ.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/integration-react/components_templ.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/static-generator/blog_templ.go

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/syntax-and-usage/components/templsyntax_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/generator.go

+13
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ func (g *generator) writeCSS(n parser.CSSTemplate) error {
225225
var err error
226226
var indentLevel int
227227

228+
//line SomeFilename.templ:20
229+
if _, err = g.w.Write(fmt.Sprintf("//line %s:%d\n", g.tf.FileName, n.Name.Range.From.Line+1)); err != nil {
230+
return err
231+
}
228232
// func
229233
if _, err = g.w.Write("func "); err != nil {
230234
return err
@@ -349,6 +353,11 @@ func (g *generator) writeTemplate(nodeIdx int, t parser.HTMLTemplate) error {
349353
var err error
350354
var indentLevel int
351355

356+
//line SomeFilename.templ:20
357+
if _, err = g.w.Write(fmt.Sprintf("//line %s:%d\n", g.tf.FileName, t.Expression.Range.From.Line+1)); err != nil {
358+
return err
359+
}
360+
352361
// func
353362
if _, err = g.w.Write("func "); err != nil {
354363
return err
@@ -1388,6 +1397,10 @@ func (g *generator) writeScript(t parser.ScriptTemplate) error {
13881397
var err error
13891398
var indentLevel int
13901399

1400+
//line SomeFilename.templ:20
1401+
if _, err = g.w.Write(fmt.Sprintf("//line %s:%d\n", g.tf.FileName, t.Parameters.Range.From.Line+1)); err != nil {
1402+
return err
1403+
}
13911404
// func
13921405
if _, err = g.w.Write("func "); err != nil {
13931406
return err

generator/test-a-href/template_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/test-attribute-escaping/template_templ.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)