4D Blog

Home Product Debugging 4D Code Directly in Visual Studio Code

Debugging 4D Code Directly in Visual Studio Code

January 23, 2025

Product

For Visual Studio Code users working with 4D, a new extension called 4D-Debugger that works with 4D 20 R8 is now available.

The new 4D-Debugger extension brings powerful new debugging capabilities to Visual Studio Code, expanding on the features of the 4D-Analyzer introduced earlier. With this extension, you can set breakpoints, step through 4D code, and inspect variables from the Visual Studio Code interface. This tool integrates seamlessly, simplifying the debugging process and making VS Code a more versatile workspace for 4D projects.

Getting Started

To start, install the 4D-Debugger extension from the VS Code marketplace. Ensure you have a 4D Server on your machine, as this is needed to launch and debug your project. Define configurations in the .vscode/launch.json file to specify how you connect to the 4D server. If no configuration is set, you can attach it to a started server using the default debugger port.

How to debug

Open the method file you want to debug in VS Code, and set breakpoints by clicking next to the line numbers.

 

Start the debugging session using “Launch and Run” or “Attach and Run”  from VS Code’s Debug menu:

  • The “Attach and Run” menu attempts to attach the debugger to the running 4D server. If the debugger is already attached elsewhere, you must detach it first. Once the debugger has been attached, the current method is launched in a dedicated worker called “Remote Debugger Console”.
  • The “Launch and Run” menu starts the 4D server configured in .vscode/launch.json and attaches the debugger to the VS code. Once the debugger has been attached.

 

If you want to debug your server code only when an error occurs in your code, use the “Attach” or “Launch” menu.

During the session, code execution will pause at your defined breakpoints, allowing you to inspect variables and step through the code:

blank

You can access local, process variables with real-time values in the inspector, monitor some variables with the watcher or test expressions in the console :

You can find more information about the VS Code debugger and its functionality in the VS Code documentation.

Give It a Try!

Ready to explore? Download the 4D Debugger extension, configure your debugging setup, and experience the streamlined, integrated debugging process directly within Visual Studio Code.

For those who don’t use Visual Studio Code, the 4D debugger hasn’t been left behind. It features a fresh new design and additional functionalities. Check out the updates in the Enhancing the Debugging Experience blog post.

 

Discuss

Tags 20 R8, 21, Debugger, vscode

Latest related posts

  • July 18, 2025

    Embed deployment license automatically into your applications

  • July 17, 2025

    New Class to Perform UDP Communications

  • July 17, 2025

    Managing Calendar Events with Microsoft 365 or Google in 4D: Create, Update, Delete

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R9 20 R10 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R9 20 R10 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy