Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Quick tour of Visual D

Global options

When starting Visual Studio for the first time after installation of Visual D, you might want to check the global settings that can be reached from the Menu Tools -> Options -> Projects:

Global tool options

  • DMD Install path: The path to DMD you entered within the installer.
  • Executable paths: Directories to be added to the PATH environment variable before executing build commands.
  • Import paths: Directories to be added to the import paths specified in the project configuration and specified in the DMD configuration file (currently only used import statement completion and finding symbol definition).
  • Library paths: Directories to be added to the LIB environment variable before executing build commands.
  • JSON paths: Directories to search for *.json files to find symbol definitions.
  • Resource includes: include paths to pass to the resource compiler when building resource files.

Available text replacements:

  • $(DMDINSTALLDIR): DMD Install path
  • $(WINDOWSSDKDIR): Windows SDK Directory
  • $(DEVENVDIR): Directory of Visual Studio executable devenv.exe
  • $(VSINSTALLDIR): Root directory of Visual Studio installation
  • $(VISUALDINSTALLDIR): Installation folder of Visual D
  • any variable from the system environment enclose in $()

Please note that there is also a new entry "D" in the Text Editor branch. Not all of its settings are implemented yet.

New Project

To create a new Project, navigate to the menu File -> New -> Project and select the "D" entry in the "Other Languages" branch. There are 4 predefined templates to select from.

New project creation

Project and editor

You might want to check the following features:

  • syntax highlighting supports all sorts of D2 style strings
  • simple word-completion will show identifiers in the vicinity of the caret from the same buffer (default short-cut Ctrl-Space)
  • import statement completion: pressing Ctrl-Space in an import statement will complete the token from the files and folders available in the import directories

Screenshot import completion

  • goto definition (default short-cut F12) takes information from compiler generated JSON files. A successful build with JSON output enabled is necessary for this function. JSON files can also be precompiled and placed into the directories given in the global options.
  • smart indentation will indent nicely after pressing Return. Formatting the selection (default shortcut Alt-F8) does not yet work perfectly.
  • highlight/jump-to matching braces (default shortcut Ctrl-ยด)
  • code snippets: let's you select from a list of snippets, some of them allowing token replacements (default shortcut Ctrl-K Ctrl-X)
  • parameter info tooltips (default short-cut Ctrl-Shift-Space) showing function prototype and highlighting current position in argument list. As with "goto definition" this feature relies on JSON files being generated.

Parameter info tooltip

Project configuration

The project configuration is similar to what you know from other languages:

Screenshot Global Options

Available macro replacements enclosed in $():

  • DMDINSTALLDIR: DMD Install path
  • WINDOWSSDKDIR: Windows SDK Directory
  • DEVENVDIR: Directory of Visual Studio executable devenv.exe
  • VSINSTALLDIR: Root directory of Visual Studio installation
  • VISUALDINSTALLDIR: Installation folder of Visual D
  • PLATFORMNAME: always Win32
  • CONFIGURATIONNAME
  • OUTDIR: Ouptut path
  • INTDIR: Intermediate path
  • INPUTPATH/DIR/FILENAME/EXT/NAME: input file/project file components
  • PROJECTPATH/DIR/FILENAME/EXT/NAME: project file components
  • SOLUTIONPATH/DIR/FILENAME/EXT/NAME: solution file components
  • TARGETPATH/DIR/FILENAME/EXT/NAME: target file components
  • any variable from the system environment

Debugging

Thanks to cv2pdb, debugging in Visual Studio integrates well. Here is an example debugging session

Exmple debug session

Attachments

  • project_config.png (17.8 kB) -Screenshot Global Options, added by sagitario on 04/14/10 22:41:32.
  • toolopt_project.png (22.2 kB) -Global tool options, added by sagitario on 04/14/10 22:42:35.
  • completion.png (62.4 kB) -Screenshot import completion, added by sagitario on 04/14/10 22:43:18.
  • newproject.png (23.1 kB) -New project creation, added by sagitario on 04/18/10 12:59:32.
  • parameterinfo.png (6.5 kB) -Parameter info tooltip, added by sagitario on 05/08/10 13:18:33.
  • debug.png (84.1 kB) -Exmple debug session, added by sagitario on 05/08/10 13:27:15.
  • dlogo.png (19.6 kB) -Visual D Logo, added by sagitario on 05/29/10 07:22:15.
  • download.png (2.8 kB) -Download Visual D, added by Anonymous on 05/29/10 14:46:06.