mirror of https://github.com/buggins/dlangide.git
commit
93255d7a10
|
@ -21,3 +21,18 @@ class EditorTool
|
|||
protected IDEFrame _frame;
|
||||
|
||||
}
|
||||
|
||||
class DefaultEditorTool : EditorTool
|
||||
{
|
||||
this(IDEFrame frame) {
|
||||
super(frame);
|
||||
}
|
||||
|
||||
override bool goToDefinition(DSourceEdit editor, TextPosition caretPosition) {
|
||||
assert(0); //Go To Definition should not be called for normal files.
|
||||
}
|
||||
|
||||
override dstring[] getCompletions(DSourceEdit editor, TextPosition caretPosition) {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import dlangide.workspace.project;
|
|||
import dlangide.ui.commands;
|
||||
import dlangide.ui.settings;
|
||||
import dlangide.tools.d.dsyntax;
|
||||
import dlangide.tools.editorTool;
|
||||
|
||||
import std.algorithm;
|
||||
|
||||
|
@ -67,6 +68,11 @@ class DSourceEdit : SourceEdit {
|
|||
smartIndents = _settings.smartIndents;
|
||||
smartIndentsAfterPaste = _settings.smartIndentsAfterPaste;
|
||||
}
|
||||
|
||||
protected EditorTool _editorTool;
|
||||
@property EditorTool editorTool() { return _editorTool; }
|
||||
@property EditorTool editorTool(EditorTool tool) { return _editorTool = tool; };
|
||||
|
||||
protected ProjectSourceFile _projectSourceFile;
|
||||
@property ProjectSourceFile projectSourceFile() { return _projectSourceFile; }
|
||||
/// load by filename
|
||||
|
|
|
@ -106,7 +106,6 @@ class IDEFrame : AppFrame {
|
|||
|
||||
override protected void init() {
|
||||
_appName = "dlangide";
|
||||
_editorTool = new DEditorTool(this);
|
||||
_dcdServer = new DCDServer();
|
||||
_settings = new IDESettings(buildNormalizedPath(settingsDir, "settings.json"));
|
||||
_settings.load();
|
||||
|
@ -185,6 +184,10 @@ class IDEFrame : AppFrame {
|
|||
editor.onModifiedStateChangeListener = &onModifiedStateChange;
|
||||
applySettings(editor, settings);
|
||||
_tabs.selectTab(index, true);
|
||||
if( filename.endsWith(".d") )
|
||||
editor.editorTool = new DEditorTool(this);
|
||||
else
|
||||
editor.editorTool = new DefaultEditorTool(this);
|
||||
} else {
|
||||
destroy(editor);
|
||||
if (window)
|
||||
|
@ -562,12 +565,11 @@ class IDEFrame : AppFrame {
|
|||
caption = "Open Text File"d;
|
||||
FileDialog dlg = createFileDialog(caption);
|
||||
dlg.addFilter(FileFilterEntry(UIString("Source files"d), "*.d;*.dd;*.ddoc;*.dh;*.json;*.xml;*.ini"));
|
||||
dlg.addFilter(FileFilterEntry(UIString("All files"d), "*.*"));
|
||||
dlg.onDialogResult = delegate(Dialog dlg, const Action result) {
|
||||
if (result.id == ACTION_OPEN.id) {
|
||||
string filename = result.stringParam;
|
||||
if (isSupportedSourceTextFileFormat(filename)) {
|
||||
openSourceFile(filename);
|
||||
}
|
||||
openSourceFile(filename);
|
||||
}
|
||||
};
|
||||
dlg.show();
|
||||
|
@ -794,10 +796,8 @@ class IDEFrame : AppFrame {
|
|||
//Log.d("onFilesDropped(", filenames, ")");
|
||||
bool first = true;
|
||||
for (int i = 0; i < filenames.length; i++) {
|
||||
if (isSupportedSourceTextFileFormat(filenames[i])) {
|
||||
openSourceFile(filenames[i], null, first);
|
||||
first = false;
|
||||
}
|
||||
openSourceFile(filenames[i], null, first);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue