mirror of https://github.com/buggins/dlangide.git
dcdinterface improvements
This commit is contained in:
parent
7b4e43ef8d
commit
4fa4bd22a6
|
@ -9,6 +9,8 @@ import std.typecons;
|
|||
import std.conv;
|
||||
import std.string;
|
||||
|
||||
|
||||
|
||||
enum DCDResult : int {
|
||||
DCD_NOT_RUNNING = 0,
|
||||
SUCCESS,
|
||||
|
@ -20,14 +22,16 @@ alias ResultSet = Tuple!(DCDResult, "result", dstring[], "output");
|
|||
//Interface to DCD
|
||||
//TODO: Check if server is running, start server if needed etc.
|
||||
class DCDInterface {
|
||||
ExternalProcess dcdProcess;
|
||||
ProtectedTextStorage stdoutTarget;
|
||||
|
||||
private int _port = 9166;
|
||||
//ExternalProcess dcdProcess;
|
||||
//ProtectedTextStorage stdoutTarget;
|
||||
this() {
|
||||
dcdProcess = new ExternalProcess();
|
||||
stdoutTarget = new ProtectedTextStorage();
|
||||
//dcdProcess = new ExternalProcess();
|
||||
//stdoutTarget = new ProtectedTextStorage();
|
||||
}
|
||||
|
||||
protected dstring[] invokeDcd(char[][] arguments, dstring content, out bool success) {
|
||||
protected dstring[] invokeDcd(string[] arguments, dstring content, out bool success) {
|
||||
success = false;
|
||||
ExternalProcess dcdProcess = new ExternalProcess();
|
||||
|
||||
|
@ -40,7 +44,7 @@ class DCDInterface {
|
|||
string dcd_client_name = "dcd-client";
|
||||
string dcd_client_dir = "/usr/bin";
|
||||
}
|
||||
dcdProcess.run(dcd_client_name.dup, arguments, dcd_client_dir ? dcd_client_dir.dup : null, stdoutTarget);
|
||||
dcdProcess.run(dcd_client_name, arguments, dcd_client_dir, stdoutTarget);
|
||||
dcdProcess.write(content);
|
||||
dcdProcess.wait();
|
||||
|
||||
|
@ -55,8 +59,8 @@ class DCDInterface {
|
|||
ResultSet goToDefinition(in dstring content, int index) {
|
||||
ResultSet result;
|
||||
|
||||
char[][] arguments = ["-l".dup, "-c".dup];
|
||||
arguments ~= [to!(char[])(index)];
|
||||
string[] arguments = ["-l", "-c"];
|
||||
arguments ~= [to!string(index)];
|
||||
|
||||
bool success = false;
|
||||
dstring[] output = invokeDcd(arguments, content, success);
|
||||
|
@ -93,8 +97,8 @@ class DCDInterface {
|
|||
|
||||
ResultSet result;
|
||||
|
||||
char[][] arguments = ["-c".dup];
|
||||
arguments ~= [to!(char[])(index)];
|
||||
string[] arguments = ["-c"];
|
||||
arguments ~= [to!string(index)];
|
||||
|
||||
bool success = false;
|
||||
dstring[] output = invokeDcd(arguments, content, success);
|
||||
|
|
Loading…
Reference in New Issue