Last update March 7, 2012

Editor Support /

natively supports syntax highlighting for D

written in Java (runs on MacOS X, OS/2, Unix, VMS and Windows)

built-in macro language, extensible plugin architecture, dozens of macros and plugins available

Here are some setup tips to turn jEdit into an IDE for D, complete with class browser and auto-completion.

First, in the Plugin Manager, install the following plugins (if you find some more useful plugins for D, add them here):

  • Buffer List
  • Buffer Tabs
  • Console
  • Ctags Sidekick
  • Error List
  • Project Viewer
  • Switch Buffer
Buffer List, Buffer Tabs, and Switch Buffer offer a convenient way to manage and switch between multiple source files, and Project Viewer offers general project management. These are just nice plugins to have and don't really offer anything specific to D. There are lots of other nice plugins which make jEdit an ideal programmer's editor.

The two plugins that offer the most functionality for D (with some setup as explained below) are Console (which will use the Error List plugin) and Ctags Sidekick. Open the jEdit Plugin Manager, mark and install Console, Error List, and Ctags Sidekick (and any others you want). After these are installed, complete the setup instructions below.

Console allows you to invoke the compiler, and will automatically display resulting errors in the Error List window, highlighting the source files where the errors occur, and clicking on an error will jump to that file and location. To set up the Console plugin to work with D, you need a couple of simple xml files, placed in the console\commando folder in the jEdit user settings folder (this is ~/.jedit under linux and {USER HOME}?\.jedit under Windows, where {USER HOME}? is the top-level folder under "C:\Documents and Settings" for the current user, e.g. "C:\Documents and Setting\hansolo"). After the Console plugin has been installed, within the .jedit settings folder there will now be a "console" folder, and within that folder will be a "commando" folder, which should be empty. Download this file and unzip the contents into the commando folder. Console comes with several compilers pre-defined, but D is not one of them. These 3 files define compilers commands for Console which invoke dmd, bud, and rebuild (to add another, simply rename and edit one of the files and change the command towards the end -- it should be obvious from the context).

Next, open the Plugin Options window and select "Compile & Run" under Console options. Scroll down the Mode list until you find D, and pick one of the 3 new compiler commands from the Compiler drop-down list. Then select Error Patterns in the Console options tree. Click the "+" button to add a new parser, and call it "D". In the Error Regexp field, enter:

For the Extra Lines Regexp enter:
And for Filename, Line Number, and Error Message, enter "$1", "$2", and "$3" respectively (without the quotes). Finally, in the Test Area, enter:
hello.d(6): found '}' when expecting ';' 
  and some other message lines
  and more
and then click Test/Commit. You should get an a message box correctly identifying the filename, line number, error message, and extra lines. The message box will separate the filename from the line number with a colon, and separate the line number from the error message with another colon. The extra lines will be displayed underneath the file:line:error portion. If you get a message box that says "No matches", there is a mistake in your regexp somewhere.

While still in the Plugin Options window, select Ctags Sidekick, and for the command enter "dtags". Download and unzip it to your dmd/bin directory, which should be in your path. This is a special ctags executable for Windows, built using the ctags 5.7 source and patched using this file (linux users should compile their own from the ctags source after applying the patch). NOTE: Do not use the version of ctags with D support built for the Zeus editor (called "xtags"), because it crashes when called from jEdit.

Also in the Plugin Options, select Error List and check "Automatically display on error." And under Sidekick, select Parser and make sure that "ctags" is selected for the D Mode.

The D syntax file supplied with jEdit is mostly complete. Here is a more up-to-date syntax file which includes keywords added in more recent D releases. Extract the "d.xml" file from the zip file and put it into the "modes" folder of the jEdit installation. Note that this is for D 1.x, not 2.x. If you happen to create a D 2.x syntax file, please upload it.

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 7, 2012 20:29 (diff))