redhat-developer / redhat-developer/vscode-yaml

We use variables in YAML which gets filled afterwards can't use the variables with customTags

Open
#914 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

We use Java to build our project (maven) and variables will be put in the YAML file like:

services:
 ${project.artifactId}:
  image: ${project.artifactId}:dev

so the actual file will be genereated in src/target folder with the appropiate name.
I can't save these docker-compose file cause the formatter makes it

services:

    "${project.artifactId}":
        image: ${project.artifactId}:dev

not to mention also putting the JAVA_OPTS from multi-line

   JAVA_TOOL_OPTIONS: "
    -Dencryption.keystore.type=JCEKS
    -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding
    -Dencryption.keyAlgorithm=DESede
    "

Back to 1-line

JAVA_TOOL_OPTIONS: " -Dencryption.keystore.type=JCEKS -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding -Dencryption.keyAlgorithm=DESede"

Expected Behavior

When adding the variable to the settings.json

"yaml.customTags": [ "${project.artifactId}" ],
It should encapsulet them in quotes

Current Behavior

see problem

Steps to Reproduce

  1. use the example piece of yaml
  2. hit save
  3. see the change

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

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

Reproduce the formatter behavior with the YAML examples and the yaml.customTags setting described in the issue. Start by tracing the customTags handling in the formatter, then verify that variable-like keys remain valid and the shown multiline JAVA_TOOL_OPTIONS value is preserved as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode, yaml
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.