Skip to content

caiomecar/p2ce-vscript-support

Repository files navigation

Portal 2: Community Edition VScript Support

An VSCode extension made for P2CE VScript support, based on https://github.com/ocet247/tf2-vscript-support (TF2 VScript Support) extension for the language server and logic of the extension itself.

(THIS EXTENSION IS IN A VERY VERY VERY EXPERIMENTAL STATE, SO DON'T EXPECT NO BUGS OR NO CRASHES)

Features

  • Completions
    • Keywords
    • Symbols
    • String literals (like script names, functions, auto-complete, etc)
    • Members of builtin types
  • Completions for documentation comments
    • Autogenerated comment for variables and functions
    • Tags
    • Types
    • Parameter names (for @param)
  • Hover
  • Go to definition
  • Go to type definition
  • Find references
  • Rename
  • Semantic tokens
  • Inlay hints
  • Signature help
  • Document symbols
  • Document link for imports
  • Workspace symbol
  • Selection range

Diagnostics

  • Syntax checking
  • Type checking for operations and function call arguments
  • Unused local variables
  • Unreachable code

Additional

  • String literal name resolution
  • Type inference for both variables and functions
  • Documentation comments with simple types
  • Import resolution from IncludeScript
  • Standard library symbols included from both Squirrel and VScript

TODO

  • Implement custom entities (AngelScript) in the string literals
  • Custom ConVars & ConCommands in string literal
  • Game Events signatures (like 'OnPlayerUse')
  • Formatting
  • Completions and validation for models/sounds/assets
  • Entities input and outputs
  • Amplify and upgrade the database

Parser Generator

You can generate your own definitions and modify the existing ones by modifying the 'vscript.nut' in the extension files, without needing to recompile the language server

To generate your own 'vscript.nut' file you need the docs definitions generated by the game, using the sv_script_dump_docs command in-game or by getting the dumps from here. Then put all files in the 'gen' folder and use the 'dataparser.py' to generate the 'vscript.nut' file.

(You can use the same method to generate your own classnames definitions but you will need to recompile the server for updating the classnames)

Credits

About

An VSCode Extension for Portal 2: Community Edtion VScript Support with language server

Topics

Resources

License

Stars

Watchers

Forks

Packages