mirror of https://github.com/buggins/dlangide.git
dcd support
This commit is contained in:
parent
ebc9ae9d3e
commit
0ae570dd26
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -19,7 +19,7 @@ class DEditorTool : EditorTool
|
|||
|
||||
|
||||
this(IDEFrame frame) {
|
||||
_dcd = new DCDInterface();
|
||||
_dcd = new DCDInterface(DCD_SERVER_PORT_FOR_DLANGIDE);
|
||||
super(frame);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue