If you want to use GitHub Copilot or the Delphi LSP extension while working on Delphi code, this plugin makes the RAD Studio to Visual Studio Code round-trip much smoother.
This plugin adds a "Tools->Edit in Visual Studio Code" command to RAD Studio.
Terminology note:
- "Visual Studio Code" (or "VS Code") is the external editor used by this plugin.
- "RAD Studio" (Delphi IDE) is the Embarcadero IDE where this plugin is installed.
In this document, "Visual Studio" always means "Visual Studio Code".
When you use that command, the plugin will:
- Save all modified files currently open in the IDE.
- Open the current Delphi source file in Visual Studio Code at the exact line and column you were editing in RAD Studio.
- Reuse an existing Visual Studio Code window when possible, instead of opening duplicate editors for the same workspace.
The plugin settings are available in Delphi under Tools->Options->Third Party->Edit in VS Code.
The latest version adds several practical improvements:
- Full Project Group support: when a Delphi project group is active, the plugin now generates and opens an equivalent VS Code workspace for the whole group, not just a single project folder.
- Configurable launch behavior: both the keyboard shortcut and the VS Code launch command are now configurable from Tools->Options->Third Party->Edit in VS Code.
- Smarter instance reuse: the plugin now searches for a VS Code window already associated with the current workspace before reusing it, instead of reusing a generic instance.
- Non-destructive settings generation: VS Code settings and extension recommendations are merged instead of overwritten, preserving user customizations.
- Automatic Delphi workspace cleanup defaults: the plugin configures
files.excludewith common Delphi output/history patterns (**/Debug,**/Release,**/Win32/Debug,**/Win32/Release,**/Win64/Debug,**/Win64/Release,**/__recovery,**/__history,**/.#*,**/*.rc,**/*.res,**/*.RES,**/*.bak,**/*.BAK). - Better launch diagnostics: startup failures now show a detailed, copyable error dialog with command line, working directory, exit code, stdout, and stderr.
- Better Delphi form workflow support: the plugin warns when child forms are open and handles the most common IDE edge cases before switching to VS Code.
- Project Group-aware workflow with automatic generation/update of
.code-workspacefiles. - Settings page integrated in Delphi Tools->Options under Third Party->Edit in VS Code.
- Persistent plugin settings (
%APPDATA%\EditInVSCode\settings.json) for launch command and shortcut. - Dedicated VS Code launch error dialog with copyable diagnostics.
- Child form detection and warning dialog before opening files externally.
- Automatic
files.excludedefaults for common Delphi build/output/history artifacts (Debug/Release,Win32/Win64,__recovery,__history,.rc/.res/.bak, and temporary lock-like files).
- Menu command renamed to "Tools->Edit in Visual Studio Code" and aligned with settings naming.
- VS Code window reuse strategy improved to target the window matching the current workspace.
- VS Code configuration generation changed from overwrite to merge behavior for folders, settings, and recommendations.
- Shortcut handling updated to reflect runtime setting changes without requiring IDE restart.
- Fixed command line quoting issues when the configured VS Code executable path contains spaces.
- Improved user-facing error messages when the active tab is not a Delphi source editor.
- Improved stability around startup/registration flow by avoiding asynchronous menu registration races.
- Copilot with Delphi: this is the main reason the plugin exists. If you install the Copilot extension in Visual Studio Code, it works very well with Delphi code.
- Visual Studio Code is a much more capable text editor than the one built into RAD Studio for many editing tasks, for example multi-cursor editing and extension-based workflows.
Also take a look at DFMTextStabilizer.
It improves how Delphi serializes text .dfm files, making them much more readable and significantly more merge/diff friendly in team workflows.
In practice, this means fewer noisy conflicts, cleaner Git history, and better handling of non-ASCII text in forms.
Copilot is an AI assistant specialized in programming. Running it inside Visual Studio Code means it can understand your code, your comments, and the surrounding context, then suggest useful completions and edits.
Here are some screenshots of Copilot suggesting Delphi code.
Here it completes the TDaysOfTheWeek enum. The suggestion is the gray text: just press Tab to accept it.
Same for the TLanguages enum:
Here it suggests a whole function implementation:
You can also chat with Copilot about a selected portion of code and ask it to explain what it does:
This is only a small sample. You can also ask Copilot to modify code with prompts such as "use meaningful variable names", "refactor this function into smaller local functions", "add comments", or "write XML documentation for this class".
With code completion, Copilot suggests text while you type in the editor. With Copilot Chat, you write requests in plain language (for example "refactor this method", "explain this class", "add tests", or "apply this pattern to these files") and Copilot answers in the chat.
Agent mode is an extension of chat: instead of just answering with suggestions, Copilot can execute a complete coding task flow across the codebase. You describe the target result, and Copilot can inspect files, propose concrete edits, apply changes, and iterate with your feedback.
In short:
- You describe the objective in natural language.
- Copilot analyzes the current codebase.
- Copilot updates the relevant files.
- You test, review, and ask for refinements.
- Repeat until the feature is complete.
This new edition of the plugin was developed exactly this way.
All Delphi source changes since the previous commit were produced through chat-driven requests in Visual Studio Code. No manual edits were made directly in the Delphi source editor during this update cycle.
And if you are wondering: yes, even this paragraph was written by Copilot. The author simply asked Copilot in chat to add a section to this README.md file explaining what you can do with Copilot Chat and agent mode.
This is a practical example of using agent mode for full end-to-end maintenance:
- feature implementation
- refactoring
- bug fixing
- UX improvements
- documentation updates
- Download the source code from this repository.
- Open the package project, build it, and install it.
- Enable Delphi Code Insight in RAD Studio under Tools->Options->Editor->Language->Delphi->Code Insight. This is necessary for the Delphi LSP extension in Visual Studio Code to work correctly.
- Optional: disable the confirmation prompts shown when Delphi detects that a file unchanged in the IDE has changed on disk. This makes switching back from Visual Studio Code to Delphi much smoother, as long as you do not have unsaved edits pending in the RAD Studio editor.
- Download and install Visual Studio Code from https://code.visualstudio.com/download.
- Launch Visual Studio Code and install the DelphiLSP extension from the marketplace.
You will also need the Copilot extensions:
- Create a GitHub account if you do not already have one.
- Enable Copilot on your GitHub account by choosing a plan that fits your needs (for example Free, Pro, Business, or Enterprise, depending on current availability). You can manage this from your GitHub account settings under Copilot, or from the official Copilot pricing page. For individual developers, Copilot Pro is typically about 10 EUR/month (GitHub pricing is usually listed in USD, with local currency conversion by your payment method). In practical terms, Pro gives you unlimited usage of the included/basic models (which are capped in Copilot Free), plus access to more powerful reasoning models such as GPT-5.3-Codex, Claude Sonnet, and Gemini 2.5 Pro. Pro also includes a monthly bundle of premium requests, which is usually enough for regular daily use of chat and agent mode; those advanced reasoning models are not available in the Free plan.
- Back in Visual Studio Code, sign in with Copilot.
This makes Visual Studio Code save changes automatically, so when you switch back to Delphi you will already find the updated file on disk. If you also disabled the reload prompt in Delphi as suggested above, the workflow becomes much smoother.
Just remember that Delphi does not auto-save when you switch from Delphi to Visual Studio Code unless you launch Visual Studio Code through the Tools->Edit in Visual Studio Code menu command.
This is easy to enable: just check the option in the File menu.
By default, Visual Studio Code opens source files as UTF-8. Many Delphi codebases still contain source files encoded with a local ANSI 8-bit code page.
The plugin now configures this automatically in the generated workspace/folder settings by setting files.autoGuessEncoding to true when the key is missing.
In other words, for projects opened through this plugin you usually do not need to enable "Auto Guess Encoding" manually.
If you prefer to manage this globally, you can still search for "Auto Guess Encoding" in the Visual Studio Code settings and enable it yourself.
You can open the settings UI with Ctrl+, or by clicking the gear icon in the bottom-left corner of Visual Studio Code.
This is optional, but many people like it. With a ligature-supporting font such as Fira Code, typing ">=" can be rendered as "≥" and similar operator sequences are displayed more cleanly.
- Install the font from https://github.com/tonsky/FiraCode.
- Search for "Font Family" in Visual Studio Code settings and add
'Fira Code'at the beginning of the comma-separated list. - Search for "ligatures" in the settings UI. Choose the option to edit
settings.json, then add"editor.fontLigatures": trueto your configuration.











