cooolbros / vscode-vdf

VDF/Valve KeyValues language support for VSCode
https://marketplace.visualstudio.com/items?itemName=pfwobcke.vscode-vdf
GNU General Public License v3.0
22 stars 4 forks source link

Formatting removes comments! #5

Closed XcapeEst closed 2 years ago

cooolbros commented 2 years ago

Can you provide a sample code snippet for when this happens?

XcapeEst commented 2 years ago
"Resource/UI/ChatPopup.res"
{
    "InviteNotification" // xypos doesnt work here
    {
        "fieldName"         "InviteNotification"
        "zpos"              "1"
        "wide"              "200"
        "tall"              "35"
        "visible"           "1"
        "border"                "ReplayDefaultBorder"
        "paintbackground"       "0"
        "bgcolor_override"      "255 0 0 250"
    }

Turns into

"Resource/UI/ChatPopup.res"
{
    "InviteNotification"
    {
        "fieldName"             "InviteNotification"
        "zpos"                  "1"
        "wide"                  "200"
        "tall"                  "35"
        "visible"               "1"
        "border"                "ReplayDefaultBorder"
        "paintbackground"       "0"
        "bgcolor_override"      "255 0 0 250"
    }
cooolbros commented 2 years ago

Interesting, it doesn't seem to happen for me formatting_demo

Does it still happen if you disable all other extensions?

XcapeEst commented 2 years ago

I have been using the "VDF: Format VDF" function, and using the right-click format worked fine.

cooolbros commented 2 years ago

The purpose of "VDF: Format VDF" is to format snippets of VDF embedded in files of different languages (e.g. markdown). The problem is the command is yet to be updated to use the new formatting functionality (which formats comments). I will update the command in the next release.

I would suggest setting editor.formatOnSave to true to make formatting more convenient, rather than using "VDF: Format VDF"