diff --git a/src/dlangide/ui/dsourceedit.d b/src/dlangide/ui/dsourceedit.d index c23a469..a1c4ff4 100644 --- a/src/dlangide/ui/dsourceedit.d +++ b/src/dlangide/ui/dsourceedit.d @@ -9,6 +9,7 @@ import dlangui.widgets.menu; import dlangui.widgets.popup; import dlangui.widgets.controls; import dlangui.widgets.scroll; +import dlangui.dml.dmlhighlight; import ddc.lexer.textsource; import ddc.lexer.exceptions; @@ -106,7 +107,19 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener { } @property bool isDSourceFile() { - return filename.endsWith(".d") || filename.endsWith(".dd") || filename.endsWith(".dh") || filename.endsWith(".ddoc"); + return filename.endsWith(".d") || filename.endsWith(".dd") || filename.endsWith(".dd") || filename.endsWith(".di") || filename.endsWith(".dh") || filename.endsWith(".ddoc"); + } + + @property bool isJsonFile() { + return filename.endsWith(".json") || filename.endsWith(".JSON"); + } + + @property bool isDMLFile() { + return filename.endsWith(".dml") || filename.endsWith(".DML"); + } + + @property bool isXMLFile() { + return filename.endsWith(".xml") || filename.endsWith(".XML"); } override protected MenuItem getLeftPaneIconsPopupMenu(int line) { @@ -151,6 +164,10 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener { void setSyntaxSupport() { if (isDSourceFile) { content.syntaxSupport = new SimpleDSyntaxSupport(filename); + } else if (isJsonFile) { + content.syntaxSupport = new DMLSyntaxSupport(filename); + } else if (isDMLFile) { + content.syntaxSupport = new DMLSyntaxSupport(filename); } else { content.syntaxSupport = null; } diff --git a/src/dlangide/ui/wspanel.d b/src/dlangide/ui/wspanel.d index df18880..1b7b529 100644 --- a/src/dlangide/ui/wspanel.d +++ b/src/dlangide/ui/wspanel.d @@ -163,7 +163,14 @@ class WorkspacePanel : DockWindow { p.objectParam = child; addProjectItems(p, child); } else { - TreeItem p = root.newChild(child.filename, child.name, "text-d"); + string icon = "text-other"; + if (child.isDSourceFile) + icon = "text-d"; + if (child.isJsonFile) + icon = "text-json"; + if (child.isDMLFile) + icon = "text-dml"; + TreeItem p = root.newChild(child.filename, child.name, icon); p.intParam = ProjectItemType.SourceFile; p.objectParam = child; } diff --git a/src/dlangide/workspace/project.d b/src/dlangide/workspace/project.d index 5fc31ef..d20e254 100644 --- a/src/dlangide/workspace/project.d +++ b/src/dlangide/workspace/project.d @@ -90,6 +90,30 @@ class ProjectItem { return cast(ProjectSourceFile)this; return null; } + + @property bool isDSourceFile() { + if (isFolder) + return false; + return filename.endsWith(".d") || filename.endsWith(".dd") || filename.endsWith(".dd") || filename.endsWith(".di") || filename.endsWith(".dh") || filename.endsWith(".ddoc"); + } + + @property bool isJsonFile() { + if (isFolder) + return false; + return filename.endsWith(".json") || filename.endsWith(".JSON"); + } + + @property bool isDMLFile() { + if (isFolder) + return false; + return filename.endsWith(".dml") || filename.endsWith(".DML"); + } + + @property bool isXMLFile() { + if (isFolder) + return false; + return filename.endsWith(".xml") || filename.endsWith(".XML"); + } } /// Project folder diff --git a/views/res/hdpi/hdpi_text-dml.png b/views/res/hdpi/hdpi_text-dml.png new file mode 100644 index 0000000..a1e72d1 Binary files /dev/null and b/views/res/hdpi/hdpi_text-dml.png differ diff --git a/views/res/hdpi/hdpi_text-json.png b/views/res/hdpi/hdpi_text-json.png new file mode 100644 index 0000000..6ce45da Binary files /dev/null and b/views/res/hdpi/hdpi_text-json.png differ diff --git a/views/res/hdpi/hdpi_text-other.png b/views/res/hdpi/hdpi_text-other.png new file mode 100644 index 0000000..954eb6c Binary files /dev/null and b/views/res/hdpi/hdpi_text-other.png differ diff --git a/views/res/mdpi/text-dml.png b/views/res/mdpi/text-dml.png new file mode 100644 index 0000000..784ca67 Binary files /dev/null and b/views/res/mdpi/text-dml.png differ diff --git a/views/res/mdpi/text-json.png b/views/res/mdpi/text-json.png new file mode 100644 index 0000000..6c5f1f1 Binary files /dev/null and b/views/res/mdpi/text-json.png differ diff --git a/views/res/mdpi/text-other.png b/views/res/mdpi/text-other.png new file mode 100644 index 0000000..8f8f133 Binary files /dev/null and b/views/res/mdpi/text-other.png differ diff --git a/views/resources.list b/views/resources.list index 06fe582..ffb67ad 100644 --- a/views/resources.list +++ b/views/resources.list @@ -29,6 +29,9 @@ res/hdpi/hdpi_run-build-clean.png res/hdpi/hdpi_run-build-configure.png res/hdpi/hdpi_run-build.png res/hdpi/hdpi_text-d.png +res/hdpi/hdpi_text-dml.png +res/hdpi/hdpi_text-json.png +res/hdpi/hdpi_text-other.png res/mdpi/cr3_logo.png res/mdpi/debug-run.png res/mdpi/debug-pause.png @@ -60,4 +63,7 @@ res/mdpi/run-build.png res/mdpi/run-build-clean.png res/mdpi/run-build-configure.png res/mdpi/text-d.png +res/mdpi/text-dml.png +res/mdpi/text-json.png +res/mdpi/text-other.png res/mdpi/tx_fabric.jpg