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

Language support in the editor

Syntax Highlighting

  • syntax highlighting supports all sorts of D2 style strings.

source:wiki/strings.png

  • statements disabled by version or debug conditionals are displayed in a slightly different color. Debug and version identifiers and levels can be defined in the same source file or in the current project configuration. The compiler predefined version identifiers are also recognized.

source:wiki/versionhighlight.png

  • code in token string literals are highlighted in another slightly different color than regular code.
  • highlighting colors can be setup in the "Fonts and Colors" page found in the Tools->Options Dialog. In addition to the regular colors, you'll find "Visual D Disabled ..." colors for the code disabled through version statements and "Visual D Token String ..." colors for the code in token strings.
  • underlining of syntax errors (no semantic analysis done)

source:wiki/syntaxerror.png

The colorizer can be configured in the "Colorizer" setup page of the language settings in Tools->Options->Text Editor->D->Colorizer:

source:wiki/editor-options.png

User defined types have there own color settings. You can also manipulate other identifiers by assigning them a different color category: if prefixed with one of the section names, they will be highlighted accordingly. The available color categories are:

  • [Keyword] color used by all languages
  • [Comment] color used by all languages
  • [Identifier] color used by all languages
  • [String] color used by all languages
  • [Number] color used by all languages
  • [Text] any other text not falling into the other categories (color used by all languages)
  • [Operator] Visual D specific operators
  • [Register] Visual D specific registers in inline assembler
  • [Mnemonic] Visual D specific mnemonics in inline assembler
  • [Type] Visual D specific user specified identifiers
  • [Version] predefined version identifiers

Without any section given, [Type] is assumed. Here's an example how to map "string" to keyword coloring:

[Keyword]
string

More features

You might want to check the following features:

  • simple word-completion will show identifiers in the vicinity of the caret from the same buffer (default short-cut Ctrl-Space). If you press the short-cut again, identifiers from JSON files are also displayed.
  • import statement completion: pressing Ctrl-Space in an import statement will complete the token from the files and folders available in the import directories.

source:wiki/import_completion.png

  • 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. If there are multiple definitions for the identifier at the caret position, the Search Window will show up.
  • smart indentation will indent nicely after pressing Return.
  • comment/uncomment a selection of lines
  • 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). You can also insert code-snippets by writing its shortcut, then pressing the key for command "Edit.InvokeSnippetFromShortcut". For example, shortcut "for" yields

source:wiki/codesnippet.png

  • 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.

source:wiki/parameterinfo.png

  • show scope in status line: to avoid navigating through a larger file to figure out what class the current function belongs to, command "VisualD.ShowScope" displays the class, function, etc. at the caret position:

source:wiki/showscope.png

This command is also accessible from the Visual D menu, but it is best to assign it to some keyboard shortcut.

  • Outlining of curly braced declarations and statements and multi-line comments

source:wiki/outlining.png

Automatic outlining can be disabled on the global configuration page "Tools->Options->Text Editor->D->Colorizer". Using command "Outlining->Collapse to Definitions" will enable it for the current text buffer.

  • show the clipboard ring in a context menu to paste from. This operation is invoked by the "Edit->Cycle Clipboard Ring" command.

source:wiki/pastemenu.PNG