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