# editor: Support disabling semantic token highlighting via empty rules \(\#52963\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/de28867ff45388360eb56f6f6eec3444bf2f52a0)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: de28867ff45388360eb56f6f6eec3444bf2f52a0

Requested commit: de28867ff45388360eb56f6f6eec3444bf2f52a0

Commit: de28867ff45388360eb56f6f6eec3444bf2f52a0

Tree: ed87893e68cc9059f3dbd372d212191bc73016a6

Author: Xin Zhao

Committer: GitHub

## Message

```
editor: Support disabling semantic token highlighting via empty rules (#52963)

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)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #52882, should help #52723

According to the [Zed
documentation](https://zed.dev/docs/semantic-tokens#example-disabling-a-token-type),
users should be able to disable semantic highlighting for a specific
token type by adding an empty rule in `settings.json`.

However, the current implementation fails to respect this because its
merging logic allows lower-priority default styles to "leak through"
even when a matching high-priority rule is empty. This makes it
impossible to selectively disable semantic tokens to reveal the
underlying Tree-sitter highlighting when using "semantic_tokens":
"combined". This is particularly problematic for extensions that provide
specialized Tree-sitter queries which are currently being obscured by
less desirable semantic tokens(#52723).

This PR fixes the logic to ensure that a completely empty high-priority
rule acts as an opaque override, correctly disabling semantic styling
for that token type and allowing Tree-sitter highlighting to show
through as intended.

Release Notes:

- Fixed a bug where semantic token highlighting could not be disabled
via empty rules in `settings.json`.
```

## Parents

- [65e75508d31432e1be632ba64362c4877a05caa7](https://git.cafe/gitcafe/zed/commit/65e75508d31432e1be632ba64362c4877a05caa7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/de28867ff45388360eb56f6f6eec3444bf2f52a0?format=markdown)
