Giter VIP home page Giter VIP logo

vscode-vdf's Introduction

VSCode VDF Language Support

VDF/Valve KeyValues language support for VSCode

Features

  • Syntax highlighting
  • File formatting
  • Autocompletion for key/values
  • Go To Definition/Find References for key/values
  • View/Edit VTF files
  • Convert VDF to JSON
  • Convert JSON to VDF

Features (HUD)

  • Definition Provider
    • All Clientscheme properties
    • labelText
    • pin_to_sibling
    • image
  • Codelens for Clientscheme references
  • Autocompletion for element properties:
    • ImagePanel => image, scaleImage, etc...
    • CExLabel => labelText, font, textAlignment, fgcolor, etc...
  • Autocompletion for property values
    • textAlignment => center, north, east, south, west
    • font => Will suggest from clientscheme
    • labelText => Will suggest from chat_english.txt and tf_english.txt
  • Autocompletion for #base paths
  • Autocompletion for image paths
  • Autocompletion for pin_to_sibling elements
  • Rename HUD elements

Features (HUD Animations)

  • Autocompletion for keywords, HUD elements (from associated files), common properties, clientscheme values, interpolators
  • Warning for duplicate/unused events
  • Codelens for event references
  • Go To Definition/Find References for events
  • Rename events
  • Syntax highlighting for HUD Animations

Features (Popfile)

  • Definition Provider
    • Templates
  • Autocompletion for Attributes, BehaviorModifiers, Class, Skill, Objective, etc...
  • Autocompletion for property values:
    • Template => Will suggest from Templates
    • ClassIcon => Will suggest files
  • Colour picker for "set item tint rgb"
  • Link to ClassIcon
  • Import #base templates into Popfile
  • Rename Templates (file wide)

Features (VMT)

  • Autocompletion for common key/values
  • Autocompletion for property values:
    • $baseTexture => Will suggest texture files
  • Colour picker for $color (Supports int and float colours)
  • Link to $baseTexture

Github: https://github.com/cooolbros/vscode-vdf

VS Marketplace: https://marketplace.visualstudio.com/items?itemName=pfwobcke.vscode-vdf

Open VSX Registry: https://open-vsx.org/extension/pfwobcke/vscode-vdf

vscode-vdf's People

Contributors

cooolbros avatar dependabot[bot] avatar xcapeest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-vdf's Issues

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

Support for `mod_textures.txt`

It seems that mod_textures.txt matches VDF so it would be helpful if the extension could support this file and related ones as well.

Docs website

Docs website is at https://cooolbros.github.io/vscode-vdf/ but there is nothing on it. This issue is a mega issue for anything that needs to be added.

Every vscode-vdf setting should be listed with gifs of behaviour and screenshot examples for formatting.

Other recommended VS Code settings should be listed to improve the experience and compatibility with vscode-vdf, such as:
"editor.autoClosingBrackets": "always", to avoid missing } syntax errors
"editor.formatOnSave": true, to run formatter automatically
"editor.wordBasedSuggestions": "off" because it interferes with vscode-vdf suggestions
"files.associations" to associate branded files to vscode-vdf contributed languages, such as

	"files.associations": {
		"bh_*.txt": "hudanimations"
	},

for budhud, to set files like bh_crosshair_animations.txt to hudanimations

Scheme references are not updated in scheme file

If you have a border in resource/clientscheme.res that references a colour also inside resource/clientscheme.res, then change the file contents so that the location of the colour definition changes, the language server will not update the position of the reference, leading to incorrect reference locations

example:
image

parse error while extra label [ $someone || $someone ]

I don't know the name of [ $someone || $someone ], but there was a part of real file in Left 4 Dead 2 UI defination:

"Resource/UI/Addons.res"
{
    // because in longer languages the button text overlaps the icon, I'm only making it visible for these languages
    "IconBrowseWorkshop" [$english || $spanish || $finnish || $brazilian || $japanese || $korean || $latam || $portuguese || $schinese || $tchinese || $swedish || $thai || $turkish]
    {
        "ControlName"       "ImagePanel"
        "fieldName"         "IconBrowseWorkshop"
        "xpos"              "c-50" [$win32wide]
        "xpos"              "c-100"
        "ypos"              "440" [$win32wide]
        "ypos"              "455"
        "zpos"              "0"
        "wide"              "30" [$win32wide]
        "tall"              "30" [$win32wide]
        "wide"              "15"
        "tall"              "15"
        "scaleImage"        "1"
        "pinCorner"         "0"
        "visible"           "1"
        "enabled"           "1"
        "tabPosition"       "0"
        "image"             "addonsmenu/icon_browse_workshop"
    }
}

It throws an error Unexpected '{'. Expected key.

I guess problem occursined by the label [$english || $spanish || $finnish || $brazilian || $japanese || $korean || $latam || $portuguese || $schinese || $tchinese || $swedish || $thai || $turkish].

  • It's Ok: [$english]
  • It's Error: [$english || $spanish]

extension version

v4.3.0

Add support for SetFont, SetTexture, and SetString for HUDAnimations

These are defined in vgui2\vgui_controls\AnimationController.cpp

They're formatted as so:
SetFont <Panel> <Font variable name> <Font name> <Time>
SetTexture <Panel> <Texture variable name> <Material path> <Time>
SetString <Panel> <String variable name> <String value> <Time>

A of now, using any of these raises an error. Using version 4.3.0.

Example with SetFont:
Code_KAZwYNRG9v

event MenuOpen
{
    StopEvent    MenuClose    0.0
    Animate      HudMenu      PaintBackgroundType    0                 Linear    0.0    0.0
    Animate      HudMenu      RoundedCorners         0                 Linear    0.0    0.0
    Animate      HudMenu      XPos                   0                 Spline    0.0    0.05
    Animate      HudMenu      Alpha                  255               Spline    0.0    0.05
    Animate      HudMenu      SelectionAlpha         255               Spline    0.0    0.05
    //
    Animate      HudMenu      MenuBoxColor           Blank             Spline    0.0    0.0
    Animate      HudMenu      BgColor                Blank             Spline    0.0    0.0
    //
    Animate      HudMenu      FgColor                FragNeutral100    Spline    0.0    0.05
    Animate      HudMenu      MenuColor              FragNeutral100    Spline    0.0    0.05
    Animate      HudMenu      ItemColor              FragNeutral100    Spline    0.0    0.05
    //
    SetFont      HudMenu      TextFont               FontMedium_10_Additive             0.0
    Animate      HudMenu      TextScan               0                 Spline    0.0    0.05
    Animate      HudMenu      Blur                   0                 Spline    0.0    0.0
}

Support StopAnimation

It is used in hl2_misc_dir.vpk > scripts/hudanimations.txt line 539

The syntax is: StopAnimation <element> <property> <delay>

Popfile: Squad with 1 subkey is useless

Squad
{
    TFBot
    {
	    Template	T_TFBot_Giant_Soldier_RocketShotgun
    }
}

is incorrect and should cause a diagnostic, as well as a code action to transform the block into

TFBot
{
	Template	T_TFBot_Giant_Soldier_RocketShotgun
}

Rename document symbols in #base files

Currently, renaming a document symbol only changes the occurrence in the current file, if the key is declared in #base files, the occurrences in the #base file do not get updated to reflect the new name

Probably falsely detected problems in default HUD files

I'm not sure if all of the problems listed below are really false detections, but at least some seem to be.

  • A lot of values for ControlName used in files inside hl2_misc_dir.vpk and platform_misc_dir.vpk are marked as not valid. Such as URLLabel (used in m0rehud) or CReplayBrowserDetailsPanel (used in ahud).
    2023-09-11_18-37-43
  • "textAlignment" "left"/"Left", "northwest", "center-west". The first value is used in many files. The second one has about 10 uses. The last is only used once, so it's very likely a typo.
  • "paintborder", "paintbackground" "2". Each is used only twice, so...
  • image
  • image

Error: Request textDocument/documentLink failed

image

[Error - 4:32:04 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot read properties of undefined (reading 'teamFortress2Folder')
  Code: -32603 

I don't know what exactly triggers this error or if it causes any actual problems, but I've manager to "consistently" trigger the error by switching from file to file quickly enough:

2023-09-11.17-40-57.mp4

But as far as I can tell, that's not the only scenario for this error to be triggered.

Auto completion for item attributes when within an ItemAttributes or CharacterAttributes block

I can see that some attributes are supported as screencapped below:
image

But it would be great if all of them are supported, mostly just to reduce the compulsion of "let's spend 5 seconds to make sure I copy-pasted this right or I typed this right". Feel free to mark this as impossible or improbable if the attribute list proves to be too long to do anything with.

List can be found here: https://wiki.teamfortress.com/wiki/List_of_item_attributes
Or from items_game.txt found in [TF2 folder]/tf/scripts/items/items_game.txt - lines 209242 to 217147.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.