IntelliJ D Language

Support for the D programming language within IntelliJ IDEA.

Download and install IntelliJ Community Edition (Free) or Ultimate (Paid) From IntelliJ go to Settings > Plugins > Browse Repositories and search For "D Language" - you will see 2 plugins - Choose the DLanguage one and click install and then click restart intellij

You can also download the plugin jar to your local disk here: Jetbrains plugin repository and then in intelliJ go to Settings > Plugins > Install plugin from disk and choose the jar you downloaded


Quick Usage

Open existing DUB project

  • File -> Open then choose your existing dub project folder
  • After the project loads - right click on the module (first item in the project tree on left pane) and choose Module Settings (f4)
  • In Module Setting - in the right pane in the Sources tab - locate the source directory in the tree and click it - and then click the blue sources folder at the top of the pane where it says Mark as
  • That will mark the source folder as a Source folder in intellij - and it will go blue - now intellij know where to find the source code for your dub module and you can use the run configurations now

New Project with DUB

  • When you select this to create a new project with dub - if dub is on your path it will attempt to use dub init to create a new dub project for you. If dub is not on your path it will create a source directory and you will have to create your sdl/json dub file manually or rename/delete the source folder and then use dub init to recreate it
  • Or you can open an existing dub project by doing File -> Open
  • Once a dub project is loaded there is right click menu option to run with dub, or you can use the run config - run with Dub
  • Before running go and configure the DTools in Settings -> Languages & Frameworks -> D Tools

Configure DTools

The best option is to do and get the following tools:

If you put these tools on your path you can go to Settings -> Languages & Frameworks -> D Tools and just click "Auto Find" on each of the tools and it will find them. Otherwise you will need to select the correct path to the tool for each one.

Configuring DCD

On MacOS and Windows the path to Phobos and DRuntime is inferred by the D SDK path. Dub dependencies can be passed to DCD by pressing the menu item "Tools -> Process D Libraries". Additional libraries can b passed to DCD by providing a comma separated list of paths in the dcd-server flags field.

On Linux you have to pass Phobos and DRuntime paths to DCD:


This will add the phobos and druntime/import as well as add the p rainbow project.

DCD Server Restart Action

I noticed that after a while the auto completion seemed to cause the editor to hang. As a first step I have added a menu action in Tools as the last option to Restart the DCD Server. This action will just kill the running process and restart it again which seems to fix the hanging issue. I will investigate further to find a way to prevent the hanging in the first place but this is a helpful restart action.


To reformat D code use the shortcut or the menu item - Code -> Reformat Code with D Format (ctrl+alt+K) or on mac (cmd+alt+K)


To apply DFix to the a file use the shortcut or the menu item - Code -> Fix D code with DFi (ctrl+alt+M) or on mac (cmd+alt+M)

Syntax Highlighting

Go to Settings -> Editor -> Colors and Fonts -> D File

You can customize the syntax highlighting colours here. Save as a new theme - and then untick the inherit from checkbox and this will allow you to choose a colour for each item. Only the native items will show as changing in the code example. From function definition downwards the options are related to annotated highlighting which is based on the grammar and not the lexer. So these don't show as chanigng the code example but they do wok. I created one similar to the sublime dark theme by using Darcula theme and customizing the colours here.


On MacOS and Linux debugging is possible using GDB. Enter in Settings -> Languages & Frameworks -> D Tools -> GDB the path to the gdb executable.

On Windows debugging of executables is possible using Mago-Mi. The latest version of Mago-Mi you can find on AppVeyor. To debug x86_64 applications you need also MagoRemote.exe and a regedit key "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MagoDebugger" with a value "Remote_x64" containing path to "MagoRemote.exe" e.g. "C:\Program Files (x86)\VisualD\Mago\MagoRemote.exe".

In addition it is also possible to use Windows Subsystem for Linux to compile from Windows Linux binaries and debug them using gdb which also runs on WSL. Due to a bug in WSL you need Windows 10 1803 or later. Create a file called dubwsl.bat with content:
wsl dub

and a file gdbwsl.bat with content:
wsl gdb

Set as dub path the filepath to dubwsl.bat and as gdb path the path to gdbwsl.bat. On your WSL linux file system DMD and GDB needs to be installed.

Language Server Protocol

The functionality of IntelliJ D plugin can be enhanced with language servers for D. For functionality Dls provides have a look here Dls
Install plugin "LSP Support" from IntelliJ marketplace.

Install Dls using this command
dub fetch dls
dub run dls:bootstrap

The second command will output the path to the executable you have to set in settings of plugin "LSP Support".
In settings "Languages & Frameworks -> Language Server Protocol -> Server Definitions" add an entry "Executable" with extension "d" and the path which you got from Dls.

In settings "Languages & Frameworks -> Language Server Protocol -> Timeouts" set "Init" value to "60000".