1 module dlangide.tools.editortool;
2 
3 
4 
5 import dlangui.widgets.editors;
6 import dlangui.core.types;
7 import dlangide.ui.frame;
8 import dlangide.ui.dsourceedit;
9 
10 public import dlangide.tools.d.deditortool;
11 
12 enum CompletionTypes : int {
13     IdentifierList,
14     CallTips,
15 }
16 
17 class EditorTool
18 {
19     this(IDEFrame frame) {
20         _frame = frame;
21     }
22     //Since files might be unsaved, we must send all the text content.
23     abstract void goToDefinition(DSourceEdit editor, TextPosition caretPosition);
24     abstract void getDocComments(DSourceEdit editor, TextPosition caretPosition, void delegate(string[]) callback);
25     abstract void getCompletions(DSourceEdit editor, TextPosition caretPosition, void delegate(dstring[] labels, string[] icons, CompletionTypes type) callback);
26 
27     void cancelGoToDefinition() {}
28     void cancelGetDocComments() {}
29     void cancelGetCompletions() {}
30 
31     protected IDEFrame _frame;
32     
33 }
34 
35 class DefaultEditorTool : EditorTool
36 {
37     this(IDEFrame frame) {
38         super(frame);
39     }
40     
41     override void goToDefinition(DSourceEdit editor, TextPosition caretPosition) {
42         //assert(0); //Go To Definition should not be called for normal files.
43     }
44     
45     override void getCompletions(DSourceEdit editor, TextPosition caretPosition, void delegate(dstring[] labels, string[] icons, CompletionTypes type) callback) {
46         //assert(0);
47     }
48 
49     override void getDocComments(DSourceEdit editor, TextPosition caretPosition, void delegate(string[]) callback) {
50         //assert(0);
51     }
52 }