diff --git a/README.md b/README.md index 596f0cc..3fb4e4b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,24 @@ [](https://gitter.im/buggins/dlangide?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://travis-ci.org/buggins/dlangide) [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H2ADZV8S6TDHQ "Donate once-off to this project using Paypal") +WTF?! (What The Fork) +====================== +Now you can set dmd includes paths (for correct work with DCD) in workspace settings file (newworkspace.dlangidews) +
+example:
+{
+ "name" : "newworkspace",
+ "description" : null,
+ "projects" : {
+ "newproject" : "newproject/dub.json"
+ },
+ "includePath" : [
+ "/usr/include/dlang/dmd/"
+ ]
+}
+
+PS.
+ Sorry about bad code. Please correct me.
+
Dlang IDE
=========
diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d
index b316b84..cdfb1b8 100644
--- a/src/dlangide/ui/frame.d
+++ b/src/dlangide/ui/frame.d
@@ -981,8 +981,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
dlg.show();
return true;
case IDEActions.GoToDefinition:
- Log.d("Trying to go to definition.");
- currentEditor.editorTool.goToDefinition(currentEditor(), currentEditor.caretPos);
+ if (currentEditor) {
+ 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.");
diff --git a/src/dlangide/workspace/project.d b/src/dlangide/workspace/project.d
index cf6a273..bb2fd47 100644
--- a/src/dlangide/workspace/project.d
+++ b/src/dlangide/workspace/project.d
@@ -12,6 +12,8 @@ import std.path;
import std.process;
import std.utf;
+string[] includePath;
+
/// return true if filename matches rules for workspace file names
bool isProjectFile(in string filename) pure nothrow {
return filename.baseName.equal("dub.json") || filename.baseName.equal("DUB.JSON") || filename.baseName.equal("package.json") ||
@@ -284,6 +286,11 @@ class WorkspaceItem {
/// detect DMD source paths
string[] dmdSourcePaths() {
string[] res;
+
+ if(!includePath.empty){
+ res ~= includePath;
+ }
+
version(Windows) {
import dlangui.core.files;
string dmdPath = findExecutablePath("dmd");
@@ -371,6 +378,12 @@ class Project : WorkspaceItem {
this(Workspace ws, string fname = null, string dependencyVersion = null) {
super(fname);
_workspace = ws;
+
+ if (_workspace) {
+ foreach(obj; _workspace.includePath.array)
+ includePath ~= obj.str;
+ }
+
_items = new ProjectFolder(fname);
_dependencyVersion = dependencyVersion;
_isDependency = _dependencyVersion.length > 0;
diff --git a/src/dlangide/workspace/workspace.d b/src/dlangide/workspace/workspace.d
index 66d4861..c01b0fa 100644
--- a/src/dlangide/workspace/workspace.d
+++ b/src/dlangide/workspace/workspace.d
@@ -75,6 +75,11 @@ class Workspace : WorkspaceItem {
return null;
}
+ @property Setting includePath(){
+ Setting res = _workspaceFile.objectByPath("includePath", true);
+ return res;
+ }
+
@property Project[] projects() { return _projects; }
@property BuildConfiguration buildConfiguration() { return _buildConfiguration; }