diff --git a/src/dlangide/tools/editortool.d b/src/dlangide/tools/editortool.d index 5d12bbb..18b328f 100644 --- a/src/dlangide/tools/editortool.d +++ b/src/dlangide/tools/editortool.d @@ -40,4 +40,6 @@ class DefaultEditorTool : EditorTool override string[] getDocComments(DSourceEdit editor, TextPosition caretPosition) { assert(0); } + + } diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index 60b41ec..01bb4bd 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -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)); diff --git a/src/dlangide/ui/dsourceedit.d b/src/dlangide/ui/dsourceedit.d index aaace8c..aaff1bd 100644 --- a/src/dlangide/ui/dsourceedit.d +++ b/src/dlangide/ui/dsourceedit.d @@ -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: diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 16def5d..adc2119 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -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); diff --git a/views/res/i18n/en.ini b/views/res/i18n/en.ini index a5402c8..2b11a87 100644 --- a/views/res/i18n/en.ini +++ b/views/res/i18n/en.ini @@ -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... diff --git a/views/res/i18n/ru.ini b/views/res/i18n/ru.ini index 4c4c4e1..0359f0d 100644 --- a/views/res/i18n/ru.ini +++ b/views/res/i18n/ru.ini @@ -33,6 +33,8 @@ MENU_PROJECT_UPDATE_DEPENDENCIES=Обновить зависимости MENU_NAVIGATE=&Навигация GO_TO_DEFINITION=Перейти к определению +SHOW_DOC_COMMENTS=Показать документацию +SHOW_PAREN_COMPLETION=Показать параметры вызова FIND_TEXT=Найти...