Difference between revisions of "Visual Studio Code"

From Frictional Wiki
Jump to navigation Jump to search
(Created)
 
(Expand article to feature HPL2 config)
Line 1: Line 1:
Visual Studio Code is a lightweight notepad-esque version of Microsoft's full IDE Visual Studio. It can be used for programming for HPL.
+
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).
  
[[HPL3/Scripting/Scripting Guide/Setting up Visual Studio Code |'''Click here to view a guide of setting up and using the tool''']].
+
An open-source version is available: [https://vscodium.com/ 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 [[Setting up an Online Repository | here]] and more about git in VS Code [https://code.visualstudio.com/docs/sourcecontrol/intro-to-git 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:
 +
** <code>*.hps</code> with a value of <code>cpp</code>
 +
** <code>*.lang</code> with a value of <code>xml</code>
 +
** <code>*.cfg</code> with a value of <code>xml</code>
 +
** 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.
 +
 
 +
Optional: Install the [https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools cpptools] extension to get better error detection and other helpful features for scripting.
 +
This step is optional, as VS Code will still give you hints about code that you have already written once anywhere in the project.
 +
Note that using this extension will require some extra configuration because HPL's AngelScript is not pure C++.
 +
If you're using VSCodium, you will have to [https://stackoverflow.com/questions/42017617/how-to-install-vs-code-extension-manually install the extension manually].
 +
 
 +
You can also check out the HPL3 section, as certain parts of it are also relevant to HPL2.
 +
 
 +
== HPL3 ==
 +
 
 +
''Main article: [[HPL3/Scripting/Scripting Guide/Setting up Visual Studio Code | Setting up Visual Studio Code]]''

Revision as of 14:19, 23 March 2024

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.

Optional: Install the cpptools extension to get better error detection and other helpful features for scripting. This step is optional, as VS Code will still give you hints about code that you have already written once anywhere in the project. Note that using this extension will require some extra configuration because HPL's AngelScript is not pure C++. If you're using VSCodium, you will have to install the extension manually.

You can also check out the HPL3 section, as certain parts of it are also relevant to HPL2.

HPL3

Main article: Setting up Visual Studio Code