diff --git a/src/dlangide/tools/d/dcdinterface.d b/src/dlangide/tools/d/dcdinterface.d index ff34394..9fddab0 100644 --- a/src/dlangide/tools/d/dcdinterface.d +++ b/src/dlangide/tools/d/dcdinterface.d @@ -9,7 +9,8 @@ import std.typecons; import std.conv; import std.string; - +const DCD_SERVER_PORT_FOR_DLANGIDE = 9167; +const DCD_DEFAULT_PORT = 9166; enum DCDResult : int { DCD_NOT_RUNNING = 0, @@ -19,14 +20,16 @@ enum DCDResult : int { } alias ResultSet = Tuple!(DCDResult, "result", dstring[], "output"); + //Interface to DCD //TODO: Check if server is running, start server if needed etc. class DCDInterface { - private int _port = 9166; + private int _port; //ExternalProcess dcdProcess; //ProtectedTextStorage stdoutTarget; - this() { + this(int port = DCD_SERVER_PORT_FOR_DLANGIDE) { + _port = port; //dcdProcess = new ExternalProcess(); //stdoutTarget = new ProtectedTextStorage(); } @@ -65,8 +68,8 @@ class DCDInterface { arguments ~= "-I"; arguments ~= p; } - - + if (_port != DCD_DEFAULT_PORT) + arguments ~= "-p" ~ to!string(_port); bool success = false; dstring[] output = invokeDcd(arguments, content, success); @@ -110,6 +113,8 @@ class DCDInterface { arguments ~= "-I"; arguments ~= p; } + if (_port != DCD_DEFAULT_PORT) + arguments ~= "-p" ~ to!string(_port); bool success = false; dstring[] output = invokeDcd(arguments, content, success); diff --git a/src/dlangide/tools/d/dcdserver.d b/src/dlangide/tools/d/dcdserver.d index 81637c2..2a5b097 100644 --- a/src/dlangide/tools/d/dcdserver.d +++ b/src/dlangide/tools/d/dcdserver.d @@ -5,6 +5,8 @@ import dlangui.core.files; import dlangide.builders.extprocess; import dlangide.workspace.project; import std.conv : to; +import dlangide.tools.d.dcdinterface; + /// encapsulates running DCD server access class DCDServer { @@ -18,7 +20,7 @@ class DCDServer { @property int port() { return _port; } - this(int port = 9166) { + this(int port = DCD_SERVER_PORT_FOR_DLANGIDE) { _port = port; } /// returns true if there was error while trying to run server last time @@ -51,6 +53,8 @@ class DCDServer { arguments ~= "-I"; arguments ~= p; } + if (_port != DCD_DEFAULT_PORT) + arguments ~= "-p" ~ to!string(_port); Log.i("starting dcd-server: executable path is ", dcdServerExecutable, " args: ", arguments); dcdProcess = new ExternalProcess(); stdoutTarget = new ProtectedTextStorage(); diff --git a/src/dlangide/tools/d/deditortool.d b/src/dlangide/tools/d/deditortool.d index eb3ca66..9c98225 100644 --- a/src/dlangide/tools/d/deditortool.d +++ b/src/dlangide/tools/d/deditortool.d @@ -19,7 +19,7 @@ class DEditorTool : EditorTool this(IDEFrame frame) { - _dcd = new DCDInterface(); + _dcd = new DCDInterface(DCD_SERVER_PORT_FOR_DLANGIDE); super(frame); }