vscode-vdf icon indicating copy to clipboard operation
vscode-vdf copied to clipboard

Warn for duplicate values

Open rbjaxter opened this issue 1 year ago • 2 comments

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

rbjaxter avatar Jul 09 '24 05:07 rbjaxter

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

cooolbros avatar Jul 09 '24 10:07 cooolbros

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

cooolbros avatar Aug 07 '24 08:08 cooolbros

Added in 166cc0b, but still not sure about Popfiles

cooolbros avatar Dec 21 '24 14:12 cooolbros

Duplicate key checking checks the following keys (VGUI), is case insensitive and considers conditionals

  • ControlName
  • fieldName
  • xpos
  • ypos
  • zpos
  • wide
  • tall
  • autoResize
  • pinCorner
  • visible
  • enabled

No duplicate key checking exists for Popfiles

cooolbros avatar Feb 24 '25 02:02 cooolbros