I'm trying to customize token colorization for Fortran in VS Code. To give a concrete example, I want all preprocessor directives to be a certain color and in italics. I can do it by adding the following block in settings.json
,
"editor.tokenColorCustomizations": {"textMateRules": [
{
"scope": ["keyword.preprocessor.ifdef.fortran","keyword.preprocessor.endif.fortran","keyword.preprocessor.ifndef.fortran","keyword.preprocessor.indicator.fortran"],
"settings": {"foreground": "#99E8B2", "fontStyle": "italic"},
},
]}
However, this looks ugly. Is there a way to specify that all preprocessor keywords in fortran should be formatted a certain way? I tried "keyword.preprocessor.*.fortran"
and "keyword.preprocessor..+.fortran"
, but they didn't work. I could just do "keyword.preprocessor"
as the scope, but I only want this formatting to apply to Fortran preprocessor keywords, not (say) C preprocessors.
This question applies to other elements of the language as well. For example, if I want all type specifiers to have a certain color, I would like to specify a "wildcard" for the scope, such as "storage.type.*.fortran"
, but that syntax does not work. If I could specify "storage.type"
as the scope but limit it only to Fortran, that would be perfect.
Edit As per suggestions of @rioV8, I tried the following:
"[FortranFreeForm]": {
"editor.tokenColorCustomizations": {"textMateRules": [
{
"scope": "meta.parameter.fortran",
"settings": {"foreground": "#f0f0f0"},
}]}},
in my settings.json
, but that did not work.