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

feat: add raw go highlighting #84

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions syntaxes/templ.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,38 @@
},
{
"include": "#switch-expression"
},
{
"include": "#raw-go"
}
]
},
"raw-go": {
"begin": "{{",
"beginCaptures": {
"0": {
"name": "start.raw-go.templ"
},
"1": {
"name": "punctuation.brace.open"
}
},
"end": "}}",
"endCaptures": {
"0": {
"name": "end.raw-go.templ"
},
"1": {
"name": "punctuation.brace.open"
}
},
"patterns": [
{
"include": "source.go"
}
],
"name": "raw-go.templ"
},
"string-expression": {
"begin": "{\\s+",
"beginCaptures": {
Expand Down
1 change: 1 addition & 0 deletions tests/snap/basic_features.templ
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ templ Hello(name string) {
templ Greeting(
person Person,
) {
{{ person.Name = "Bob" }}
<div class="greeting">
@Hello(person.Name)
</div>
Expand Down
15 changes: 15 additions & 0 deletions tests/snap/basic_features.templ.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@
#^ source.templ html-template.templ params.html-template.templ punctuation.definition.end.bracket.round.go
# ^ source.templ html-template.templ block.html-template.templ
# ^ source.templ html-template.templ block.html-template.templ punctuation.definition.begin.bracket.curly.go
> {{ person.Name = "Bob" }}
#^ source.templ html-template.templ block.html-template.templ
# ^^ source.templ html-template.templ block.html-template.templ raw-go.templ start.raw-go.templ
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ
# ^^^^^^ source.templ html-template.templ block.html-template.templ raw-go.templ variable.other.object.access.go
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ punctuation.separator.dot-access.go
# ^^^^ source.templ html-template.templ block.html-template.templ raw-go.templ variable.other.property.go
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ keyword.operator.assignment.go
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ string.quoted.double.go punctuation.definition.string.begin.go
# ^^^ source.templ html-template.templ block.html-template.templ raw-go.templ string.quoted.double.go
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ string.quoted.double.go punctuation.definition.string.end.go
# ^ source.templ html-template.templ block.html-template.templ raw-go.templ
# ^^ source.templ html-template.templ block.html-template.templ raw-go.templ end.raw-go.templ
> <div class="greeting">
#^ source.templ html-template.templ block.html-template.templ
# ^ source.templ html-template.templ block.html-template.templ meta.tag.block.any.html punctuation.definition.tag.begin.html
Expand Down
Loading