Document --search option in readme and add version number option
This commit is contained in:
parent
f9e93b096a
commit
9434629416
66
README.md
66
README.md
|
@ -1,4 +1,4 @@
|
||||||
#Overview
|
# Overview
|
||||||
The D Completion Daemon is an auto-complete program for the D programming language.
|
The D Completion Daemon is an auto-complete program for the D programming language.
|
||||||
|
|
||||||

|

|
||||||
|
@ -13,7 +13,7 @@ used through a text editor script or plugin, though it can be used from the
|
||||||
command line. The server (dcd-server) is responsible for caching imported files,
|
command line. The server (dcd-server) is responsible for caching imported files,
|
||||||
calculating autocomplete information, and sending it back to the client.
|
calculating autocomplete information, and sending it back to the client.
|
||||||
|
|
||||||
#Status
|
# Status
|
||||||
This program is reasonably stable. Please report problems on the Github issue
|
This program is reasonably stable. Please report problems on the Github issue
|
||||||
tracker. Please be sure that you have read the documentation before filing an
|
tracker. Please be sure that you have read the documentation before filing an
|
||||||
issue.
|
issue.
|
||||||
|
@ -31,25 +31,25 @@ issue.
|
||||||
* Display of documentation comments in function call tips
|
* Display of documentation comments in function call tips
|
||||||
* *alias this*
|
* *alias this*
|
||||||
* *auto* declarations (Mostly)
|
* *auto* declarations (Mostly)
|
||||||
|
* *with* statements
|
||||||
* Not working:
|
* Not working:
|
||||||
* Automatic starting of the server by the client
|
|
||||||
* UFCS suggestions
|
* UFCS suggestions
|
||||||
* Autocompletion of declarations with template arguments (This will work to some extent, but it won't do things like replace T with int)
|
* Autocompletion of declarations with template arguments (This will work to some extent, but it won't do things like replace T with int)
|
||||||
* Determining the type of an enum member when no base type is specified, but the first member has an initialaizer
|
* 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
|
* That one feature that you *REALLY* needed
|
||||||
|
|
||||||
#Setup
|
# Setup
|
||||||
1. Install a recent D compiler. DCD is tested with 2.066 and LDC 0.14.0.
|
1. Install a recent D compiler. DCD is tested with 2.066 and LDC 0.14.0.
|
||||||
1. Run ```git submodule update --init``` after cloning this repository to grab the MessagePack and Datapacked libraries and the parser from DScanner.
|
1. Run ```git submodule update --init``` after cloning this repository to grab the MessagePack and Datapacked libraries and the parser from DScanner.
|
||||||
1. Run ```make``` to build the client and server. (Or run build.bat on Windows). ```make ldc``` and ```make gdc``` will use the LDC or GDC compilers. The resulting executable will be much faster.
|
1. Run ```make``` to build the client and server. (Or run build.bat on Windows). ```make ldc``` and ```make gdc``` will use the LDC or GDC compilers. The resulting executable will be much faster.
|
||||||
1. Configure your text editor to call the dcd-client program. See the *editors* folder for directions on configuring your specific editor.
|
1. Configure your text editor to call the dcd-client program. See the *editors* folder for directions on configuring your specific editor.
|
||||||
1. Start the dcd-server program before editing code. (Unless, of course, your editor's plugin handles this for you)
|
1. Start the dcd-server program before editing code. (Unless, of course, your editor's plugin handles this for you)
|
||||||
|
|
||||||
#Client
|
# Client
|
||||||
Because DCD is designed to be used from a text editor, this section is written
|
Because DCD is designed to be used from a text editor, this section is written
|
||||||
primarily for plugin authors.
|
primarily for plugin authors.
|
||||||
|
|
||||||
##Get autocomplete information
|
## Get autocomplete information
|
||||||
The primary use case of the client is to query the server for 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
|
To do this, provide the client with the file that the user is editing along with the
|
||||||
cursor position (in bytes).
|
cursor position (in bytes).
|
||||||
|
@ -63,14 +63,14 @@ a left parethesis.
|
||||||
|
|
||||||
The file name is optional. If it is not specified, input will be read from *stdin*.
|
The file name is optional. If it is not specified, input will be read from *stdin*.
|
||||||
|
|
||||||
###Dot completion
|
### Dot completion
|
||||||
When the first line of output is "identifiers", the editor should display a
|
When the first line of output is "identifiers", the editor should display a
|
||||||
completion list.
|
completion list.
|
||||||
####Output format
|
#### Output format
|
||||||
A line containing the string "identifiers" followed by the completions that are
|
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
|
available, one per line. Each line consists of the completion name followed by a
|
||||||
tab character, followed by a completion kind
|
tab character, followed by a completion kind
|
||||||
#####Completion kinds
|
##### Completion kinds
|
||||||
* c - class name
|
* c - class name
|
||||||
* i - interface name
|
* i - interface name
|
||||||
* s - struct name
|
* s - struct name
|
||||||
|
@ -89,7 +89,7 @@ tab character, followed by a completion kind
|
||||||
* t - template name
|
* t - template name
|
||||||
* T - mixin template name
|
* T - mixin template name
|
||||||
|
|
||||||
####Example output
|
#### Example output
|
||||||
identifiers
|
identifiers
|
||||||
parts v
|
parts v
|
||||||
name v
|
name v
|
||||||
|
@ -101,18 +101,18 @@ tab character, followed by a completion kind
|
||||||
calltip v
|
calltip v
|
||||||
getPartByName f
|
getPartByName f
|
||||||
|
|
||||||
####Note
|
#### Note
|
||||||
DCD's output will start with "identifiers" when completing at a left paren
|
DCD's output will start with "identifiers" when completing at a left paren
|
||||||
character if the keywords *pragma*, *scope*, *__traits*, *extern*, or *version*
|
character if the keywords *pragma*, *scope*, *__traits*, *extern*, or *version*
|
||||||
were just before the paren.
|
were just before the paren.
|
||||||
|
|
||||||
###Parenthesis completion
|
### Parenthesis completion
|
||||||
When the first line of output is "calltips", the editor should display a function
|
When the first line of output is "calltips", the editor should display a function
|
||||||
call tip.
|
call tip.
|
||||||
#####Output format
|
##### Output format
|
||||||
A line containing the string "calltips", followed by zero or more lines, each
|
A line containing the string "calltips", followed by zero or more lines, each
|
||||||
containing a call tip for an overload of the given function.
|
containing a call tip for an overload of the given function.
|
||||||
#####Example output
|
##### Example output
|
||||||
calltips
|
calltips
|
||||||
ACSymbol findSymbolInCurrentScope(size_t cursorPosition, string name)
|
ACSymbol findSymbolInCurrentScope(size_t cursorPosition, string name)
|
||||||
|
|
||||||
|
@ -123,21 +123,21 @@ 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
|
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
|
symbol. One doc comment will be printed per line. Newlines within the doc
|
||||||
comments will be replaced with "\n".
|
comments will be replaced with "\n".
|
||||||
####Example output
|
#### Example output
|
||||||
An example doc comment\nParams: a = first param\n Returns: nothing
|
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
|
An example doc comment\nParams: a = first param\n b = second param\n Returns: nothing
|
||||||
|
|
||||||
##Clear server's autocomplete cache
|
## Clear server's autocomplete cache
|
||||||
```dcd-client --clearCache```
|
```dcd-client --clearCache```
|
||||||
|
|
||||||
##Add import search path
|
## Add import search path
|
||||||
Import paths can be added to the server without restarting it. To accomplish
|
Import paths can be added to the server without restarting it. To accomplish
|
||||||
this, run the client with the -I option:
|
this, run the client with the -I option:
|
||||||
|
|
||||||
dcd-client -Ipath/to/imports
|
dcd-client -Ipath/to/imports
|
||||||
|
|
||||||
|
|
||||||
##Find declaration of symbol at cursor
|
## Find declaration of symbol at cursor
|
||||||
```dcd-client --symbolLocation -c 123```
|
```dcd-client --symbolLocation -c 123```
|
||||||
|
|
||||||
The "--symbolLocation" or "-l" flags cause the client to instruct the server
|
The "--symbolLocation" or "-l" flags cause the client to instruct the server
|
||||||
|
@ -149,6 +149,36 @@ followed by the byte offset, followed by a newline character. For example:
|
||||||
|
|
||||||
/home/example/src/project/bar.d 3482
|
/home/example/src/project/bar.d 3482
|
||||||
|
|
||||||
|
## Search for symbols by name
|
||||||
|
|
||||||
|
The "--search" or "-s" option causes the server to return location information
|
||||||
|
for all symbols with the given name in both the file being edited as well as
|
||||||
|
the server cache. The output format is one result per line, with the path, the
|
||||||
|
symbol type, and the byte offset of the symbol separated by tab characters.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Search the server's cache for symbols named "toImpl". (Using echo to give an EOF
|
||||||
|
in place of a file being edited.)
|
||||||
|
```echo | dcd-client --search toImpl``
|
||||||
|
|
||||||
|
```
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 48491
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 47527
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 47229
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 40358
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 38348
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 35619
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 32743
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 22486
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 16322
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 14829
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 14066
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 13058
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 12717
|
||||||
|
/usr/include/dmd/phobos/std/conv.d f 9494
|
||||||
|
```
|
||||||
|
|
||||||
#Server
|
#Server
|
||||||
The server must be running for the DCD client to provide autocomplete information.
|
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
|
In future versions the client may start the server if it is not running, but for
|
||||||
|
|
2
makefile
2
makefile
|
@ -21,6 +21,7 @@ clean:
|
||||||
CLIENT_SRC = src/client.d\
|
CLIENT_SRC = src/client.d\
|
||||||
src/messages.d\
|
src/messages.d\
|
||||||
src/stupidlog.d\
|
src/stupidlog.d\
|
||||||
|
src/dcd_version.d\
|
||||||
msgpack-d/src/msgpack.d
|
msgpack-d/src/msgpack.d
|
||||||
|
|
||||||
DMD_CLIENT_FLAGS = -Imsgpack-d/src\
|
DMD_CLIENT_FLAGS = -Imsgpack-d/src\
|
||||||
|
@ -57,6 +58,7 @@ SERVER_SRC = src/actypes.d\
|
||||||
src/server.d\
|
src/server.d\
|
||||||
src/stupidlog.d\
|
src/stupidlog.d\
|
||||||
src/string_interning.d\
|
src/string_interning.d\
|
||||||
|
src/dcd_version.d\
|
||||||
libdparse/src/std/d/ast.d\
|
libdparse/src/std/d/ast.d\
|
||||||
libdparse/src/std/d/entities.d\
|
libdparse/src/std/d/entities.d\
|
||||||
libdparse/src/std/d/lexer.d\
|
libdparse/src/std/d/lexer.d\
|
||||||
|
|
18
src/client.d
18
src/client.d
|
@ -32,6 +32,7 @@ import std.string;
|
||||||
import msgpack;
|
import msgpack;
|
||||||
import messages;
|
import messages;
|
||||||
import stupidlog;
|
import stupidlog;
|
||||||
|
import dcd_version;
|
||||||
|
|
||||||
int main(string[] args)
|
int main(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,7 @@ int main(string[] args)
|
||||||
bool symbolLocation;
|
bool symbolLocation;
|
||||||
bool doc;
|
bool doc;
|
||||||
bool query;
|
bool query;
|
||||||
|
bool printVersion;
|
||||||
string search;
|
string search;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -51,7 +53,8 @@ int main(string[] args)
|
||||||
getopt(args, "cursorPos|c", &cursorPos, "I", &importPaths,
|
getopt(args, "cursorPos|c", &cursorPos, "I", &importPaths,
|
||||||
"port|p", &port, "help|h", &help, "shutdown", &shutdown,
|
"port|p", &port, "help|h", &help, "shutdown", &shutdown,
|
||||||
"clearCache", &clearCache, "symbolLocation|l", &symbolLocation,
|
"clearCache", &clearCache, "symbolLocation|l", &symbolLocation,
|
||||||
"doc|d", &doc, "query|q", &query, "search|s", &search);
|
"doc|d", &doc, "query|q", &query, "search|s", &search,
|
||||||
|
"version", &printVersion);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +64,13 @@ int main(string[] args)
|
||||||
|
|
||||||
AutocompleteRequest request;
|
AutocompleteRequest request;
|
||||||
|
|
||||||
if (help)
|
|
||||||
|
if (printVersion)
|
||||||
|
{
|
||||||
|
writeln(DCD_VERSION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (help)
|
||||||
{
|
{
|
||||||
printHelp(args[0]);
|
printHelp(args[0]);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -227,10 +236,13 @@ Options:
|
||||||
Query the server statis. Returns 0 if the server is running. Returns
|
Query the server statis. Returns 0 if the server is running. Returns
|
||||||
1 if the server could not be contacted.
|
1 if the server could not be contacted.
|
||||||
|
|
||||||
-IPATH
|
-I PATH
|
||||||
Instructs the server to add PATH to its list of paths searced for
|
Instructs the server to add PATH to its list of paths searced for
|
||||||
imported modules.
|
imported modules.
|
||||||
|
|
||||||
|
--version
|
||||||
|
Prints the version number and then exits.
|
||||||
|
|
||||||
--port PORTNUMBER | -p PORTNUMBER
|
--port PORTNUMBER | -p PORTNUMBER
|
||||||
Uses PORTNUMBER to communicate with the server instead of the default
|
Uses PORTNUMBER to communicate with the server instead of the default
|
||||||
port 9166.`, programName);
|
port 9166.`, programName);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**
|
||||||
|
* This file is part of DCD, a development tool for the D programming language.
|
||||||
|
* Copyright (C) 2014 Brian Schott
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module dcd_version;
|
||||||
|
|
||||||
|
enum DCD_VERSION = "v0.4.0-beta2";
|
22
src/server.d
22
src/server.d
|
@ -40,6 +40,7 @@ import modulecache;
|
||||||
import stupidlog;
|
import stupidlog;
|
||||||
import actypes;
|
import actypes;
|
||||||
import core.memory;
|
import core.memory;
|
||||||
|
import dcd_version;
|
||||||
|
|
||||||
enum CONFIG_FILE_NAME = "dcd.conf";
|
enum CONFIG_FILE_NAME = "dcd.conf";
|
||||||
|
|
||||||
|
@ -58,11 +59,13 @@ int main(string[] args)
|
||||||
|
|
||||||
ushort port = 9166;
|
ushort port = 9166;
|
||||||
bool help;
|
bool help;
|
||||||
|
bool printVersion;
|
||||||
string[] importPaths;
|
string[] importPaths;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getopt(args, "port|p", &port, "I", &importPaths, "help|h", &help);
|
getopt(args, "port|p", &port, "I", &importPaths, "help|h", &help,
|
||||||
|
"version", & printVersion);
|
||||||
}
|
}
|
||||||
catch (ConvException e)
|
catch (ConvException e)
|
||||||
{
|
{
|
||||||
|
@ -71,6 +74,12 @@ int main(string[] args)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (printVersion)
|
||||||
|
{
|
||||||
|
writeln(DCD_VERSION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (help)
|
if (help)
|
||||||
{
|
{
|
||||||
printHelp(args[0]);
|
printHelp(args[0]);
|
||||||
|
@ -277,8 +286,15 @@ void printHelp(string programName)
|
||||||
Usage: %s options
|
Usage: %s options
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-I path
|
-I PATH
|
||||||
Includes path in the listing of paths that are searched for file imports
|
Includes PATH in the listing of paths that are searched for file
|
||||||
|
imports.
|
||||||
|
|
||||||
|
--help | -h
|
||||||
|
Prints this help message.
|
||||||
|
|
||||||
|
--version
|
||||||
|
Prints the version number and then exits.
|
||||||
|
|
||||||
--port PORTNUMBER | -pPORTNUMBER
|
--port PORTNUMBER | -pPORTNUMBER
|
||||||
Listens on PORTNUMBER instead of the default port 9166.`, programName);
|
Listens on PORTNUMBER instead of the default port 9166.`, programName);
|
||||||
|
|
Loading…
Reference in New Issue