The Grafana Jsonnet formatter in VS Code incorrectly rewrites syntactically valid object merging (+) inside a list comprehension. It replaces an object concatenation operation with an explicit key-value pair, which is a destructive change that alters the code's meaning and assumptions about the data structure.
Steps to Reproduce:
- VSCode plugin
grafana.vscode-jsonnet 0.7.2
- Use the VS Code command "Format Document" (or allow formatting on save).
env: [{ name: e.key } + e.value for e in std.objectKeysValues(env_)]
Actual Behavior
The formatter aggressively rewrites the line, changing the logic from object merging to direct key assignment. The code is incorrectly changed to:
env: [ { name: e.key, value: e.value } for e in std.objectKeysValues(env_) ]