|
|
(5 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| == Visual Studio Code ==
| | Refer to [[Modding/Using Visual Studio Code#Debugging Setup]] for how to set up debugging with Visual Studio Code. |
| In order to debug using Visual Studio code, a few steps first need to be completed:
| |
| | |
| # [https://marketplace.visualstudio.com/items?itemName=devCAT.lua-debug Lua Debugger] VSCode extension.
| |
| # Following files downloaded from [https://github.com/devcat-studio devcat] and placed where the Desynced Binary is (normally in: <code>C:\Program Files (x86)\Steam\steamapps\common\Desynced\Desynced\Binaries\Win64</code>)
| |
| ## [https://github.com/devcat-studio/VSCodeLuaDebug/blob/master/debuggee/dkjson.lua dkjson.lua] | |
| ## [https://github.com/devcat-studio/VSCodeLuaDebug/blob/master/debuggee/vscode-debuggee.lua vscode-debuggee.lua]
| |
| # [https://github.com/StageGames/VSCodeLuaDebugger/blob/main/mobdebug.lua mobdebug.lua] downloaded to the root of the Mods folder (normally in: <code>C:\Program Files (x86)\Steam\steamapps\common\Desynced\Desynced\Content\mods</code>)
| |
| # [http://steamcommunity.com/sharedfiles/filedetails/?id=3024638463 VSCode-Debugging] from Workshop
| |
| | |
| With the above ready, start the game with <code>-moddev</code> (optionally <code>-log</code> too for better logging output). Once the game has started, enable the <code>VSCode Debugging</code> from the Mod list.
| |
| | |
| Now in Visual Studio Code, create a folder called <code>.vscode</code> and add a file called <code>launch.json</code> and paste the following content into this file:
| |
| | |
| <syntaxhighlight lang="js" line="1">
| |
| {
| |
| "version": "0.2.0",
| |
| "configurations": [
| |
| {
| |
| "name": "Desynced Debugger",
| |
| "type": "lua",
| |
| "request": "attach",
| |
| "workingDirectory": "${workspaceRoot}",
| |
| "sourceBasePath": "${workspaceRoot}",
| |
| "listenPublicly": false,
| |
| "listenPort": 56789,
| |
| "encoding": "UTF-8"
| |
| }
| |
| ]
| |
| }
| |
| </syntaxhighlight>
| |
| | |
| This will create the ability to launch the debugger using Visual Studio Code, using <code>CTRL + SHIFT + D</code>. Once this has been pressed, you will now see <code>Desynced Debugger</code> with a green Play button. Upon pressing the Play button, the debugger will be launched, listening for the game.
| |
| | |
| Now, in game, either start a new game (or load a save game), or hit Hot Reload (<code>F7</code>) to cause the game to connect. Once connected, you'll have full access to stepping through code, as well as accessing the local and watch windows, etc. You make have to enable <code>Allow Breakpoints Everywhere</code> in your settings to set breakpoints.
| |