mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 13:18:47 +00:00
Merge #8482
8482: Mention how to customize unsafe operation styles r=matklad a=danielzfranklin I was confused about how to do this, so I filed #8474. I apologize for initially filing this incorrectly and spamming people. Co-authored-by: Daniel Franklin <daniel@danielzfranklin.org>
This commit is contained in:
commit
a2349366b5
1 changed files with 35 additions and 0 deletions
|
@ -611,6 +611,41 @@ For example, mutable bindings are underlined by default and you can override thi
|
|||
}
|
||||
----
|
||||
|
||||
Most themes doesn't support styling unsafe operations differently yet. You can fix this by adding overrides for the rules `operator.unsafe`, `function.unsafe`, and `method.unsafe`:
|
||||
|
||||
[source,jsonc]
|
||||
----
|
||||
{
|
||||
"editor.semanticTokenColorCustomizations": {
|
||||
"rules": {
|
||||
"operator.unsafe": "#ff6600",
|
||||
"function.unsafe": "#ff6600"
|
||||
"method.unsafe": "#ff6600"
|
||||
}
|
||||
},
|
||||
}
|
||||
----
|
||||
|
||||
In addition to the top-level rules you can specify overrides for specific themes. For example, if you wanted to use a darker text color on a specific light theme, you might write:
|
||||
|
||||
[source,jsonc]
|
||||
----
|
||||
{
|
||||
"editor.semanticTokenColorCustomizations": {
|
||||
"rules": {
|
||||
"operator.unsafe": "#ff6600"
|
||||
},
|
||||
"[Ayu Light]": {
|
||||
"rules": {
|
||||
"operator.unsafe": "#572300"
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
----
|
||||
|
||||
Make sure you include the brackets around the theme name. For example, use `"[Ayu Light]"` to customize the theme Ayu Light.
|
||||
|
||||
==== Special `when` clause context for keybindings.
|
||||
You may use `inRustProject` context to configure keybindings for rust projects only.
|
||||
For example:
|
||||
|
|
Loading…
Reference in a new issue