Documentation is almost usable now
This commit is contained in:
parent
974d3dc3ba
commit
e3fba24b7d
74
README.md
74
README.md
|
@ -28,3 +28,77 @@ The D Completion Daemon is an auto-complete program for the D programming langua
|
||||||
1. Modify the server.d file because several import paths are currently hard-coded. (See also: the warning at the beginnig that this is alpha-quality)
|
1. Modify the server.d file because several import paths are currently hard-coded. (See also: the warning at the beginnig that this is alpha-quality)
|
||||||
1. Configure your text editor to call the dcd-client program
|
1. Configure your text editor to call the dcd-client program
|
||||||
1. Start the dcd-server program before editing code.
|
1. Start the dcd-server program before editing code.
|
||||||
|
|
||||||
|
#Client usage
|
||||||
|
|
||||||
|
##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 a
|
||||||
|
left parethesis.
|
||||||
|
|
||||||
|
###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 folled 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
|
||||||
|
|
||||||
|
####Example output
|
||||||
|
identifiers
|
||||||
|
parts v
|
||||||
|
name v
|
||||||
|
location v
|
||||||
|
qualifier v
|
||||||
|
kind v
|
||||||
|
type v
|
||||||
|
resolvedType v
|
||||||
|
calltip v
|
||||||
|
getPartByName f
|
||||||
|
|
||||||
|
####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)
|
||||||
|
|
||||||
|
##Clear server's autocomplete cache
|
||||||
|
```dcd-client --clearCache```
|
||||||
|
|
||||||
|
##Specify server port
|
||||||
|
```dcd-client -p4242```
|
||||||
|
|
||||||
|
##Add import search path
|
||||||
|
```dcd-client -Ipath/to/imports```
|
||||||
|
|
||||||
|
##Shut down the server
|
||||||
|
```dcd-client --shutdown```
|
||||||
|
|
||||||
|
#Server usage
|
||||||
|
## Import directories
|
||||||
|
The ```-I``` option allows you to specify directories to be searched for modules
|
||||||
|
## Port number
|
||||||
|
The ```--port``` or ```-p``` option lets you specify the port number that the server will listen on
|
||||||
|
|
2
client.d
2
client.d
|
@ -117,7 +117,7 @@ int main(string[] args)
|
||||||
AutocompleteResponse response;
|
AutocompleteResponse response;
|
||||||
msgpack.unpack(buffer[0..bytesReceived], response);
|
msgpack.unpack(buffer[0..bytesReceived], response);
|
||||||
|
|
||||||
//writeln(response.completionType);
|
writeln(response.completionType);
|
||||||
if (response.completionType == CompletionType.identifiers)
|
if (response.completionType == CompletionType.identifiers)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < response.completions.length; i++)
|
for (size_t i = 0; i < response.completions.length; i++)
|
||||||
|
|
|
@ -57,10 +57,12 @@ end
|
||||||
|
|
||||||
local function showCalltips(calltip)
|
local function showCalltips(calltip)
|
||||||
for tip in calltip:gmatch("(.-)\n") do
|
for tip in calltip:gmatch("(.-)\n") do
|
||||||
|
if tip ~= "calltips" then
|
||||||
buffer:call_tip_show(buffer.current_pos, tip)
|
buffer:call_tip_show(buffer.current_pos, tip)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function M.autocomplete(ch)
|
function M.autocomplete(ch)
|
||||||
if buffer:get_lexer() ~= "dmd" then return end
|
if buffer:get_lexer() ~= "dmd" then return end
|
||||||
|
|
Loading…
Reference in New Issue