vscode-vdf
vscode-vdf copied to clipboard
Warn for duplicate values
It may not be a bad idea to warn when a panel has duplicate values (xpos, ypos, zpos, etc) that could be conflicting with each other. 99% of the time it's easy to catch when it happens, but it may not hurt to consider
This can definitely be added
Here are some things to consider:
Some keys are permitted to have duplicate keys (Such as resource/ui/hudmatchstatus.res RoundSignModel > model > animation), so to avoid false positives, only keys that are known to be unique should warn
If keys were to default to being unique, then some unknown valid VDF with multiple keys would warn, and if someone installs the extension only to get an incorrect warning that they can't remove, they will immediately uninstall, so we should under-warn instead of over-warn and only warn when we know we are correct.
Keys are case insensitive, so zpos and ZPOS are duplicates
Keys also have conditionals, so zpos 0 [$WIN32] and zpos 1 [$X360] are not duplicates
In Popfiles, a TFBot with an attribute subkey such as Health before a Template reference subkey that also contains the same attribute (Health) will cause a conflict and TF2 will load the subkey from the Template. To override the TFBot Health, the Health key must appear after the Template reference.
I haven't checked to see if this behaviour is different in entry files and #base files. The HUD Merger has a data loader for HUD layout files which can be used as a reference, hopefully the behaviour is similar
Added in 166cc0b, but still not sure about Popfiles
Duplicate key checking checks the following keys (VGUI), is case insensitive and considers conditionals
ControlNamefieldNamexposyposzposwidetallautoResizepinCornervisibleenabled
No duplicate key checking exists for Popfiles