Visual Studio Code

From Frictional Wiki
Revision as of 14:57, 23 March 2024 by Darkfire (talk | contribs) (comment out faulty tutorial (for now) and add info about linter)
Jump to navigation Jump to search

Visual Studio Code is a lightweight code and config editor based on Microsoft's full IDE Visual Studio. Featuring an integrated project folder browser and a simple but powerful interface, it is one of the best tools for developing HPL2 mods (for HPL3 it works well too, but CodeLite might be a better option).

An open-source version is available: VSCodium. It is functionally identical to VS Code.

HPL2

  • Open your mod folder
  • Check out the built-in VS Code tutorial. Some particularly useful features are:
    • Ctrl+Shift+F to search text in the entire project folder
    • Alt+Up/Down arrows to move lines of code
    • Ctrl+Shift+Alt+Up/Down to copy lines of code
    • Built-in git version control interface (if you already have git installed). This is one of the more convenient ways of using git. Read more about version control here and more about git in VS Code here.
  • Add highlighting for HPL2 file types; Open the settings menu (Ctrl+,) and search "file associations". You can do this in the User tab (global) or the Workspace tab (will only apply to this project folder).

Then add:

    • *.hps with a value of cpp
    • *.lang with a value of xml
    • *.cfg with a value of xml
    • You can also add associations for other HPL files, such as: .ent, .dae, .snt and so on. Pretty much all files in HPL2 use XML.
    • This will also add auto-completion for various things (like function names) that have been written anywhere else in the project.

At the moment, there is no dedicated way of adding autocompletion for HPL2 script function signatures.

Unlike HPL3, using a C++ extension will make things worse for you, as HPL2's style of scripting is not fully compatible with C++ standards. There do exist a few AngelScript plugins for VS Code, but none of them are any good (and several of them are abandoned).


HPL3

Main article: Setting up Visual Studio Code