Jeff Brennan
621ac16e35
go: Fix language injections (#43775)
Closes #43730
## Summary
This modifies the existing injections.scm file for go by adding more
specific prefix queries and *_content nodes to the existing
`raw_string_literal` and `interpreted_string_literal` sections
<details><summary>This PR</summary>
<img width="567" height="784" alt="image"
src="https://github.com/user-attachments/assets/bfe8c64e-1dc2-470c-9f85-2c664a6c5a15"
/>
<img width="383" height="909" alt="image"
src="https://github.com/user-attachments/assets/9349af8c-22d3-4c9b-a435-a73719f17ba3"
/>
<img width="572" height="800" alt="image"
src="https://github.com/user-attachments/assets/939ada3b-1440-443b-8492-0eb61a7ee90f"
/>
</details>
<details><summary>Current Release (0.214.7)</summary>
<img width="569" height="777" alt="image"
src="https://github.com/user-attachments/assets/e6fffe77-e4c6-48e3-9c6d-a140298225c5"
/>
<img width="381" height="896" alt="image"
src="https://github.com/user-attachments/assets/bf107950-c33a-4603-90d3-2304bef0a4af"
/>
<img width="574" height="798" alt="image"
src="https://github.com/user-attachments/assets/2c5e43e5-f101-4722-8f58-6b176ba950ca"
/>
</details>
<details><summary>Code</summary>
```go
func test_sql() {
// const assignment
const _ = /* sql */ "SELECT * FROM users"
const _ = /* sql */ `SELECT id, name FROM products`
// var assignment
var _ = /* sql */ `SELECT id, name FROM products`
var _ = /* sql */ "SELECT id, name FROM products"
// := assignment
test := /* sql */ "SELECT * FROM users"
test2 := /* sql */ `SELECT * FROM users`
println(test)
println(test2)
// = assignment
_ = /* sql */ "SELECT * FROM users WHERE id = 1"
_ = /* sql */ `SELECT * FROM users WHERE id = 1`
// literal elements
_ = testStruct{Field: /* sql */ "SELECT * FROM users"}
_ = testStruct{Field: /* sql */ `SELECT * FROM users`}
testFunc(/* sql */ "SELECT * FROM users")
testFunc(/* sql */ `SELECT * FROM users`)
const backtickString = /* sql */ `SELECT * FROM users;`
const quotedString = /* sql */ "SELECT * FROM users;"
const backtickStringNoHighlight = `SELECT * FROM users;`
const quotedStringNoHighlight = "SELECT * FROM users;"
}
func test_yaml() {
// const assignment
const _ = /* yaml */ `
settings:
enabled: true
port: 8080
`
// := assignment
test := /* yaml */ `
settings:
enabled: true
port: 8080
`
println(test)
// = assignment
_ = /* yaml */ `
settings:
enabled: true
port: 8080
`
// literal elements in a struct
_ = testStruct{Field: /* yaml */ `
settings:
test: 1234
port: 8080
`}
// function argument
testFunc(/* yaml */ `
settings:
enabled: true
port: 8080
`)
}
func test_css() {
// const assignment
const _ = /* css */ "body { margin: 0; }"
const _ = /* css */ `body { margin: 0; }`
const cssCodes = /* css */ `
h1 {
color: #333;
}
`
// := assignment
test := /* css */ "body { margin: 0; }"
println(test)
// = assignment
_ = /* css */ "body { margin: 0; }"
_ = /* css */ `body { margin: 0; }`
// literal elements
_ = testStruct{Field: /* css */ "body { margin: 0; }"}
_ = testStruct{Field: /* css */ `body { margin: 0; }`}
testFunc(/* css */ "body { margin: 0; }")
testFunc(/* css */ `body { margin: 0; }`)
const backtickString = /* css */ `body { margin: 0; }`
const quotedString = /* css */ "body { margin: 0; }"
const backtickStringNoHighlight = `body { margin: 0; }`
const quotedStringNoHighlight = "body { margin: 0; }"
}
```
</details>
Release Notes:
- Greatly improved the quality of comment-directed language injections
in Go
2025-12-03 10:32:51 -06:00
..
2025-12-03 11:24:08 +00:00
2025-11-26 18:03:42 +01:00
2025-11-25 17:13:16 +01:00
2025-11-24 13:34:04 +01:00
2025-12-03 11:24:08 +00:00
2025-12-03 11:24:08 +00:00
2025-11-10 11:11:24 -03:00
2025-12-03 11:24:08 +00:00
2025-11-24 20:01:43 +00:00
2025-11-28 08:18:19 +01:00
2025-12-01 12:57:51 +00:00
2025-12-01 18:55:33 +01:00
2025-11-07 22:27:14 +00:00
2025-11-27 14:08:43 +00:00
2025-11-11 12:55:19 +00:00
2025-11-27 13:46:43 +00:00
2025-11-24 20:01:43 +00:00
2025-11-20 12:18:50 +01:00
2025-12-01 22:36:30 -05:00
2025-12-02 16:27:36 +00:00
2025-11-24 13:34:04 +01:00
2025-11-24 15:46:13 -06:00
2025-11-27 13:10:55 -03:00
2025-11-06 09:16:45 +00:00
2025-11-10 23:00:55 -07:00
2025-12-02 13:22:16 -03:00
2025-11-24 22:17:48 -08:00
2025-11-21 16:39:08 +00:00
2025-11-26 16:53:05 +00:00
2025-12-02 16:27:36 +00:00
2025-11-28 14:16:44 +00:00
2025-11-18 16:39:08 +00:00
2025-11-25 12:15:55 -05:00
2025-12-02 16:15:18 -05:00
2025-11-19 12:34:41 +01:00
2025-12-01 10:50:28 -05:00
2025-12-01 18:55:33 +01:00
2025-12-02 21:33:41 +00:00
2025-11-30 22:45:01 -05:00
2025-10-23 14:13:35 -04:00
2025-11-21 16:39:08 +00:00
2025-12-01 14:36:49 -05:00
2025-12-01 18:55:33 +01:00
2025-12-03 08:27:55 +00:00
2025-12-03 11:24:08 +00:00
2025-11-24 13:34:04 +01:00
2025-12-02 22:26:40 +00:00
2025-10-31 21:18:22 +00:00
2025-12-02 22:26:40 +00:00
2025-12-02 18:44:08 -05:00
2025-11-26 16:56:34 +00:00
2025-12-01 13:25:33 +00:00
2025-11-20 22:17:50 -07:00
2025-11-26 16:56:34 +00:00
2025-12-03 11:56:16 +00:00
2025-11-09 21:37:22 -05:00
2025-12-03 13:55:58 +00:00
2025-11-19 22:00:58 +00:00
2025-11-28 15:48:33 -05:00
2025-12-03 16:49:40 +01:00
2025-11-17 12:31:00 +00:00
2025-10-26 13:24:26 +00:00
2025-12-01 09:00:27 +01:00
2025-12-02 20:38:18 +00:00
2025-11-07 22:27:14 +00:00
2025-12-02 21:33:41 +00:00
2025-11-19 22:00:58 +00:00
2025-11-11 15:43:25 +02:00
2025-12-02 21:33:41 +00:00
2025-12-03 08:27:55 +00:00
2025-11-28 19:40:23 +05:30
2025-11-24 13:24:26 -05:00
2025-11-25 14:17:27 -08:00
2025-12-01 18:55:33 +01:00
2025-12-03 10:32:51 -06:00
2025-12-02 16:27:36 +00:00
2025-12-02 14:04:28 +02:00
2025-12-03 16:58:51 +01:00
2025-12-03 16:49:40 +01:00
2025-11-25 16:03:21 +00:00
2025-11-26 18:03:42 +01:00
2025-12-01 22:36:30 -05:00
2025-11-24 11:08:45 -08:00
2025-11-11 16:10:47 +01:00
2025-12-01 20:52:57 -07:00
2025-11-25 14:17:27 -08:00
2025-11-24 13:24:26 -05:00
2025-11-19 22:00:58 +00:00
2025-11-26 18:03:42 +01:00
2025-11-12 15:31:20 +01:00
2025-11-26 18:03:42 +01:00
2025-12-01 12:57:51 +00:00
2025-12-02 18:47:25 +00:00
2025-11-13 14:56:40 +01:00
2025-12-01 13:25:33 +00:00
2025-12-01 12:19:00 -03:00
2025-10-29 16:27:30 +00:00
2025-12-02 12:18:13 +01:00
2025-11-26 18:03:42 +01:00
2025-11-27 13:46:43 +00:00
2025-12-02 12:50:25 +01:00
2025-11-25 08:25:49 +00:00
2025-12-01 18:55:33 +01:00
2025-11-18 01:00:26 +00:00
2025-11-03 19:25:15 +00:00
2025-12-01 18:04:01 +00:00
2025-10-24 07:52:51 -04:00
2025-12-01 18:55:33 +01:00
2025-12-01 18:55:33 +01:00
2025-12-01 09:12:31 +01:00
2025-12-02 18:47:25 +00:00
2025-10-27 10:13:26 -04:00
2025-11-21 08:28:17 -07:00
2025-11-07 22:27:14 +00:00
2025-12-02 22:30:18 +00:00
2025-11-11 16:34:25 -05:00
2025-11-20 01:52:13 -03:00
2025-11-03 19:25:15 +00:00
2025-12-01 14:57:15 +01:00
2025-11-21 16:39:08 +00:00
2025-11-20 12:18:50 +01:00
2025-11-24 13:34:04 +01:00
2025-11-07 22:27:14 +00:00
2025-11-20 10:12:59 -05:00
2025-12-01 18:55:33 +01:00
2025-11-07 11:36:05 +00:00
2025-11-24 13:34:04 +01:00
2025-12-02 08:21:18 +00:00
2025-12-01 08:59:33 +00:00
2025-12-01 18:04:01 +00:00
2025-12-01 20:52:57 -07:00
2025-12-01 20:52:57 -07:00
2025-11-14 22:46:35 +00:00
2025-11-26 16:56:34 +00:00
2025-12-01 20:56:34 +00:00
2025-11-22 23:28:34 -03:00
2025-12-01 12:57:51 +00:00
2025-12-02 12:58:20 -08:00
2025-11-07 22:27:14 +00:00
2025-12-03 12:08:49 -03:00
2025-12-01 12:57:51 +00:00
2025-11-07 22:27:14 +00:00
2025-12-03 15:45:45 +00:00
2025-11-18 19:20:34 +01:00
2025-12-03 14:26:40 +00:00
2025-12-01 18:55:33 +01:00
2025-12-01 14:01:50 +00:00
2025-12-01 14:57:15 +01:00
2025-11-07 22:27:14 +00:00