Setup for development with VS Code

To develop Dragonfly extensions, we recommend using Visual Studio Code as the environment of development. This section describes how to do the setup and debug your program.

Installing Dragonfly

Install Dragonfly as usual. The recommended installation path is C:\Program Files\Dragonfly2025.1.

Note

In this documentation page, the installation path will be identified as DRAGONFLY_INSTALLATION_PATH.

Before getting further, make sure the application is running properly, then exit the program.

Registering DLLs

Navigate to the directory where you installed Dragonfly. Right click on registerDLLs.bat and select Run as administrator.

../../_images/21_RegisterDLLs.png

Install Scoop and Required Packages

Scoop is a really nice command line utility that allows you to quickly install packages.

Open PowerShell like shown below:

../../_images/01_OpeningPowershell.png

Run the following command to install scoop:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
../../_images/02_InstallScoop.png

Install required packages

scoop install git
scoop bucket add extras
scoop install vscode uv
../../_images/03_InstallVSCode_and_UV.png

../../_images/04_InstallVSCode_and_UV_success.png

Setup VS Code Environment

In a file browser, go to the folder DRAGONFLY_INSTALLATION_PATH. Copy the file setEVarsForPythonIDE.bat in a folder with writing permission (example, the Desktop). Edit that copied file with a text editor, like Notepad. Add the path to the VSCode executable at the end of the file. Save and close the file. Rename the file with a more relevant name, like Start VSCode.bat.

../../_images/05_OpeningVSCodeWithEnvironmentFile.png

Generate VS Code Workspace from Dragonfly

From within Dragonfly, go to the menu item Developer and choose Generate Dragonfly VSCode Workspace to generate a VS Code workspace file that contains all the necessary configuration.

../../_images/06_InDragonflyGenerateVSCodeWorkspace.png

Save the workspace file in your user folder for easy access:

../../_images/07_SaveWorkspaceInUserFolder.png

Opening VS Code from Dragonfly

Just after you created the workspace, you can open VS Code directly from within Dragonfly to ensure proper environment setup:

Warning

Always start VS Code through the Start VSCode.bat file as explained above. Not doing so will prevent Dragonfly from starting correctly from VS Code due to missing environment variables.

../../_images/08_OpenVSCodeFromDragonfly.png

When VS Code opens, you need to trust the workspace authors:

../../_images/09_TrustAuthorOfWorkspaceInVSCode.png

Running and Debugging Dragonfly

Once everything is set up, you can start Dragonfly in debug or run mode directly from VS Code by running the OrsMinimalStartupScript.py file:

../../_images/11_StartDragonflyDebugOrRunInVSCode.png

Setting up Roo AI Assistant (Optional)

For enhanced development experience, you can set up the Roo AI assistant. First, get an API key from any provider you wish (We show here OpenRouter but any other will work):

../../_images/12_getAPIKeyForROo.png

Go to OpenRouter and add credits to your account, then create an API Key:

../../_images/13_OpenRouterAddCreditsAndCreateKeys.png

Copy the generated API key:

../../_images/15_OpenRouterCopyKey.png

Insert the API key in Roo settings and verify the MCP Servers are running:

../../_images/16_RooInsertAPIKeyAndMCPServers.png

Configure additional Roo settings for optimal development experience:

Disable checkpoints, set Auto-Approve and set the reading files limit:

../../_images/18_RooSettingsAllpng.png

Debugging while running Dragonfly

When starting in Debug mode, you can set breakpoints on specific lines. While paused, you can use the debug console to examine and/or modify existing values. VS Code provides excellent debugging capabilities with variable inspection, call stack viewing, and interactive debugging.

Using the Python console in VS Code

VS Code provides integrated terminal support where you can run Python commands. You can also use the Python interactive window for testing code snippets. When properly configured, all Dragonfly modules are accessible even if the application is not started.

Note

If you encounter issues with graphics or OpenGL, you may need to specify the graphics card to use, similar to the PyCharm setup. This can be done by configuring the Start VSCode.bat to use a dedicated GPU or via your Nvidia control panel.