This version of the guide tells you how to install VSCode and the Papyrus Extension if you do not want to use Mod Organizer 2. In other words, use this guide if you are using Vortex, no mod manager, etc.


Introduction

This is a guide and project template that will help you:

  • Use the Visual Studio Code (VSCode) text editor with the Papyrus Extension to edit your Papyrus scripts with modern features like syntax highlighting, code completion, automated build, inline error messages/highlighting, and other good code editor stuff.
  • Install and use Papyrus Debugging in VSCode.


Installation and Usage

VSCode Papyrus Extension and Template Setup

1. Download and Install the Visual Studio Code (VSCode) text editor.

2. Manually download the VSCode SkyrimSE Papyrus Project Template from the Files section.

3. Open up the 7z archive and copy only these files/directories to your Skyrim Special Edition game directory:
  • .vscode
  • Papyrus.code-workspace
(Just ignore the Script and Source directories. They are empty anyway.)

4. In your skyrim game directory, double click on the Papyrus.code-workspace file to open the workspace in VSCode.

5. Notice that in the lower right corner of the screen you will see this:



Click Show Recommendations.

6. Now in the upper left you will see two extensions being offered for install:



At the very least install the Papyrus Extension. Error Lens is optional, but you might want to just install that too because you can always disable or uninstall it later if you don't like it.

7. Once the Papyrus extension is installed, click on the little gear icon (replaces the install button after the install is complete) and select Configure Extension Settings.



8. Set up the Install Path for your Skyrim Special Edition game directory. Disable any other games you aren't using or developing for. Then close the settings editor.

9. In CK create some scripts and other stuff, then go back to VSCode and click that icon that looks like overlapping pages in the upper left to show the project explorer tree. Open some script files, etc.

10. Open a script file and notice that you now have code completion and stuff thanks to Joel Day's Papyrus extension. Hit Shift-Ctrl-B and your .psc files will all be compiled. If you have any errors they will be marked in the editor. See the .vscode/tasks.json file for the build configuration. (I suspect it will work with Fallout 4 etc if edited as suggested but I haven't tested it.)

11. You are all set! The VSCode Docs can tell you more about editing.


Optional Steps for Debug Support

You can skip those if you don't want debug support, but it's pretty cool so why not give it a shot?

1. Install Skyrim Script Extender SE Build in your Skyrim SE directory if you haven't already.

2. Load up Papyrus.code-workspace as usual, then click on the little bug icon on the left and select the Skyrim debug config:



3. Press the thing that looks like a play button next to the config popup and you will see a prompt in the lower right of the window that tells you that you need to install the debug support plugin. Click Install SKSE Plugin.

4. Like the little box said, launch Skyrim with SKSE and wait for the main menu to appear. You may get a firewall warning about skyrimse.exe wanting to listen on a TCP port. This is normal, and it doesn't need access from other networks. The TCP port is what is used to connect locally to the debugger plugin.

5. Now switch back to VSCode and press the little play button in the debug panel. It should connect and at the very least you will get messages in the debug console. Load a game or otherwise do some testing and you should be able to see some results. Set breakpoints and the debugger will show what's going on when it breaks into debug mode. The VSCode docs on Debugging can tell you more but not all features work for all language platforms.




Questions/Help

If you need help with VSCode config then try the discord for the Papyrus VSCode extension. Feel free to ping me on there @NimrodX.


Thanks

Thanks goes out to Joel Day for the nice Papyrus extension for VSCode and the whole Mod Organizer 2 team for the excellent features of MO2!

Article information

Added on

Edited on

Written by

nimrodxy

0 comments