Setting up Visual Studio Code
While s&box addon development is currently mainly targeting Visual Studio, you can still use Visual Studio Code with full support for IntelliSense and debugging too.
Download and install Visual Studio Code from here.
The following Visual Studio Code extensions will be required to write and debug s&box addons in Visual Studio Code:
First create the solution by running
GenerateProjects.bat in your addons folder.
After that start Visual Studio Code and press
File -> Open Folder...:
sbox\addons folder. After that go to
File -> Save Workspace As... and save it as
addons.code-workspace inside the addons folder.
The C# extension has Roslyn analyzers disabled by default. These are required for s&box code generation so that we won't get errors in auto generated code like ClientCmd and ServerCmds calls. This will also allow you to get automatic suggestions for your code.
To enable Roslyn analyzers, create a file called
omnisharp.json in your addons folder with the following content:
We need to add a debugging configuration to debug addons. Create the following file in
You can now start debugging your addons by setting breakpoints and pressing F5:
Keep in mind that you need to manually start s&box first before debugging.
Visual Studio Keymap: Adds Visual Studio keymaps in case you are used to Visual Studio shortcuts.
JetBrains Keymap: Adds JetBrains keymaps in case you are used to JetBrains shortcuts.
EditorConfig for VS Code: Automatically format your code with the s&box coding style
SCSS Formatter: Automatically format your scss files.
vscode-solution-explorer: Visual Studio-like solution explorer for Visual Studio Code.
C# Snippets: C# code snippets.
Auto-Using for C#: Auto import namespaces.
C# Extensions: Quickly create new classes and generate constructors.
C# Namespace Autocompletion: IntelliSense for writing namespaces.
C# XML Documentation Comments: Easier code documentation.
GitLens: A useful extension when working with Git.
Visual Studio Code has first-class support for themes. You can browse and install themes from here.