Insert completion suggestion. issue #20

This commit is contained in:
Hans-Albert Maritz 2015-02-14 09:02:46 +11:00
parent 0b01ca2b86
commit ec9b0a2147
3 changed files with 9 additions and 1 deletions

View File

@ -13,8 +13,11 @@ class DCDInterface {
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);
while(dcdProcess.poll() == ExternalProcessState.Running){ }
output = stdoutTarget.readText();
return true;
}

View File

@ -42,6 +42,7 @@ enum IDEActions : int {
ProjectFolderRenameItem,
GoToDefinition,
GetCompletionSuggestions,
InsertCompletion,
}
const Action ACTION_PROJECT_FOLDER_ADD_ITEM = new Action(IDEActions.ProjectFolderAddItem, "MENU_PROJECT_FOLDER_ADD_ITEM"c);

View File

@ -80,6 +80,10 @@ class DSourceEdit : SourceEdit {
case IDEActions.FileSave:
save();
return true;
case IDEActions.InsertCompletion:
EditOperation edit = new EditOperation(EditAction.Replace, getCaretPosition, a.label);
_content.performOperation(edit, this);
return true;
default:
break;
}
@ -93,7 +97,7 @@ class DSourceEdit : SourceEdit {
MenuItem completionPopupItem = new MenuItem(null);
//Create popup menu
foreach(int i, dstring suggestion ; suggestions) {
auto action = new Action(i+1, suggestion);
auto action = new Action(IDEActions.InsertCompletion, suggestion);
completionPopupItem.add(action);
}
completionPopupItem.updateActionState(this);