The D Completion Daemon is an auto-complete program for the D programming language
Go to file
Hackerpilot c6c6b6e831 Move from build script to makefile 2014-08-03 23:08:32 +00:00
containers@74b3944049 Fix #12 2014-07-09 17:06:56 -07:00
conversion Fix autocompletion with alias this. Added struct constructor calltips to fix #113 2014-07-10 14:44:09 -07:00
editors Fix issue #135: 'Emacs temporary files cause DCD to crash'. dcd-server now ignores files starting with '.#' 2014-08-03 16:59:36 +02:00
installer/win Initial Windows installer 2013-09-12 00:49:48 -06:00
libdparse@d9387eb3b2 Use libdparse instead of dscanner 2014-06-26 12:44:51 -07:00
man1 Add containers submodule. Add man files 2014-05-09 00:33:32 -07:00
msgpack-d@1f0841a28a Converted DCD to the new DScanner 2014-01-14 01:02:02 +00:00
.gitignore Added documentation. Removed duplicated code from autocompletion module 2014-02-08 20:56:13 -08:00
.gitmodules Use libdparse instead of dscanner 2014-06-26 12:44:51 -07:00
License.txt Decided on GPL3 for the project 2013-07-19 16:09:34 -07:00
README.md Update README 2014-07-10 14:56:08 -07:00
actypes.d Fix autocompletion with alias this. Added struct constructor calltips to fix #113 2014-07-10 14:44:09 -07:00
autocomplete.d Get rid of extra logging 2014-08-03 23:08:19 +00:00
build.bat Update build.bat to be in sync with build.sh 2014-07-31 11:46:21 -03:00
build.sh Move from build script to makefile 2014-08-03 23:08:32 +00:00
client.d Fix issue #138: Make sure that RequestKind.addImport carries on analysing other kinds of request flags 2014-08-03 16:18:27 +02:00
constants.d Switch over to allocators from GC, dropping the memory usage by 70% 2014-05-09 00:35:35 -07:00
makefile Move from build script to makefile 2014-08-03 23:08:32 +00:00
messages.d Allow -I to appear with other options. Fix #134 2014-05-27 11:48:17 -07:00
modulecache.d Fix issue #135: 'Emacs temporary files cause DCD to crash'. dcd-server now ignores files starting with '.#' 2014-08-03 16:59:36 +02:00
semantic.d Fix bugs identified by unused variable warning 2014-05-10 03:03:21 -07:00
server.d Fix issue #138: Make sure that RequestKind.addImport carries on analysing other kinds of request flags 2014-08-03 16:18:27 +02:00
string_interning.d Update dscanner 2014-05-27 11:09:42 -07:00
stupidlog.d Added documentation. Removed duplicated code from autocompletion module 2014-02-08 20:56:13 -08:00
teaser.png Udated readme. Also added a change that was supposed to be in the last commit 2013-08-08 02:46:43 +00:00

README.md

#Overview The D Completion Daemon is an auto-complete program for the D programming language.

Teaser

(The above is a screenshot of Textadept)

DCD consists of a client and a server. The client (dcd-client) is used by a text editor script or from the command line. The server (dcd-server) is responsible for caching imported files, calculating autocomplete information, and sending it back to the client.

#Status This program is reasonably stable.

  • Working:
    • Autocompletion of properties of built-in types such as int, float, double, etc.
    • Autocompletion of __traits, scope, and extern arguments
    • Autocompletion of enums
    • Autocompletion of class, struct, and interface instances.
    • Display of call tips for functions, constructors, and variables of function type
    • alias declarations
    • Public imports
    • Finding the declaration location of a symbol at the cursor
    • import statement completions
    • Display of documentation comments in function call tips
    • alias this
  • Not working:
    • Automatic starting of the server by the client
    • UFCS
    • Autocompletion of declarations with template arguments
    • auto declarations
    • Determining the type of an enum member when no base type is specified, but the first member has an initialaizer
    • That one feature that you REALLY needed

#Setup

  1. Install a recent D compiler. DCD is tested with 2.065 and the 2.066 betas.
  2. Run git submodule update --init after cloning this repository to grab the MessagePack and Datapacked libraries and the parser from DScanner.
  3. run the build.sh script to build the client and server. (Or build.bat on Windows)
  4. Configure your text editor to call the dcd-client program. See the editors folder for directions on configuring your specific editor.
  5. Start the dcd-server program before editing code.

#Client

##Get autocomplete information The primary use case of the client is to query the server for autocomplete information. To do this, provide the client with the file that the user is editing along with the cursor position (in bytes).

dcd-client -c123 sourcefile.d

This will cause the client to print a listing of completions to stdout. The client will print either a listing of function call tips, or a listing of of completions depending on if the cursor was directly after a dot character or after a left parethesis.

The file name is optional. If it is not specified, input will be read from stdin.

###Dot completion When the first line of output is "identifiers", the editor should display a completion list. ####Output format A line containing the string "identifiers" followed by the completions that are available, one per line. Each line consists of the completion name followed by a tab character, followed by a completion kind #####Completion kinds

  • c - class name
  • i - interface name
  • s - struct name
  • u - union name
  • v - variable name
  • m - member variable name
  • k - keyword, built-in version, scope statement
  • f - function or method
  • g - enum name
  • e - enum member
  • P - package name
  • M - module name
  • a - array
  • A - associative array
  • l - alias name
  • t - template name
  • T - mixin template name

####Example output identifiers parts v name v location v qualifier v kind v type v resolvedType v calltip v getPartByName f

####Note DCD's output will start with "identifiers" when completing at a left paren character if the keywords pragma, scope, __traits, extern, or version were just before the paren.

###Parenthesis completion When the first line of output is "calltips", the editor should display a function call tip. #####Output format A line containing the string "calltips", followed by zero or more lines, each containing a call tip for an overload of the given function. #####Example output calltips ACSymbol findSymbolInCurrentScope(size_t cursorPosition, string name)

Doc comment display

dcd-client --doc -c 4298 When run with the --doc or -d option, DCD will attempt to display documentation comments associated with the symbol at the cursor position. In the case of functions there can be more than one documentation comment associated with a symbol. One doc comment will be printed per line. Newlines within the doc comments will be replaced with "\n". ####Example output An example doc comment\nParams: a = first param\n Returns: nothing An example doc comment\nParams: a = first param\n b = second param\n Returns: nothing

##Clear server's autocomplete cache dcd-client --clearCache

##Add import search path Import paths can be added to the server without restarting it. To accomplish this, run the client with the -I option:

dcd-client -Ipath/to/imports

##Find declaration of symbol at cursor dcd-client --symbolLocation -c 123

The "--symbolLocation" or "-l" flags cause the client to instruct the server to return the path to the file and the byte offset of the declaration of the symbol at the given cursor position.

The output consists of the absolute path to the file followed by a tab character followed by the byte offset, followed by a newline character. For example:

/home/example/src/project/bar.d	3482

#Server The server must be running for the DCD client to provide autocomplete information. In future versions the client may start the server if it is not running, but for now it must be started manually.

Configuration Files

The server will attempt to read the file ~/.config/dcd on Posix systems, or dcd.conf on Windows in the current working directory on startup. If it exists, each line of the file is interpreted as a path that should be searched when looking for module imports.

##Shut down the server The server can be shut down by running the client with the correct option:

dcd-client --shutdown

Import directories

Import directories can be specified on the command line at startup:

dcd-server -I/home/user/code/one -I/home/user/code/two

Port number

The --port or -p option lets you specify the port number that the server will listen on.