chbk
9e5f89dc26
Improve CSS syntax highlighting (#25326)
Release Notes:
- Improved CSS syntax highlighting
| Zed 0.174.6 | With this PR |
| --- | --- |
| 
|

|
- `|`: `operator`
- `and`, `or`, `not`, `only`: `operator` -> `keyword.operator`, as
defined in other languages
- `id_name`, `class_name`: `property`/`attribute` -> `selector`, not a
property name. [CSS
reference](https://www.w3.org/TR/selectors-3/#class-html)
- `namespace_name`: `property` -> `namespace`, not a property name
- `property_name`: `constant` -> `property`, like `feature_name` already
defined
- `(keyword_query)`: `property`, similar to `feature_name`. [CSS
reference](https://www.w3.org/TR/mediaqueries-3/#media1)
- `keyword_query`: `constant.builtin`, [CSS
reference](https://www.w3.org/TR/mediaqueries-3/#media0)
- `plain_value`, `keyframes_name`: `constant.builtin`, [CSS
reference](https://www.w3.org/TR/css-values-3/#value-defs)
- `unit`: `type` -> `type.unit`,
[Atom](https://github.com/atom/language-css/blob/9e4afce058b4593edf03ed1dec6033b163c678f0/grammars/tree-sitter-css.cson#L73)
and [VS
Code](https://github.com/microsoft/vscode/blob/336801752dd09afa76f5429fba846e533bcdb7d9/extensions/css/syntaxes/css.tmLanguage.json#L1393)
also have a `unit` scope for this. [CSS
reference](https://www.w3.org/TR/css3-values/#dimensions)
```css
@media (keyword_query) and keyword_query {}
@supports (feature_name: plain_value) {}
@namespace namespace_name url("string");
namespace_name|tag_name {}
@keyframes keyframes_name {
to {
top: 200unit;
color: #c01045;
}
}
tag_name::before,
#id_name:nth-child(even),
.class_name[attribute_name=plain_value] {
property_name: 2em 1.2em;
--variable: rgb(250, 0, 0);
color: var(--variable);
animation: keyframes_name 5s plain_value;
}
```
2025-06-06 17:14:32 -04:00
..
2025-05-29 01:58:40 +00:00
2025-06-06 20:54:00 +00:00
2025-06-06 12:05:27 +00:00
2025-05-22 21:00:54 +00:00
2025-05-16 05:04:36 -04:00
2025-05-20 23:06:07 +00:00
2025-06-06 20:54:00 +00:00
2025-05-21 09:27:54 +00:00
2025-06-06 17:47:21 +02:00
2025-06-06 16:00:09 +00:00
2025-06-06 16:00:09 +00:00
2025-05-26 21:20:41 -03:00
2025-05-28 11:51:21 -04:00
2025-05-20 23:06:07 +00:00
2025-05-30 08:29:52 +00:00
2025-06-04 10:41:12 +03:00
2025-05-30 08:32:54 -07:00
2025-05-26 11:48:50 -04:00
2025-05-26 23:04:31 -04:00
2025-06-04 16:56:33 +00:00
2025-05-20 23:06:07 +00:00
2025-05-26 23:04:31 -04:00
2025-05-04 08:28:39 +00:00
2025-06-06 16:18:05 +03:00
2025-06-05 19:15:06 +00:00
2025-06-04 19:18:12 +00:00
2025-06-05 12:59:22 +00:00
2025-06-06 17:47:21 +02:00
2025-06-06 18:05:40 +02:00
2025-06-04 01:37:25 +02:00
2025-06-04 01:37:25 +02:00
2025-05-20 00:20:00 +00:00
2025-05-22 07:24:46 -04:00
2025-05-14 11:15:27 +02:00
2025-06-05 19:15:06 +00:00
2025-05-20 23:06:07 +00:00
2025-06-06 16:18:05 +03:00
2025-06-04 19:18:12 +00:00
2025-06-06 16:56:27 -04:00
2025-06-06 16:00:09 +00:00
2025-05-26 16:06:38 +02:00
2025-05-26 16:06:38 +02:00
2025-05-20 23:06:07 +00:00
2025-06-06 14:47:46 -06:00
2025-06-03 20:35:25 +00:00
2025-05-17 16:42:45 +00:00
2025-05-23 14:53:53 +00:00
2025-06-03 20:35:25 +00:00
2025-06-06 11:28:07 -04:00
2025-05-12 14:43:14 +00:00
2025-06-06 21:07:40 +00:00
2025-06-03 12:23:01 -04:00
2025-06-06 21:07:40 +00:00
2025-06-03 09:41:45 +02:00
2025-06-05 19:30:34 +00:00
2025-06-06 17:07:24 -04:00
2025-05-26 17:43:57 +00:00
2025-05-20 23:06:07 +00:00
2025-06-03 15:20:25 -03:00
2025-06-03 13:18:29 +02:00
2025-05-20 23:06:07 +00:00
2025-05-20 23:06:07 +00:00
2025-05-27 21:52:42 +00:00
2025-06-06 20:54:00 +00:00
2025-05-20 23:06:07 +00:00
2025-05-17 16:42:45 +00:00
2025-05-17 16:42:45 +00:00
2025-06-06 16:00:09 +00:00
2025-05-08 14:01:39 +02:00
2025-06-04 14:07:01 +00:00
2025-06-06 20:21:23 +00:00
2025-05-20 23:06:07 +00:00
2025-06-03 02:12:58 +00:00
2025-06-06 17:14:32 -04:00
2025-05-20 23:06:07 +00:00
2025-05-20 23:06:07 +00:00
2025-06-06 20:21:23 +00:00
2025-06-05 19:42:52 +00:00
2025-06-06 16:56:27 -04:00
2025-05-30 08:29:52 +00:00
2025-05-20 23:06:07 +00:00
2025-04-29 21:58:45 -03:00
2025-05-30 08:10:12 -03:00
2025-05-22 14:22:35 -04:00
2025-06-06 11:06:42 +00:00
2025-06-06 16:00:09 +00:00
2025-06-06 06:23:09 +00:00
2025-06-04 14:07:01 +00:00
2025-05-26 11:46:35 +00:00
2025-06-03 15:59:46 +00:00
2025-05-26 23:04:31 -04:00
2025-05-26 23:04:31 -04:00
2025-06-02 21:24:08 +00:00
2025-05-29 12:55:47 +00:00
2025-06-05 19:42:52 +00:00
2025-06-06 17:47:21 +02:00
2025-06-05 03:53:59 +05:30
2025-05-26 23:04:31 -04:00
2025-05-20 23:06:07 +00:00
2025-06-06 11:28:07 -04:00
2025-06-05 07:09:09 +00:00
2025-05-26 17:43:57 +00:00
2025-05-23 14:53:53 +00:00
2025-05-27 16:56:27 +00:00
2025-06-06 16:00:09 +00:00
2025-06-02 16:29:06 +00:00
2025-05-20 23:06:07 +00:00
2025-05-26 11:48:50 -04:00
2025-05-26 11:48:50 -04:00
2025-06-03 14:59:17 -03:00
2025-05-26 23:04:31 -04:00
2025-05-29 20:43:12 +00:00
2025-05-20 23:06:07 +00:00
2025-04-25 17:41:49 +03:00
2025-06-03 12:23:01 -04:00
2025-06-04 17:29:08 +00:00
2025-05-20 23:06:07 +00:00
2025-05-26 23:04:31 -04:00
2025-05-26 13:44:09 +00:00
2025-05-20 23:06:07 +00:00
2025-05-16 17:35:44 +02:00
2025-05-20 23:06:07 +00:00
2025-05-01 17:37:43 +02:00
2025-05-26 11:48:50 -04:00
2025-05-23 20:45:32 +00:00
2025-05-29 16:09:07 +00:00
2025-05-30 14:32:59 +02:00
2025-06-05 13:25:51 -04:00
2025-06-06 08:08:20 -04:00
2025-06-06 16:56:27 -04:00
2025-06-04 02:37:27 +00:00
2025-05-26 18:23:41 +00:00
2025-05-26 18:23:41 +00:00
2025-06-04 17:29:08 +00:00
2025-05-06 10:18:48 +00:00
2025-06-06 10:11:24 -07:00
2025-06-02 16:29:06 +00:00
2025-06-06 16:56:27 -04:00
2025-05-14 23:29:11 +02:00
2025-05-23 19:31:25 +00:00
2025-05-30 15:26:27 +00:00
2025-06-04 02:37:27 +00:00
2025-05-01 19:24:14 +00:00
2025-06-06 14:11:51 -06:00
2025-06-06 16:00:09 +00:00
2025-05-20 23:06:07 +00:00
2025-05-29 15:20:58 -04:00
2025-06-06 16:56:27 -04:00
2025-06-03 22:30:59 +00:00
2025-06-06 16:00:09 +00:00
2025-06-06 06:23:09 +00:00
2025-05-26 11:48:50 -04:00
2025-06-06 00:49:30 -06:00