From 90fa50a617eb545a91da853b8724ffaefaaeff93 Mon Sep 17 00:00:00 2001
From: Marat Fattakhov <161203mar@gmail.com>
Date: Wed, 25 Mar 2026 12:16:03 +0300
Subject: [PATCH] go: Add semantic token rule for format string interpolations
(#52394)
## Context
Closes #52391
gopls sends semantic tokens for format args with [format] modifier.
Without a simple support for there is no special highlighting for format
args like `%s`. Its a simple change inside
`go/semantic_token_rules.json` that makes this a default behavior.
Currently (on 0.229 preview):
After fix:
## Self-Review Checklist
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- gopls: Add semantic token rule for format string interpolations
---
crates/languages/src/go/semantic_token_rules.json | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/crates/languages/src/go/semantic_token_rules.json b/crates/languages/src/go/semantic_token_rules.json
index 627a5c5f187b47918e6a56069c5ed1bda8583aa6..612076463c25cf9219589aa83160e537cd743061 100644
--- a/crates/languages/src/go/semantic_token_rules.json
+++ b/crates/languages/src/go/semantic_token_rules.json
@@ -3,5 +3,10 @@
"token_type": "variable",
"token_modifiers": ["readonly"],
"style": ["constant"]
+ },
+ {
+ "token_type": "string",
+ "token_modifiers": ["format"],
+ "style": ["string.special"]
}
]