DCD integration: DOC comments - part 2

This commit is contained in:
Vadim Lopatin 2016-01-26 10:48:55 +03:00
parent e83ca111fb
commit 45a1af5b2b
6 changed files with 24 additions and 1 deletions

View File

@ -40,4 +40,6 @@ class DefaultEditorTool : EditorTool
override string[] getDocComments(DSourceEdit editor, TextPosition caretPosition) {
assert(0);
}
}

View File

@ -51,8 +51,12 @@ enum IDEActions : int {
ProjectFolderOpenItem,
ProjectFolderRenameItem,
ProjectFolderRefresh,
GoToDefinition,
GetCompletionSuggestions,
GetDocComments,
GetParenCompletion,
InsertCompletion,
FindText,
CloseWorkspace,
@ -123,6 +127,9 @@ const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowClo
const Action ACTION_CREATE_NEW_WORKSPACE = new Action(IDEActions.CreateNewWorkspace, "Create new workspace"d);
const Action ACTION_ADD_TO_CURRENT_WORKSPACE = new Action(IDEActions.AddToCurrentWorkspace, "Add to current workspace"d);
const Action ACTION_GET_DOC_COMMENTS = (new Action(IDEActions.GetDocComments, "SHOW_DOC_COMMENTS"c, ""c, KeyCode.KEY_D, KeyFlag.Control|KeyFlag.Shift)).addAccelerator(KeyCode.F12, KeyFlag.Control).disableByDefault();
const Action ACTION_GO_TO_DEFINITION = (new Action(IDEActions.GoToDefinition, "GO_TO_DEFINITION"c, ""c, KeyCode.KEY_G, KeyFlag.Control)).addAccelerator(KeyCode.F12, 0).disableByDefault();
const Action ACTION_GET_COMPLETIONS = (new Action(IDEActions.GetCompletionSuggestions, "SHOW_COMPLETIONS"c, ""c, KeyCode.KEY_G, KeyFlag.Control|KeyFlag.Shift)).addAccelerator(KeyCode.SPACE, KeyFlag.Control).disableByDefault();
const Action ACTION_GET_PAREN_COMPLETION = (new Action(IDEActions.GetParenCompletion, "SHOW_PAREN_COMPLETION"c, ""c, KeyCode.SPACE, KeyFlag.Control|KeyFlag.Shift)).disableByDefault();
const Action ACTION_FIND_TEXT = (new Action(IDEActions.FindText, "FIND_TEXT"c, "edit-find"c, KeyCode.KEY_F, KeyFlag.Control));

View File

@ -389,6 +389,8 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener {
switch (a.id) {
case IDEActions.GoToDefinition:
case IDEActions.GetCompletionSuggestions:
case IDEActions.GetDocComments:
case IDEActions.GetParenCompletion:
case IDEActions.DebugToggleBreakpoint:
case IDEActions.DebugEnableBreakpoint:
case IDEActions.DebugDisableBreakpoint:

View File

@ -583,7 +583,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
editItem.add(ACTION_EDIT_PREFERENCES);
MenuItem navItem = new MenuItem(new Action(21, "MENU_NAVIGATE"));
navItem.add(ACTION_GO_TO_DEFINITION, ACTION_GET_COMPLETIONS, ACTION_EDITOR_GOTO_PREVIOUS_BOOKMARK, ACTION_EDITOR_GOTO_NEXT_BOOKMARK);
navItem.add(ACTION_GO_TO_DEFINITION, ACTION_GET_COMPLETIONS, ACTION_GET_DOC_COMMENTS, ACTION_GET_PAREN_COMPLETION, ACTION_EDITOR_GOTO_PREVIOUS_BOOKMARK, ACTION_EDITOR_GOTO_NEXT_BOOKMARK);
MenuItem projectItem = new MenuItem(new Action(21, "MENU_PROJECT"));
projectItem.add(ACTION_PROJECT_SET_STARTUP, ACTION_PROJECT_REFRESH, ACTION_PROJECT_UPDATE_DEPENDENCIES, ACTION_PROJECT_SETTINGS);
@ -866,6 +866,14 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
Log.d("Trying to go to definition.");
currentEditor.editorTool.goToDefinition(currentEditor(), currentEditor.caretPos);
return true;
case IDEActions.GetDocComments:
Log.d("Trying to get doc comments.");
auto results = currentEditor.editorTool.getDocComments(currentEditor, currentEditor.caretPos);
return true;
case IDEActions.GetParenCompletion:
Log.d("Trying to get paren completion.");
//auto results = currentEditor.editorTool.getParenCompletion(currentEditor, currentEditor.caretPos);
return true;
case IDEActions.GetCompletionSuggestions:
Log.d("Getting auto completion suggestions.");
auto results = currentEditor.editorTool.getCompletions(currentEditor, currentEditor.caretPos);

View File

@ -36,6 +36,8 @@ MENU_PROJECT_UPDATE_DEPENDENCIES=Upgrade dependencies
MENU_NAVIGATE=&Navigate
GO_TO_DEFINITION=Go to definition
SHOW_COMPLETIONS=Get autocompletions
SHOW_DOC_COMMENTS=Show documentation
SHOW_PAREN_COMPLETION=Call hints
FIND_TEXT=Find...

View File

@ -33,6 +33,8 @@ MENU_PROJECT_UPDATE_DEPENDENCIES=Обновить зависимости
MENU_NAVIGATE=&Навигация
GO_TO_DEFINITION=Перейти к определению
SHOW_DOC_COMMENTS=Показать документацию
SHOW_PAREN_COMPLETION=Показать параметры вызова
FIND_TEXT=Найти...