redhat-developer / redhat-developer/vscode-yaml

Highlight patternProperties a different colour

Open
#1,012 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the extension's YAML syntax-highlighting implementation and how schema patternProperties are represented. Use the schema and YAML example from the issue to determine where author-defined properties can be distinguished, then verify that those properties receive a separate colour without changing schema-defined keywords.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.