Send the editor content instead of the file name to dcd

This commit is contained in:
Hans-Albert Maritz 2015-02-14 09:35:59 +11:00
parent ec9b0a2147
commit 6b5e307753
3 changed files with 17 additions and 6 deletions

View File

@ -297,7 +297,7 @@ class ExternalProcess {
params ~= _program;
params ~= _args;
if (!_stderr)
redirect = Redirect.stdout | Redirect.stderrToStdout; //Redirect.stdin |
redirect = Redirect.stdout | Redirect.stderrToStdout | Redirect.stdin;
else
redirect = Redirect.all;
Log.i("Trying to run program ", _program, " with args ", _args);
@ -393,4 +393,14 @@ class ExternalProcess {
}
return _state;
}
void write(dstring data) {
if(_state == ExternalProcessState.Error || _state == ExternalProcessState.None || _state == ExternalProcessState.Stopped) {
return;
}
else {
_pipes.stdin.write(data);
_pipes.stdin.close();
}
}
}

View File

@ -9,12 +9,13 @@ class DCDInterface {
this() {
dcdProcess = new ExternalProcess();
}
bool execute(char[][] arguments ,ref dstring output) {
bool execute(char[][] arguments ,ref dstring output, dstring input) {
ProtectedTextStorage stdoutTarget = new ProtectedTextStorage();
ExternalProcess dcdProcess = new ExternalProcess();
//TODO: Working Directory, where is that?
//TODO: Inform user when dcd-client is not available.
dcdProcess.run("dcd-client".dup, arguments, "/usr/bin".dup, stdoutTarget);
dcdProcess.write(input);
while(dcdProcess.poll() == ExternalProcessState.Running){ }

View File

@ -28,10 +28,10 @@ class DEditorTool : EditorTool
char[][] arguments = ["-l".dup, "-c".dup];
arguments ~= [to!(char[])(byteOffset)];
arguments ~= [to!(char[])(editor.projectSourceFile.filename())];
//arguments ~= [to!(char[])(editor.projectSourceFile.filename())];
dstring output;
_dcd.execute(arguments, output);
_dcd.execute(arguments, output, content);
string[] outputLines = to!string(output).splitLines();
Log.d("DCD:", outputLines);
@ -70,10 +70,10 @@ class DEditorTool : EditorTool
char[][] arguments = ["-c".dup];
arguments ~= [to!(char[])(byteOffset)];
arguments ~= [to!(char[])(editor.projectSourceFile.filename())];
//arguments ~= [to!(char[])(editor.projectSourceFile.filename())];
dstring output;
_dcd.execute(arguments, output);
_dcd.execute(arguments, output, content);
char[] state = "".dup;
dstring[] suggestions;