redhat-developer / vscode-yaml

YAML support for VS Code with built-in kubernetes syntax support
MIT License
665 stars 222 forks source link

Highlight patternProperties a different colour #1012

Open danielearwicker opened 8 months ago

danielearwicker commented 8 months ago

Is your enhancement related to a problem? Please describe.

Some schemas have patternProperties so the author of the YAML file can specify any property names they like at some level. Whereas other properties are hard-wired by the schema.

Logically this is like a distinction between keywords of a programming language (built in) and identifiers for variables/functions invented by the programmer.

In this schema the author has defined a collection they've called UI, under which they've defined properties that they've called Service, SubsiteType, FilterGroup etc...

But the inventions of the author of the file are hard to distinguish visually from the "keywords" of the schema (collections, properties, constant, description...)

image

Describe the solution you would like

Properties that are covered by patternProperties in a schema could be another colour, just as coder-defined variable names are a different colour from language keywords.

Describe alternatives you have considered

My current workaround is to have the schema-defined keywords be lowercase/camelCase, and require the author-defined properties to be PascalCase. (I can't enforce this because it seems like this extension ignores the specific regex pattern supplied to patternProperties).