├── .gitignore ├── .gitmodules ├── MonoDevelop.DBinding.sln ├── MonoDevelop.DBinding ├── AssemblyInfo.cs ├── Building │ ├── ArgumentMacroProvider.cs │ ├── CompilerPresets │ │ ├── ConfigPresets.resources │ │ ├── PresetLoader.cs │ │ ├── dmd.xml │ │ ├── gdc.xml │ │ └── ldc2.xml │ ├── DCompilerConfiguration.cs │ ├── DCompilerService.cs │ ├── ErrorExtracting.cs │ └── ProjectBuilder.cs ├── Completion │ ├── AstUpdater.cs │ ├── DCodeCompletionSupport.cs │ ├── DCompletionDataList.cs │ ├── DIcons.cs │ ├── DParameterDataProvider.cs │ ├── EditorCompletionExtension.cs │ ├── TooltipInfoGen.cs │ └── TooltipMarkupGen.cs ├── DLanguageBinding.cs ├── DSyntaxHighlightingMode.xml ├── Debugging │ ├── DExecutionCommand.cs │ ├── DLocalExamBacktrace.Evaluation.cs │ ├── DLocalExamBacktrace.cs │ ├── DebugSymbolTypeEvalVisitor.cs │ ├── DebugSymbolValueProvider.cs │ ├── ExamHelpers.cs │ ├── IDBacktraceHelpers.cs │ ├── LazyEvaluationValue.cs │ └── ObjectCacheNode.cs ├── DietTemplateSyntaxDefinition.xml ├── Formatting │ ├── DCodeFormatter.cs │ ├── DFormattingPolicy.cs │ ├── DPolicy.xml │ ├── DietTemplateFormattingPanel.cs │ ├── FormattingPanel.cs │ ├── FormattingPanelWidget.cs │ └── Indentation │ │ ├── DIndentEngine.cs │ │ ├── DIndentationTracker.cs │ │ ├── DTextEditorIndentation.cs │ │ └── doc.txt ├── Gui │ ├── DModuleOutlineExtension.cs │ ├── DToolTipProvider.cs │ ├── DTypeSearchCategory.cs │ ├── EditorPathBarExtension.cs │ ├── EditorPathbarProvider.cs │ ├── ExpressionEvaluationWidget.cs │ ├── MixinInsightExtension.cs │ └── MixinInsightPad.cs ├── GuiBuilder │ ├── GtkDProjectServiceExtension.cs │ ├── GtkDesignInfo.cs │ ├── GuiBuilderDisplayBinding.cs │ ├── GuiBuilderProject.cs │ ├── GuiBuilderView.cs │ ├── GuiBuilderWindow.cs │ └── ProjectResourceProvider.cs ├── Highlighting │ ├── DSyntaxMode.cs │ ├── DietTemplateSyntaxMode.cs │ ├── DiffbasedHighlighting.cs │ └── HighlightUsagesExtension.cs ├── MonoDevelop.D.addin.xml ├── MonoDevelop.D.csproj ├── OptionPanels │ ├── BuildArgumentOptions.cs │ ├── CompilerOptions.cs │ ├── DCompilerOptions.cs │ ├── DGlobalOptions.cs │ ├── DubOptionPanel.cs │ ├── EditCompilerName.cs │ ├── ProjectDependenciesWidget.cs │ ├── ProjectDependencyPanelBinding.cs │ ├── ProjectIncludesWidget.cs │ ├── ProjectIncludesWidgetBinding.cs │ ├── ProjectOptions.cs │ ├── ResourcesCompilerOptions.cs │ └── UnittestOptions.cs ├── Parser │ ├── DParserWrapper.cs │ ├── DPseudoUnresolvedFile.cs │ ├── FoldingParser.cs │ └── ParsedDModule.cs ├── Profiler │ ├── Commands │ │ ├── ProfilerCommands.cs │ │ └── ProfilerModeHandler.cs │ ├── Gui │ │ ├── CodeCoverageEditorExtension.cs │ │ ├── CodeCoverageView.cs │ │ ├── DProfilerPad.cs │ │ └── ProfilerPadWidget.cs │ └── TraceLogParser.cs ├── ProjectFormats.xml ├── Projects │ ├── AbstractDProject.cs │ ├── DConfigurationMode.cs │ ├── DProject.cs │ ├── DProjectBinding.cs │ ├── DProjectConfiguration.cs │ ├── DProjectReferenceCollection.cs │ ├── DefaultDReferencesCollection.cs │ ├── Dub │ │ ├── DefinitionFormats │ │ │ ├── DubFileFormat.cs │ │ │ ├── DubFileManager.cs │ │ │ ├── DubFileReader.cs │ │ │ ├── DubJson.cs │ │ │ ├── DubSdl.cs │ │ │ ├── JSON │ │ │ │ ├── JSONArray.cs │ │ │ │ ├── JSONObject.cs │ │ │ │ ├── JSONThing.cs │ │ │ │ ├── JSONThingDeserializer.cs │ │ │ │ └── JSONValueLeaf.cs │ │ │ ├── PackageJson.cs │ │ │ └── SDL │ │ │ │ ├── SDLDeclaration.cs │ │ │ │ ├── SDLObject.cs │ │ │ │ ├── SdlLexer.cs │ │ │ │ └── SdlParser.cs │ │ ├── DubBuildSettings.cs │ │ ├── DubBuilder.cs │ │ ├── DubProject.cs │ │ ├── DubProjectConfiguration.cs │ │ ├── DubProjectItemTypeHandler.cs │ │ ├── DubReferencesCollection.cs │ │ ├── DubSettings.cs │ │ ├── DubSolution.cs │ │ └── DubSubPackage.cs │ ├── ProjectJsonConfig.cs │ ├── ProjectPad │ │ ├── DPrjRefNode.cs │ │ ├── DProjectNodeExtension.cs │ │ ├── DProjectReference.cs │ │ └── DProjectReferenceFolderNodeBuilder.cs │ └── VisualD │ │ ├── VisualDPrjConfig.cs │ │ ├── VisualDProjFormat.cs │ │ ├── VisualDProject.cs │ │ └── VisualDProjectReferenceCollection.cs ├── Refactoring │ ├── CodeActions │ │ └── DCodeActionSource.cs │ ├── ContextMenuRefactoringCommandHandler.cs │ ├── DRefactoringContext.cs │ ├── DustMiteIntegration │ │ ├── DustMite.cs │ │ └── DustMiteArgDlg.cs │ ├── ImportSymbolSelectionDlg.cs │ ├── RefactoringCommandCapsule.cs │ ├── RefactoringCommandsExtension.cs │ ├── ReferenceFinding.cs │ ├── Renaming │ │ ├── DRenameHandler.cs │ │ ├── DRenameNameDialog.cs │ │ └── DRenameRefactoring.cs │ ├── SortImportsCommandHandler.cs │ └── TextDocumentAdapter.cs ├── Resolver │ ├── DResolverWrapper.cs │ └── MonoDParseCacheView.cs ├── Unittest │ ├── Commands │ │ ├── UnittestCommandHandler.cs │ │ └── UnittestCommands.cs │ ├── UnittestCore.cs │ └── UnittestSettings.cs ├── gtk-gui │ ├── MonoDevelop.D.DRenameNameDialog.cs │ ├── MonoDevelop.D.Formatting.FormattingPanelWidget.cs │ ├── MonoDevelop.D.ImportSymbolSelectionDlg.cs │ ├── MonoDevelop.D.OptionPanels.BuildArgumentOptions.cs │ ├── MonoDevelop.D.OptionPanels.DCompilerOptions.cs │ ├── MonoDevelop.D.OptionPanels.DGlobalOptions.cs │ ├── MonoDevelop.D.OptionPanels.DubOptionPanel.cs │ ├── MonoDevelop.D.OptionPanels.EditCompilerName.cs │ ├── MonoDevelop.D.OptionPanels.ProjectOptions.cs │ ├── MonoDevelop.D.OptionPanels.UnittestOptions.cs │ ├── MonoDevelop.D.Profiler.Gui.ProfilerPadWidget.cs │ ├── MonoDevelop.D.ProjectDependenciesWidget.cs │ ├── MonoDevelop.D.ProjectIncludesWidget.cs │ ├── MonoDevelop.D.Refactoring.DustMiteArgDlg.cs │ ├── MonoDevelop.D.ResourcesCompilerOptionsPanel.cs │ ├── generated.cs │ └── gui.stetic ├── icons │ ├── d-asm-avx-16.png │ ├── d-asm-fpu-16.png │ ├── d-asm-mmx-16.png │ ├── d-asm-sse-16.png │ ├── d-asm-sse2-16.png │ ├── d-asm-sse3-16.png │ ├── d-asm-sse4.1-16.png │ ├── d-asm-sse4.2-16.png │ ├── d-asm-ssse3-16.png │ ├── d-asm-x64-16.png │ ├── d-asm-x86-16.png │ ├── dfile16.png │ ├── dfile32.png │ ├── dproj16.png │ ├── dproj32.png │ ├── element-abstract-class-16.png │ ├── element-abstract-method-16.png │ ├── element-alias-16.png │ ├── element-local-16.png │ ├── element-local-16.psd │ ├── element-parameter-16.png │ ├── element-union-16.png │ ├── lazy-16.png │ ├── out-16.png │ ├── ref-16.png │ └── static-16.png └── templates │ ├── AnsiFile.cs │ ├── ConsoleProject.xpt.xml │ ├── DFileDescriptionTemplate.cs │ ├── EmptyDClass.xft.xml │ ├── EmptyDFile.xft.xml │ ├── EmptyProject.xpt.xml │ ├── EmptyRCFile.xft.xml │ ├── SharedLibrary.xpt.xml │ ├── StaticLibrary.xpt.xml │ └── Win32Project.xpt.xml ├── addin-project.xml ├── build ├── BuildRepoFiles.bat └── buildrepofiles ├── ext ├── ICSharpCode.NRefactory.CSharp.dll ├── ICSharpCode.NRefactory.dll ├── ICSharpCode.SharpZipLib.dll ├── Mono.Addins.Setup.dll ├── Mono.Addins.dll ├── Mono.Debugging.dll ├── Mono.TextEditor.dll ├── MonoDevelop.Core.dll ├── MonoDevelop.Debugger.dll ├── MonoDevelop.DesignerSupport.dll ├── MonoDevelop.GtkCore.dll ├── MonoDevelop.Ide.dll ├── MonoDevelop.Refactoring.dll ├── MonoDevelop.SourceEditor2.dll ├── Newtonsoft.Json.dll ├── Xwt.dll ├── libstetic.dll ├── libsteticui.dll └── update deps.bat ├── license.txt ├── make symlink.bat └── readme.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Parser"] 2 | path = Parser 3 | url = https://github.com/aBothe/D_Parser.git 4 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.D", "MonoDevelop.DBinding\MonoDevelop.D.csproj", "{5867254F-6B1C-4A4C-BF98-C283740A0470}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DParser2", "Parser\DParser2\DParser2.csproj", "{0290A229-9AA1-41C3-B525-CAFB86D8BC42}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|x86.ActiveCfg = Debug|x86 19 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Debug|x86.Build.0 = Debug|x86 20 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|x86.ActiveCfg = Release|x86 23 | {0290A229-9AA1-41C3-B525-CAFB86D8BC42}.Release|x86.Build.0 = Release|x86 24 | {5867254F-6B1C-4A4C-BF98-C283740A0470}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {5867254F-6B1C-4A4C-BF98-C283740A0470}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {5867254F-6B1C-4A4C-BF98-C283740A0470}.Debug|x86.ActiveCfg = Debug|Any CPU 27 | {5867254F-6B1C-4A4C-BF98-C283740A0470}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {5867254F-6B1C-4A4C-BF98-C283740A0470}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {5867254F-6B1C-4A4C-BF98-C283740A0470}.Release|x86.ActiveCfg = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(MonoDevelopProperties) = preSolution 32 | StartupItem = MonoDevelop.DBinding\MonoDevelop.D.csproj 33 | EndGlobalSection 34 | GlobalSection(SolutionProperties) = preSolution 35 | HideSolutionNode = FALSE 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | // Information about this assembly is defined by the following attributes. 4 | // Change them to the values specific to your project. 5 | 6 | [assembly: AssemblyTitle("MonoDevelop.D")] 7 | [assembly: AssemblyDescription("")] 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany("")] 10 | [assembly: AssemblyProduct("")] 11 | [assembly: AssemblyCopyright("Alexander Bothe")] 12 | [assembly: AssemblyTrademark("")] 13 | [assembly: AssemblyCulture("")] 14 | 15 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 16 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 17 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 18 | 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | 21 | // The following attributes are used to specify the signing key for the assembly, 22 | // if desired. See the Mono documentation for more information about signing. 23 | 24 | //[assembly: AssemblyDelaySign(false)] 25 | //[assembly: AssemblyKeyFile("")] 26 | 27 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Building/CompilerPresets/ConfigPresets.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/Building/CompilerPresets/ConfigPresets.resources -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Building/CompilerPresets/PresetLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Xml; 2 | using MonoDevelop.D.Building; 3 | using System.IO; 4 | using System.Collections.Generic; 5 | using System.Reflection; 6 | namespace MonoDevelop.D.Building.CompilerPresets 7 | { 8 | public static class PresetLoader 9 | { 10 | public static string GetString(Assembly ass, string name) 11 | { 12 | using (var s = ass.GetManifestResourceStream (name)) 13 | using (var r = new StreamReader (s)) 14 | return r.ReadToEnd (); 15 | } 16 | 17 | static PresetLoader() 18 | { 19 | var ass = typeof(PresetLoader).Assembly; 20 | 21 | presetFileContents ["DMD2"] = presetFileContents["DMD"] = GetString (ass,"CompilerPresets.dmd.xml"); 22 | presetFileContents ["GDC"] = GetString (ass,"CompilerPresets.gdc.xml"); 23 | presetFileContents ["ldc2"] = GetString (ass,"CompilerPresets.ldc2.xml"); 24 | } 25 | 26 | static Dictionary presetFileContents = new Dictionary(); 27 | 28 | public static void LoadPresets(DCompilerService svc) 29 | { 30 | foreach (var kv in presetFileContents) 31 | { 32 | var cmp = LoadFromString(kv.Value); 33 | cmp.Vendor = kv.Key; 34 | 35 | svc.Compilers.Add(cmp); 36 | } 37 | 38 | svc.DefaultCompiler = "DMD2"; 39 | } 40 | 41 | public static bool HasPresetsAvailable(DCompilerConfiguration compiler) 42 | { 43 | return HasPresetsAvailable(compiler.Vendor); 44 | } 45 | 46 | public static bool HasPresetsAvailable(string vendor) 47 | { 48 | foreach (var kv in presetFileContents) 49 | if (kv.Key == vendor) 50 | return true; 51 | 52 | return false; 53 | } 54 | 55 | public static bool TryLoadPresets(DCompilerConfiguration compiler) 56 | { 57 | if(compiler!=null) 58 | foreach (var kv in presetFileContents) 59 | { 60 | if (kv.Key == compiler.Vendor) 61 | { 62 | var x = new XmlTextReader(new StringReader(kv.Value)); 63 | x.Read(); 64 | 65 | compiler.DefaultLibraries.Clear(); 66 | compiler.IncludePaths.Clear(); 67 | 68 | compiler.ReadFrom(x); 69 | 70 | x.Close(); 71 | FitFileExtensions(compiler); 72 | return true; 73 | } 74 | } 75 | 76 | return false; 77 | } 78 | 79 | public static DCompilerConfiguration LoadFromString(string xmlCode) 80 | { 81 | var cmp = new DCompilerConfiguration(); 82 | 83 | var x = new XmlTextReader(new StringReader(xmlCode)); 84 | 85 | if (x.ReadToFollowing("Compiler")) 86 | { 87 | if (x.MoveToAttribute("Name")) 88 | { 89 | cmp.Vendor = x.ReadContentAsString(); 90 | x.MoveToElement(); 91 | } 92 | 93 | cmp.ReadFrom(x); 94 | } 95 | 96 | x.Close(); 97 | 98 | FitFileExtensions(cmp); 99 | 100 | return cmp; 101 | } 102 | 103 | /// 104 | /// Call this method to make all file paths etc. existing in a compiler 105 | /// config (like phobos.lib or dmd.exe) fit to the target OS properly. 106 | /// 107 | public static void FitFileExtensions(DCompilerConfiguration cfg) 108 | { 109 | for (int i = 0; i < cfg.DefaultLibraries.Count; i++) 110 | cfg.DefaultLibraries[i] = Path.ChangeExtension(cfg.DefaultLibraries[i], DCompilerService.StaticLibraryExtension); 111 | cfg.SourceCompilerCommand = Path.ChangeExtension(cfg.SourceCompilerCommand, DCompilerService.ExecutableExtension); 112 | 113 | foreach (var kv in cfg.LinkTargetConfigurations) 114 | { 115 | var lt = kv.Value; 116 | lt.Linker = Path.ChangeExtension(lt.Linker,DCompilerService.ExecutableExtension); 117 | } 118 | } 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Building/CompilerPresets/dmd.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | DigitalMars 4 | dmd 5 | 6 | 7 | "{0}" 8 | "-I{0}" 9 | -version 10 | -debug 11 | -unittest 12 | -profile 13 | -D 14 | "{0}" 15 | "-Dd{0}" 16 | -L 17 | "@{0}" 18 | -m32 19 | -m64 20 | 21 | 22 | 23 | dmd 24 | 25 | -c "$src" "-of$obj" $includes -gc -w -vcolumns 26 | -gc "-of$target" $objs $libs 27 | -gc $sources $libs $includes "-od$objectsDirectory" "-of$exe" -w -vcolumns 28 | 29 | 30 | -c "$src" "-of$obj" $includes -O -release -w -vcolumns 31 | -O -release "-of$target" $objs $libs 32 | -O -release $sources $libs $includes "-od$objectsDirectory" "-of$exe" -w -vcolumns 33 | 34 | 35 | 36 | 37 | dmd 38 | 39 | -c "$src" "-of$obj" $includes -gc -w -vcolumns 40 | -gc "-of$target" $objs $libs "-L/IMPLIB:$lib" 41 | -gc $sources $libs $includes "-L/IMPLIB:$lib" "-od$objectsDirectory" "-of$dll" -w -vcolumns 42 | 43 | 44 | -c "$src" "-of$obj" $includes -O -release -w -vcolumns 45 | -O -release "-of$target" $objs $libs "-L/IMPLIB:$lib" 46 | -O -release $sources $libs $includes "-L/IMPLIB:$lib" "-od$objectsDirectory" "-of$dll" -w -vcolumns 47 | 48 | 49 | 50 | 51 | dmd 52 | 53 | -c "$src" "-of$obj" $includes -gc -w -vcolumns 54 | -lib "-of$target" $objs 55 | -gc $sources $includes -lib "-od$objectsDirectory" "-of$lib" -w -vcolumns 56 | 57 | 58 | -c "$src" "-of$obj" $includes -O -release -w -vcolumns 59 | -lib "-of$target" $objs 60 | -O $sources $includes -lib "-od$objectsDirectory" "-of$lib" -release -w -vcolumns 61 | 62 | 63 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Building/CompilerPresets/gdc.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | GNU 5 | gdc 6 | true 7 | 8 | 9 | "{0}" 10 | "-I{0}" 11 | -fversion 12 | -fdebug 13 | -funittest 14 | 15 | 16 | "-fdoc-inc={0}" 17 | "-fdoc-dir={0}" 18 | -L 19 | "@{0}" 20 | -m32 21 | -m64 22 | 23 | 24 | 25 | gdc 26 | 27 | -c "$src" -o "$obj" $includes -g 28 | -o "$target" -g $objs $libs 29 | -g $sources $libs $includes -o "$exe" 30 | 31 | 32 | -c "$src" -frelease -o "$obj" $includes -O3 33 | -o "$target" -frelease -O3 $objs $libs 34 | -O3 -frelease $sources $libs $includes -o "$exe" 35 | 36 | 37 | 38 | 39 | gdc 40 | 41 | -fPIC -c "$src" -o "$obj" $includes -g 42 | -o "$target" -g $objs $libs -shared 43 | 44 | 45 | -fPIC -frelease -c "$src" -o "$obj" $includes -O3 46 | -o "$target" -frelease -O3 $objs $libs -shared 47 | 48 | 49 | 50 | 51 | ar 52 | 53 | -c "$src" -o "$obj" $includes -g 54 | rcs "$target" $objs 55 | 56 | 57 | -c "$src" -o "$obj" $includes -frelease -O3 58 | rcs "$target" $objs 59 | 60 | 61 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Building/CompilerPresets/ldc2.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | LDC 5 | ldc2 6 | true 7 | 8 | 9 | "{0}" 10 | "-I={0}" 11 | -d-version 12 | -d-debug 13 | -unittest 14 | 15 | -D 16 | "{0}" 17 | "-Dd={0}" 18 | -L= 19 | "@{0}" 20 | -m32 21 | -m64 22 | 23 | 24 | 25 | ldc2 26 | 27 | -c "$src" "-of=$obj" $includes -g 28 | "-of=$target" -g $objs $libs 29 | -g $sources $libs $includes "-od=$objectsDirectory" "-of=$exe" 30 | 31 | 32 | -c "$src" -release "-of=$obj" $includes -O3 33 | "-of=$target" -release -O3 $objs $libs 34 | -O3 -release $sources $libs $includes "-od=$objectsDirectory" "-of=$exe" 35 | 36 | 37 | 38 | 39 | ldc2 40 | 41 | -relocation-model=pic -c "$src" "-of=$obj" $includes -g 42 | "-of=$target" -g $objs $libs -shared 43 | 44 | 45 | -relocation-model=pic -release -c "$src" "-of=$obj" $includes -O3 46 | "-of=$target" -release -O3 $objs $libs -shared 47 | 48 | 49 | 50 | 51 | ar 52 | 53 | -c "$src" "-of=$obj" $includes -g 54 | rcs "$target" $objs 55 | 56 | 57 | -c "$src" "-of=$obj" $includes -release -O3 58 | rcs "$target" $objs 59 | 60 | 61 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Completion/AstUpdater.cs: -------------------------------------------------------------------------------- 1 | using D_Parser.Dom; 2 | using D_Parser.Dom.Statements; 3 | using D_Parser.Resolver.TypeResolution; 4 | using Mono.TextEditor; 5 | using MonoDevelop.D.Parser; 6 | using MonoDevelop.Ide.Gui; 7 | namespace MonoDevelop.D.Completion 8 | { 9 | class AstUpdater 10 | { 11 | #region Properties 12 | public readonly Document Document; 13 | public readonly TextEditorData Editor; 14 | 15 | public DModule Ast 16 | { 17 | get { 18 | return Document.GetDAst (); 19 | } 20 | } 21 | 22 | public AstUpdater(Document doc, TextEditorData ed) { Document = doc; Editor = ed; } 23 | 24 | 25 | bool hasBegun; 26 | 27 | IStatement currentStmt; 28 | int currentCol, currentLine; 29 | IBlockNode currentBlock; 30 | bool isBeforeBlockStart; 31 | bool isAtStmtStart; 32 | #endregion 33 | 34 | public void BeginUpdate() 35 | { 36 | if (hasBegun) 37 | return; 38 | 39 | hasBegun = true; 40 | currentCol = Document.Editor.Caret.Column; 41 | currentLine = Document.Editor.Caret.Line; 42 | var caret = new CodeLocation(currentCol, currentLine); 43 | currentBlock = DResolver.SearchBlockAt(Ast, caret); 44 | currentStmt = DResolver.SearchStatementDeeplyAt(currentBlock, caret); 45 | 46 | isBeforeBlockStart = currentBlock != null && caret < currentBlock.BlockStartLocation; 47 | isAtStmtStart = currentStmt != null && caret == currentStmt.Location; 48 | } 49 | 50 | public void FinishUpdate() 51 | { 52 | if (!hasBegun) 53 | return; 54 | 55 | hasBegun = false; 56 | 57 | int lineDiff = Editor.Caret.Line - currentLine; 58 | int colDiff = Editor.Caret.Column - currentCol; 59 | 60 | while (currentBlock != null) 61 | { 62 | if (isBeforeBlockStart) 63 | { 64 | currentBlock.BlockStartLocation = new CodeLocation( 65 | currentBlock.BlockStartLocation.Column + (currentBlock.BlockStartLocation.Line == Editor.Caret.Line ? colDiff : 0), 66 | currentBlock.BlockStartLocation.Line + lineDiff); 67 | isBeforeBlockStart = false; 68 | } 69 | 70 | currentBlock.EndLocation = new CodeLocation( 71 | currentBlock.EndLocation.Column + (currentBlock.EndLocation.Line == Editor.Caret.Line ? colDiff : 0), 72 | currentBlock.EndLocation.Line + lineDiff); 73 | currentBlock = currentBlock.Parent as IBlockNode; 74 | } 75 | 76 | while (currentStmt != null) 77 | { 78 | if (isAtStmtStart) 79 | { 80 | isAtStmtStart = currentStmt.Parent != null && currentStmt.Location == currentStmt.Parent.Location; 81 | currentStmt.Location = new CodeLocation( 82 | currentStmt.Location.Column + colDiff, 83 | currentStmt.Location.Line + lineDiff); 84 | } 85 | 86 | currentStmt.EndLocation = new CodeLocation( 87 | currentStmt.EndLocation.Column + (currentStmt.EndLocation.Line == Editor.Caret.Line ? colDiff : 0), 88 | currentStmt.EndLocation.Line + lineDiff); 89 | currentStmt = currentStmt.Parent; 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Completion/TooltipInfoGen.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TooltipInfoGen.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using MonoDevelop.Ide.CodeCompletion; 27 | using D_Parser.Resolver; 28 | using Mono.TextEditor.Highlighting; 29 | using D_Parser.Dom; 30 | using System.Collections.Generic; 31 | 32 | namespace MonoDevelop.D.Completion 33 | { 34 | public static class TooltipInfoGen 35 | { 36 | //TODO: Für semantisches Highlighting den TypeRefFinder benutzen und einfach pauschal alle Ids entsprechend highlighten 37 | public static TooltipInformation Create(AbstractType t, ColorScheme st, bool templateParamCompletion = false, int currentMethodParam = -1) 38 | { 39 | var markupGen = new TooltipMarkupGen (st); 40 | 41 | var tti = new TooltipInformation { 42 | SignatureMarkup = markupGen.GenTooltipSignature (t, templateParamCompletion, currentMethodParam) 43 | }; 44 | 45 | var ds = t as DSymbol; 46 | DNode n; 47 | if (ds != null && (n = ds.Definition) != null) 48 | CreateTooltipBody (markupGen, n, tti); 49 | 50 | return tti; 51 | } 52 | 53 | public static TooltipInformation Create(DNode dn, ColorScheme st, bool templateParamCompletion = false, int currentMethodParam = -1) 54 | { 55 | var markupGen = new TooltipMarkupGen (st); 56 | 57 | var tti = new TooltipInformation { 58 | SignatureMarkup = markupGen.GenTooltipSignature(dn, templateParamCompletion, currentMethodParam) 59 | }; 60 | 61 | CreateTooltipBody (markupGen, dn, tti); 62 | 63 | return tti; 64 | } 65 | 66 | static void CreateTooltipBody(TooltipMarkupGen markupGen, DNode dn, TooltipInformation tti) 67 | { 68 | string summary; 69 | Dictionary categories; 70 | 71 | markupGen.GenToolTipBody (dn, out summary, out categories); 72 | 73 | tti.SummaryMarkup = summary; 74 | if (categories != null) 75 | foreach (var kv in categories) 76 | tti.AddCategory (kv.Key, kv.Value); 77 | } 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Completion/TooltipMarkupGen.cs: -------------------------------------------------------------------------------- 1 | // 2 | // TooltipMarkupGen.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using System.Text; 29 | using System.Text.RegularExpressions; 30 | using Mono.TextEditor.Highlighting; 31 | using D_Parser.Parser; 32 | using Mono.TextEditor; 33 | using MonoDevelop.D.Highlighting; 34 | using D_Parser.Dom; 35 | using D_Parser.Completion.ToolTips; 36 | 37 | namespace MonoDevelop.D.Completion 38 | { 39 | public partial class TooltipMarkupGen : NodeTooltipRepresentationGen 40 | { 41 | ColorScheme st; 42 | 43 | public TooltipMarkupGen (ColorScheme st) 44 | { 45 | this.st = st; 46 | } 47 | 48 | #region Pseudo-Highlighting 49 | 50 | //TODO: Use DLexer to walk through code and highlight tokens (also comments and meta tokens) 51 | static TextDocument markupDummyTextDoc = new TextDocument (); 52 | static DSyntaxMode markupDummySyntaxMode = new DSyntaxMode (); 53 | 54 | public override string DCodeToMarkup(string code) 55 | { 56 | //TODO: Semantic highlighting 57 | var sb = new StringBuilder (); 58 | var textDoc = markupDummyTextDoc; 59 | var syntaxMode = markupDummySyntaxMode; 60 | 61 | textDoc.Text = code; 62 | if (syntaxMode.Document == null) 63 | syntaxMode.Document = textDoc; 64 | 65 | var plainText = st.PlainText; 66 | 67 | var lineCount = textDoc.LineCount; 68 | for (int i = 1; i <= lineCount; i++) { 69 | var line = textDoc.GetLine (i); 70 | 71 | foreach (var chunk in syntaxMode.GetChunks (st, line, line.Offset, line.Length)) { 72 | var s = st.GetChunkStyle (chunk); 73 | 74 | // Avoid unnecessary non-highlighting 75 | if (s == plainText) { 76 | sb.Append(HtmlEncode(textDoc.GetTextAt(chunk.Offset, chunk.Length))); 77 | continue; 78 | } 79 | 80 | var col = st.GetForeground (s); 81 | // TODO: Have other format flags applied? 82 | AppendFormat(HtmlEncode(textDoc.GetTextAt(chunk.Offset, chunk.Length)), sb, FormatFlags.Color, col.R, col.G, col.B); 83 | } 84 | 85 | if (i < lineCount) 86 | sb.AppendLine (); 87 | } 88 | 89 | return sb.ToString (); 90 | } 91 | 92 | public static string HtmlEncode(string code) 93 | { 94 | return code.Replace("&", "&").Replace("<", "<").Replace(">", ">"); //TODO 95 | } 96 | 97 | #endregion 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/DLanguageBinding.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Core; 2 | using MonoDevelop.Projects; 3 | 4 | namespace MonoDevelop.D 5 | { 6 | public class DLanguageBinding: ILanguageBinding 7 | { 8 | public static bool IsDFile(string fileName) 9 | { 10 | return fileName.EndsWith(".d", System.StringComparison.OrdinalIgnoreCase) || fileName.EndsWith(".di", System.StringComparison.OrdinalIgnoreCase); 11 | } 12 | 13 | public FilePath GetFileName(FilePath fileNameWithoutExtension) 14 | { 15 | return fileNameWithoutExtension.ChangeExtension(".d"); 16 | } 17 | 18 | public bool IsSourceCodeFile(FilePath fileName) 19 | { 20 | return IsDFile(fileName); 21 | } 22 | 23 | public string Language { 24 | get { 25 | return "D"; 26 | } 27 | } 28 | 29 | public string SingleLineCommentTag { 30 | get { 31 | return "//"; 32 | } 33 | } 34 | 35 | public string BlockCommentStartTag { 36 | get { 37 | return "/*"; 38 | } 39 | } 40 | 41 | public string BlockCommentEndTag { 42 | get { 43 | return "*/"; 44 | } 45 | } 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Debugging/DExecutionCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoDevelop.Core.Execution; 3 | 4 | namespace MonoDevelop.D.Debugging 5 | { 6 | public class DExecutionCommand : NativeExecutionCommand 7 | { 8 | public DExecutionCommand (string exe, string args = null) : base(exe, args) 9 | { 10 | } 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Debugging/DebugSymbolValueProvider.cs: -------------------------------------------------------------------------------- 1 | using D_Parser.Dom; 2 | using D_Parser.Dom.Expressions; 3 | using D_Parser.Resolver; 4 | using D_Parser.Resolver.ExpressionSemantics; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | 10 | namespace MonoDevelop.D.Debugging 11 | { 12 | class DebugSymbolValueProvider : StandardValueProvider 13 | { 14 | public readonly DLocalExamBacktrace Backtrace; 15 | Dictionary cache = new Dictionary(); 16 | 17 | public class DebugVariable : DVariable 18 | { 19 | public IDBacktraceSymbol Symbol; 20 | } 21 | 22 | public void ResetCache() 23 | { 24 | cache.Clear(); 25 | } 26 | 27 | public DebugSymbolValueProvider(DLocalExamBacktrace b, ResolutionContext ctxt) 28 | : base(ctxt) 29 | { 30 | this.Backtrace = b; 31 | } 32 | 33 | public override DVariable GetLocal(string LocalName, IdentifierExpression id = null) 34 | { 35 | Backtrace.TryUpdateStackFrameInfo(); 36 | var symb = Backtrace.BacktraceHelper.FindSymbol(LocalName); 37 | 38 | if (symb != null) 39 | { 40 | DebugVariable dv; 41 | if(!cache.TryGetValue(symb, out dv)) 42 | cache[symb] = dv = new DebugVariable { Symbol = symb, Name = LocalName }; 43 | return dv; 44 | } 45 | 46 | return base.GetLocal(LocalName, id); 47 | } 48 | 49 | public override bool ConstantOnly 50 | { 51 | get { return false; } 52 | set { } 53 | } 54 | 55 | public override ISymbolValue this[DVariable n] 56 | { 57 | get 58 | { 59 | var dv = n as DebugVariable; 60 | if (dv != null) 61 | return Backtrace.EvaluateSymbol(dv.Symbol); 62 | 63 | return base[n]; 64 | } 65 | set 66 | { 67 | //TODO? 68 | base[n] = value; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Debugging/IDBacktraceHelpers.cs: -------------------------------------------------------------------------------- 1 | using D_Parser.Dom; 2 | using D_Parser.Resolver; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace MonoDevelop.D.Debugging 9 | { 10 | public interface IDBacktraceSymbol 11 | { 12 | ulong Offset { get; } 13 | string Name { get; } 14 | string TypeName { get; } 15 | AbstractType DType { get; } 16 | string Value { get; } 17 | string FileName { get; } 18 | 19 | bool HasParent { get; } 20 | IDBacktraceSymbol Parent { get; } 21 | 22 | int ChildCount { get; } 23 | IEnumerable Children { get; } 24 | } 25 | 26 | public interface IDBacktraceArraySymbol : IDBacktraceSymbol 27 | { 28 | ulong FirstElementOffset {get;} 29 | int ArrayLength { get;} 30 | } 31 | 32 | public interface IDBacktraceHelpers 33 | { 34 | void GetCurrentStackFrameInfo(out string file, out ulong offset, out CodeLocation sourceLocation); 35 | 36 | IEnumerable Parameters { get; } 37 | IEnumerable Locals { get; } 38 | IDBacktraceSymbol FindSymbol(string name); 39 | 40 | /// 41 | /// Amount of bytes per pointer. 42 | /// Used for determining whether the program is a 64 or 32 bit program. 43 | /// 44 | int PointerSize { get; } 45 | 46 | byte[] ReadBytes(ulong offset, ulong size); 47 | byte ReadByte(ulong offset); 48 | short ReadInt16(ulong offset); 49 | int ReadInt32(ulong offset); 50 | long ReadInt64(ulong offset); 51 | 52 | /// 53 | /// Strictly optional: Allows dynamic execution/injection of code while debuggee status is claimed to be "paused". 54 | /// Mainly used for toString()-Examination for D objects. 55 | /// 56 | IActiveExamination ActiveExamination { get; } 57 | } 58 | 59 | public interface IActiveExamination 60 | { 61 | /// 62 | /// Throws InvalidOperationException if data couldn't be allocated 63 | /// 64 | ulong Allocate(int size); 65 | void Free(ulong offset, int size); 66 | 67 | void Write(ulong offset, byte[] data); 68 | /// 69 | /// Pushes the stack base pointer, puts the E/RIP to , executes it until a return command occurs. 70 | /// 71 | void Execute(ulong offset); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Debugging/LazyEvaluationValue.cs: -------------------------------------------------------------------------------- 1 | using D_Parser.Resolver; 2 | using D_Parser.Resolver.ExpressionSemantics; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace MonoDevelop.D.Debugging 9 | { 10 | /// 11 | /// Used when child items of a value shall not be evaluated yet because their values might be too complex to evaluate 12 | /// and thus must explicitly be acquired by the user. 13 | /// 14 | public class LazyEvaluationValue : ISymbolValue 15 | { 16 | 17 | public AbstractType RepresentedType 18 | { 19 | get; 20 | set; 21 | } 22 | 23 | public R Accept(ISymbolValueVisitor v) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | public bool Equals(ISymbolValue other) 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | 33 | public string ToCode() 34 | { 35 | throw new NotImplementedException(); 36 | } 37 | 38 | public void Accept(ISymbolValueVisitor vis) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Debugging/ObjectCacheNode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectCacheNode.cs 3 | // 4 | // Author: 5 | // lx <> 6 | // 7 | // Copyright (c) 2013 lx 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.Generic; 28 | using D_Parser.Resolver; 29 | using Mono.Debugging.Client; 30 | 31 | namespace MonoDevelop.D.Debugging 32 | { 33 | class ObjectRootCacheNode : ObjectCacheNode 34 | { 35 | public ObjectRootCacheNode() : base() {} 36 | } 37 | 38 | class SubArrayCacheNode : ObjectCacheNode 39 | { 40 | public readonly ulong firstItem; 41 | public readonly int length; 42 | 43 | public SubArrayCacheNode(string n, AbstractType t, ulong firstItemPointer, int len) 44 | : base(n, t, firstItemPointer) 45 | { 46 | firstItem = firstItemPointer; 47 | length = len; 48 | } 49 | } 50 | 51 | class ObjectCacheNode 52 | { 53 | public readonly string Name; 54 | Dictionary children = new Dictionary(); 55 | public readonly AbstractType NodeType; 56 | public readonly ulong address; 57 | 58 | protected ObjectCacheNode() {} 59 | public ObjectCacheNode(string n, AbstractType t, ulong address) { 60 | if(string.IsNullOrEmpty(n)) 61 | throw new ArgumentNullException("name","Child name must not be empty!"); 62 | if(t == null) 63 | throw new ArgumentNullException("t","Abstract type of '"+n+"' must not be null!"); 64 | 65 | Name = n; 66 | NodeType = t; 67 | this.address = address; 68 | } 69 | 70 | public void Clear() 71 | { 72 | children.Clear (); 73 | } 74 | 75 | public ObjectCacheNode this[string n] 76 | { 77 | get{ 78 | if (string.IsNullOrEmpty (n)) 79 | return null; 80 | 81 | ObjectCacheNode ch; 82 | children.TryGetValue (n, out ch); 83 | return ch; 84 | } 85 | } 86 | 87 | public ObjectCacheNode this[ObjectPath path] 88 | { 89 | get{ 90 | ObjectCacheNode n= this; 91 | 92 | for(int i = 0; i < path.Length; i++) 93 | if ((n = n [path[i]]) == null) 94 | break; 95 | return n; 96 | } 97 | } 98 | 99 | public void Set(ObjectCacheNode ch) 100 | { 101 | if (ch == null || ch is ObjectRootCacheNode || ch == this) 102 | throw new ArgumentException("ch and the name must be set and must not be the root node"); 103 | 104 | children [ch.Name] = ch; 105 | } 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/DietTemplateSyntaxDefinition.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | // 4 | " 5 | 6 | //- 7 | // 8 | 9 | 10 | block 11 | 12 | 13 | 14 | extends 15 | 16 | 17 | 18 | include 19 | 20 | 21 | 22 | " 23 | " 24 | 25 | 26 | #[a-zA-Z_-][a-zA-Z0-9_-]* 27 | ^\s*(?!block|include|extends)\w+(\.\w[\w-_]*)* 28 | 29 | 30 | \\(['"\\abfnrtv]|x[0-9a-fA-F]{2,4}|0\d\d) 31 | 32 | 33 | 34 | "" 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | TODO 43 | FIXME 44 | HACK 45 | UNDONE 46 | 47 | 48 | 49 | 50 | 51 | TODO 52 | FIXME 53 | HACK 54 | UNDONE 55 | 56 | 57 | /+ 58 | +/ 59 | 60 | 61 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/DFormattingPolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using D_Parser.Formatting; 3 | using MonoDevelop.Core.Serialization; 4 | using MonoDevelop.Projects.Policies; 5 | 6 | namespace MonoDevelop.D.Formatting 7 | { 8 | [PolicyType("D formatting")] 9 | public class DFormattingPolicy: IEquatable, DFormattingOptionsFactory 10 | { 11 | public DFormattingPolicy() 12 | { 13 | //TODO: Generate default attributes or so 14 | CommentOutStandardHeaders = true; 15 | InsertStarAtCommentNewLine = true; 16 | IndentSwitchBody = true; 17 | LabelIndentStyle = GotoLabelIndentStyle.OneLess; 18 | KeepAlignmentSpaces = true; 19 | IndentPastedCodeLines = true; 20 | } 21 | 22 | public bool Equals (DFormattingPolicy other) 23 | { 24 | return base.Equals (other); 25 | } 26 | 27 | public DFormattingPolicy Clone () 28 | { 29 | var p = new DFormattingPolicy (); 30 | 31 | p.CommentOutStandardHeaders = CommentOutStandardHeaders; 32 | p.InsertStarAtCommentNewLine = InsertStarAtCommentNewLine; 33 | p.KeepAlignmentSpaces = KeepAlignmentSpaces; 34 | p.o = o.Clone() as DFormattingOptions; 35 | 36 | return p; 37 | } 38 | 39 | DFormattingOptions o = DFormattingOptions.CreateDStandard(); 40 | 41 | public DFormattingOptions Options { 42 | get { 43 | return o; 44 | } 45 | } 46 | 47 | [ItemProperty] 48 | public bool CommentOutStandardHeaders { get; set; } 49 | [ItemProperty] 50 | public bool InsertStarAtCommentNewLine { get; set; } 51 | 52 | #region Indenting 53 | [ItemProperty] 54 | public bool IndentSwitchBody { 55 | get{ return o.IndentSwitchBody; } 56 | set{ o.IndentSwitchBody = value; } 57 | } 58 | [ItemProperty] 59 | public GotoLabelIndentStyle LabelIndentStyle { 60 | get{ return o.LabelIndentStyle; } 61 | set{ o.LabelIndentStyle = value; } 62 | } 63 | [ItemProperty] 64 | public bool KeepAlignmentSpaces { get; set; } 65 | [ItemProperty] 66 | public bool IndentPastedCodeLines { get; set; } 67 | #endregion 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/DPolicy.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | True 4 | True 5 | True 6 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/DietTemplateFormattingPanel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DietTemplateFormattingPanel.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Ide.Gui.Dialogs; 28 | 29 | namespace MonoDevelop.D.Formatting 30 | { 31 | class DietTemplateFormattingPolicy : IEquatable { 32 | #region IEquatable implementation 33 | 34 | public bool Equals (DietTemplateFormattingPolicy other) 35 | { 36 | return true; 37 | } 38 | 39 | #endregion 40 | 41 | 42 | } 43 | 44 | class DietTemplateFormattingWidget : Gtk.Bin { 45 | 46 | } 47 | 48 | class DietTemplateFormattingPanel : MimeTypePolicyOptionsPanel 49 | { 50 | DietTemplateFormattingPolicy policy = new DietTemplateFormattingPolicy(); 51 | 52 | public DietTemplateFormattingPanel () 53 | { 54 | } 55 | 56 | #region implemented abstract members of OptionsPanel 57 | 58 | public override Gtk.Widget CreatePanelWidget () 59 | { 60 | return new DietTemplateFormattingWidget(); 61 | } 62 | 63 | #endregion 64 | 65 | #region implemented abstract members of MimeTypePolicyOptionsPanel 66 | 67 | protected override void LoadFrom (DietTemplateFormattingPolicy policy) 68 | { 69 | this.policy = policy; 70 | } 71 | 72 | protected override DietTemplateFormattingPolicy GetPolicy () 73 | { 74 | return policy; 75 | } 76 | 77 | #endregion 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/FormattingPanel.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Ide.Gui.Dialogs; 2 | using Gtk; 3 | 4 | namespace MonoDevelop.D.Formatting 5 | { 6 | class FormattingPanel : MimeTypePolicyOptionsPanel 7 | { 8 | FormattingPanelWidget panel; 9 | DFormattingPolicy pol; 10 | 11 | public override Widget CreatePanelWidget () 12 | { 13 | return panel = new FormattingPanelWidget (); 14 | } 15 | 16 | protected override void LoadFrom (DFormattingPolicy policy) 17 | { 18 | panel.Load(pol = policy); 19 | } 20 | 21 | protected override DFormattingPolicy GetPolicy () 22 | { 23 | if (pol == null) 24 | pol = new DFormattingPolicy(); 25 | 26 | panel.Save(pol); 27 | return pol; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/FormattingPanelWidget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoDevelop.D.Formatting 4 | { 5 | [System.ComponentModel.ToolboxItem(true)] 6 | public partial class FormattingPanelWidget : Gtk.Bin 7 | { 8 | public void Save(DFormattingPolicy p) 9 | { 10 | if (p == null) 11 | throw new ArgumentNullException("p"); 12 | 13 | p.CommentOutStandardHeaders = chk_CommentOutStdHeaders.Active; 14 | p.InsertStarAtCommentNewLine = chk_InsertStarAtCommentNewLine.Active; 15 | p.KeepAlignmentSpaces = check_KeepAlignmentSpaces.Active; 16 | p.IndentPastedCodeLines = check_IndentPastedCodeLines.Active; 17 | } 18 | 19 | public void Load(DFormattingPolicy p) 20 | { 21 | if (p == null) 22 | throw new ArgumentNullException("p"); 23 | 24 | chk_CommentOutStdHeaders.Active = p.CommentOutStandardHeaders; 25 | chk_InsertStarAtCommentNewLine.Active = p.InsertStarAtCommentNewLine; 26 | check_KeepAlignmentSpaces.Active = p.KeepAlignmentSpaces; 27 | check_IndentPastedCodeLines.Active = p.IndentPastedCodeLines; 28 | } 29 | 30 | public FormattingPanelWidget () 31 | { 32 | this.Build (); 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/Indentation/DIndentEngine.cs: -------------------------------------------------------------------------------- 1 | using D_Parser.Formatting; 2 | using D_Parser.Formatting.Indent; 3 | using MonoDevelop.Ide.Gui.Content; 4 | 5 | namespace MonoDevelop.D.Formatting.Indentation 6 | { 7 | public class DIndentEngine : IndentEngine, IDocumentStateEngine, DFormattingOptionsFactory 8 | { 9 | DFormattingPolicy policy; 10 | TextStylePolicy textStyle; 11 | 12 | public DIndentEngine(DFormattingPolicy policy, TextStylePolicy textStyle) 13 | : base(policy.Options, textStyle.TabsToSpaces, textStyle.IndentWidth, policy.KeepAlignmentSpaces) 14 | { 15 | this.policy = policy; 16 | this.textStyle = textStyle; 17 | } 18 | 19 | protected override IndentEngine Construct() 20 | { 21 | return new DIndentEngine(policy, textStyle); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/Indentation/DIndentationTracker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mono.TextEditor; 3 | using MonoDevelop.Ide.Gui.Content; 4 | 5 | namespace MonoDevelop.D.Formatting.Indentation 6 | { 7 | public class DIndentationTracker: IIndentationTracker 8 | { 9 | TextEditorData data; 10 | DocumentStateTracker stateTracker; 11 | 12 | public DIndentationTracker (TextEditorData data, DocumentStateTracker stateTracker) 13 | { 14 | this.data = data; 15 | this.stateTracker = stateTracker; 16 | } 17 | 18 | string GetIndentationString (int offset, DocumentLocation loc) 19 | { 20 | stateTracker.UpdateEngine (Math.Min (data.Length, offset + 1)); 21 | DocumentLine line = data.Document.GetLine (loc.Line); 22 | if (line == null) 23 | return ""; 24 | // Get context to the end of the line w/o changing the main engine's state 25 | var ctx = stateTracker.Engine.Clone () as DIndentEngine; 26 | for (int max = offset; max < line.Offset + line.Length; max++) { 27 | ctx.Push (data.Document.GetCharAt (max)); 28 | } 29 | // int pos = line.Offset; 30 | string curIndent = line.GetIndentation (data.Document); 31 | int nlwsp = curIndent.Length; 32 | // int o = offset > pos + nlwsp ? offset - (pos + nlwsp) : 0; 33 | if (!stateTracker.Engine.LineBeganInsideMultiLineComment || (nlwsp < line.LengthIncludingDelimiter && data.Document.GetCharAt (line.Offset + nlwsp) == '*')) { 34 | return ctx.ThisLineIndent; 35 | } 36 | return curIndent; 37 | } 38 | public string GetIndentationString (int lineNumber, int column) 39 | { 40 | return GetIndentationString (data.LocationToOffset (lineNumber, column), new DocumentLocation (lineNumber, column)); 41 | } 42 | 43 | public string GetIndentationString (int offset) 44 | { 45 | return GetIndentationString (offset, data.OffsetToLocation (offset)); 46 | } 47 | 48 | string GetIndent (int lineNumber, int column) 49 | { 50 | var line = data.GetLine (lineNumber); 51 | if (line == null) 52 | return ""; 53 | int offset = line.Offset + Math.Min (line.Length, column - 1); 54 | 55 | stateTracker.UpdateEngine (offset); 56 | return stateTracker.Engine.NewLineIndent; 57 | } 58 | 59 | public int GetVirtualIndentationColumn (int offset) 60 | { 61 | return 1 + GetIndentationString (offset).Length; 62 | } 63 | 64 | public int GetVirtualIndentationColumn (int lineNumber, int column) 65 | { 66 | return 1 + GetIndentationString (lineNumber, column).Length; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Formatting/Indentation/doc.txt: -------------------------------------------------------------------------------- 1 | Module info: 2 | 3 | DTextEditorIndentation.cs contains the binding between the Indent engine and MonoDevelop's Text Editor component. 4 | 5 | DIndentationTracker.cs is an intermediate helper that creates indent strings (tabs, spaces) for specific locations inside a document. 6 | 7 | DIndentEngine is the main engine that flies through the code roughly and puts/pops items on/off the indent stack for instance 8 | after it has hit a { or } in the code. 9 | 10 | IndentStack helps the IndentEngine to keep track of the indents that were required theoretically. -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Gui/EditorPathbarProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using D_Parser.Dom; 4 | using Gtk; 5 | using MonoDevelop.Components; 6 | using MonoDevelop.D.Completion; 7 | using MonoDevelop.D.Parser; 8 | using MonoDevelop.Ide; 9 | using MonoDevelop.Ide.Gui; 10 | using D_Parser.Resolver.ASTScanner; 11 | 12 | 13 | namespace MonoDevelop.D.Gui 14 | { 15 | class EditorPathbarProvider : DropDownBoxListWindow.IListDataProvider 16 | { 17 | object tag; 18 | List memberList = new List (); 19 | 20 | Document document { get; set; } 21 | 22 | public EditorPathbarProvider (Document doc, object tag) 23 | { 24 | this.document = doc; 25 | this.tag = ((INode)tag).Parent; 26 | 27 | Reset (); 28 | } 29 | 30 | #region IListDataProvider implementation 31 | 32 | public int IconCount { 33 | get { 34 | return memberList.Count; 35 | } 36 | } 37 | 38 | public void Reset () 39 | { 40 | memberList.Clear (); 41 | if (!(tag is IBlockNode)) 42 | return; 43 | var blockNode = (tag as IBlockNode); 44 | foreach(var nd in blockNode.Children) 45 | if (AbstractVisitor.CanAddMemberOfType(MemberFilter.All, nd)) 46 | memberList.Add(nd); 47 | 48 | memberList.Sort ((x, y) => x.Name.CompareTo(y.Name)); 49 | } 50 | 51 | public string GetMarkup (int n) 52 | { 53 | return memberList[n].Name + DParameterDataProvider.GetNodeParamString(memberList[n]); 54 | } 55 | 56 | Xwt.Drawing.Image DropDownBoxListWindow.IListDataProvider.GetIcon(int n) 57 | { 58 | var icon = DIcons.GetNodeIcon(memberList[n] as DNode); 59 | return ImageService.GetIcon(icon.Name, IconSize.Menu); 60 | } 61 | 62 | public object GetTag (int n) 63 | { 64 | return memberList[n]; 65 | } 66 | 67 | public void ActivateItem (int n) 68 | { 69 | var member = memberList[n]; 70 | MonoDevelop.Ide.Gui.Content.IExtensibleTextEditor extEditor = document.GetContent (); 71 | if (extEditor != null) 72 | extEditor.SetCaretTo (Math.Max (1, member.NameLocation.Line), member.NameLocation.Column); 73 | } 74 | #endregion 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Gui/MixinInsightExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoDevelop.Ide.Gui.Content; 3 | using System.Threading; 4 | using MonoDevelop.Core; 5 | 6 | namespace MonoDevelop.D.Gui 7 | { 8 | public class MixinInsightExtension : TextEditorExtension 9 | { 10 | static AutoResetEvent stateChanged = new AutoResetEvent(false); 11 | static Thread updateTh; 12 | static bool initialized; 13 | 14 | public override void Initialize() 15 | { 16 | base.Initialize(); 17 | 18 | if (!initialized) 19 | { 20 | initialized = true; 21 | 22 | if(MixinInsightPad.EnableCaretTracking) 23 | StartUpdateThread(); 24 | 25 | PropertyService.AddPropertyHandler(MixinInsightPad.activateAutomatedCaretTrackingPropId, (object s, PropertyChangedEventArgs pea) => 26 | { 27 | if ((bool)pea.NewValue) 28 | { 29 | StartUpdateThread(); 30 | } 31 | else if (updateTh != null) 32 | { 33 | updateTh.Abort(); 34 | } 35 | }); 36 | } 37 | 38 | Document.DocumentParsed += Document_DocumentParsed; 39 | } 40 | 41 | static void StartUpdateThread() 42 | { 43 | if(updateTh == null || !updateTh.IsAlive){ 44 | updateTh = new Thread(updateTh_method); 45 | updateTh.IsBackground = true; 46 | updateTh.Priority = ThreadPriority.Lowest; 47 | updateTh.Start(); 48 | } 49 | } 50 | 51 | void Document_DocumentParsed(object sender, EventArgs e) 52 | { 53 | stateChanged.Set(); 54 | } 55 | 56 | public override void Dispose() 57 | { 58 | Document.DocumentParsed -= Document_DocumentParsed; 59 | } 60 | 61 | public override void TextChanged(int startIndex, int endIndex) 62 | { 63 | stateChanged.Set(); 64 | base.TextChanged(startIndex, endIndex); 65 | } 66 | 67 | public override void CursorPositionChanged() 68 | { 69 | base.CursorPositionChanged(); 70 | stateChanged.Set(); 71 | } 72 | 73 | static void updateTh_method() 74 | { 75 | while (true) 76 | { 77 | stateChanged.WaitOne(); 78 | while (stateChanged.WaitOne(400)); 79 | 80 | var pad = MixinInsightPad.Instance; 81 | if (pad != null && pad.Window.ContentVisible) 82 | pad.Update(); 83 | } 84 | } 85 | 86 | public override bool ExtendsEditor(MonoDevelop.Ide.Gui.Document doc, IEditableTextBuffer editor) 87 | { 88 | return doc.IsFile && DLanguageBinding.IsDFile(doc.FileName); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/GuiBuilder/GtkDProjectServiceExtension.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GtkDProjectServiceExtension.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2014 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Projects; 28 | 29 | namespace MonoDevelop.D 30 | { 31 | /// 32 | /// Responsible for generating the gtkD-Code when building a project 33 | /// 34 | public class GtkDProjectServiceExtension : ProjectServiceExtension 35 | { 36 | public GtkDProjectServiceExtension () 37 | { 38 | } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/GuiBuilder/GuiBuilderWindow.cs: -------------------------------------------------------------------------------- 1 | // 2 | // GuiBuilderWindow.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2014 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.GtkCore.GuiBuilder; 28 | using MonoDevelop.Core; 29 | 30 | namespace MonoDevelop.D.GuiBuilder 31 | { 32 | public class GuiBuilderWindow : IDisposable 33 | { 34 | Stetic.WidgetInfo rootWidget; 35 | GuiBuilderProject fproject; 36 | Stetic.Project gproject; 37 | string name; 38 | 39 | public event WindowEventHandler Changed; 40 | 41 | internal GuiBuilderWindow (GuiBuilderProject fproject, Stetic.Project gproject, Stetic.WidgetInfo rootWidget) 42 | { 43 | this.fproject = fproject; 44 | this.rootWidget = rootWidget; 45 | this.gproject = gproject; 46 | name = rootWidget.Name; 47 | gproject.ProjectReloaded += OnProjectReloaded; 48 | rootWidget.Changed += OnChanged; 49 | } 50 | 51 | public Stetic.WidgetInfo RootWidget { 52 | get { return rootWidget; } 53 | } 54 | 55 | public GuiBuilderProject Project { 56 | get { return fproject; } 57 | } 58 | 59 | public string Name { 60 | get { return rootWidget.Name; } 61 | } 62 | 63 | public FilePath SourceCodeFile { 64 | get { return fproject.GetSourceCodeFile (rootWidget); } 65 | } 66 | 67 | public void Dispose () 68 | { 69 | gproject.ProjectReloaded -= OnProjectReloaded; 70 | rootWidget.Changed -= OnChanged; 71 | } 72 | 73 | void OnProjectReloaded (object s, EventArgs args) 74 | { 75 | rootWidget.Changed -= OnChanged; 76 | rootWidget = gproject.GetWidget (name); 77 | if (rootWidget != null) 78 | rootWidget.Changed += OnChanged; 79 | } 80 | 81 | void OnChanged (object o, EventArgs args) 82 | { 83 | // Update the name, it may have changed 84 | name = rootWidget.Name; 85 | 86 | if (Changed != null) 87 | Changed (this, new WindowEventArgs (this)); 88 | } 89 | /* 90 | void AddSignalsRec (CodeTypeDeclaration type, Stetic.Component comp) 91 | { 92 | foreach (Stetic.Signal signal in comp.GetSignals ()) { 93 | CodeMemberMethod met = new CodeMemberMethod (); 94 | met.Name = signal.Handler; 95 | met.Attributes = MemberAttributes.Family; 96 | met.ReturnType = new CodeTypeReference (signal.SignalDescriptor.HandlerReturnTypeName); 97 | 98 | foreach (Stetic.ParameterDescriptor pinfo in signal.SignalDescriptor.HandlerParameters) 99 | met.Parameters.Add (new CodeParameterDeclarationExpression (pinfo.TypeName, pinfo.Name)); 100 | 101 | type.Members.Add (met); 102 | } 103 | foreach (Stetic.Component cc in comp.GetChildren ()) { 104 | AddSignalsRec (type, cc); 105 | } 106 | }*/ 107 | } 108 | } 109 | 110 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/GuiBuilder/ProjectResourceProvider.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DProjectResourceProvider.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2014 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Projects; 28 | 29 | namespace MonoDevelop.D.GuiBuilder 30 | { 31 | public class ProjectResourceProvider : MarshalByRefObject, Stetic.IResourceProvider 32 | { 33 | protected Project project; 34 | public virtual Project Project{ get{ return project; } } 35 | 36 | public ProjectResourceProvider (Project prj) 37 | { 38 | this.project = prj; 39 | } 40 | 41 | public Stetic.ResourceInfo[] GetResources () 42 | { 43 | return new Stetic.ResourceInfo[0]; 44 | } 45 | 46 | public System.IO.Stream GetResourceStream (string resourceName) 47 | { 48 | return null; 49 | } 50 | 51 | public Stetic.ResourceInfo AddResource (string fileName) 52 | { 53 | return null; 54 | } 55 | 56 | public void RemoveResource (string resourceName) 57 | { 58 | 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Highlighting/DietTemplateSyntaxMode.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DietTemplateSyntaxMode.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using Mono.TextEditor.Highlighting; 27 | using System.Collections.Generic; 28 | using System.Linq; 29 | using Mono.TextEditor; 30 | 31 | namespace MonoDevelop.D.Highlighting 32 | { 33 | public class DietTemplateSyntaxMode : SyntaxMode 34 | { 35 | static SyntaxMode baseMode; 36 | 37 | public DietTemplateSyntaxMode () 38 | { 39 | var matches = new List(); 40 | 41 | if (baseMode == null) 42 | { 43 | var provider = new ResourceStreamProvider( 44 | typeof(DietTemplateSyntaxMode).Assembly, 45 | typeof(DietTemplateSyntaxMode).Assembly.GetManifestResourceNames().First(s => s.Contains("DietTemplateSyntaxDefinition"))); 46 | using (var s = provider.Open()) 47 | baseMode = SyntaxMode.Read(s); 48 | } 49 | 50 | this.rules = new List(baseMode.Rules); 51 | this.keywords = new List(baseMode.Keywords); 52 | this.spans = new List(baseMode.Spans.Where(span => span.Begin.Pattern != "#")).ToArray(); 53 | matches.AddRange(baseMode.Matches); 54 | this.prevMarker = baseMode.PrevMarker; 55 | this.SemanticRules = new List(baseMode.SemanticRules); 56 | SemanticRules.Add(InlineDHighlighting.Instance); 57 | this.keywordTable = baseMode.keywordTable; 58 | this.keywordTableIgnoreCase = baseMode.keywordTableIgnoreCase; 59 | this.properties = baseMode.Properties; 60 | 61 | // D Number literals 62 | matches.Add(DSyntaxMode.workaroundMatchCtor( 63 | "Number" 64 | , @" (?()); 86 | var chunkP = new ChunkParser(DSyntax, spanParser, Ide.IdeApp.Workbench.ActiveDocument.Editor.ColorStyle, line); 87 | 88 | var n = chunkP.GetChunks(startOffset, endOffset - startOffset); 89 | if (n == null) 90 | return; 91 | startChunk.Next = n; 92 | startChunk.Length = n.Offset - startChunk.Offset; 93 | } 94 | } 95 | } 96 | } 97 | 98 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Highlighting/HighlightUsagesExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using D_Parser.Dom; 5 | using D_Parser.Misc; 6 | using D_Parser.Resolver; 7 | using Mono.TextEditor; 8 | using MonoDevelop.Core; 9 | using MonoDevelop.D.Building; 10 | using MonoDevelop.D.Parser; 11 | using MonoDevelop.D.Resolver; 12 | using MonoDevelop.Ide.Gui.Content; 13 | using MonoDevelop.D.Projects; 14 | 15 | // Code taken and modified from MonoDevelop.CSharp.Highlighting.HighlightUsagesExtension.cs 16 | using D_Parser.Completion; 17 | using MonoDevelop.SourceEditor; 18 | using ICSharpCode.NRefactory; 19 | 20 | namespace MonoDevelop.D.Highlighting 21 | { 22 | class HighlightUsagesExtension : AbstractUsagesExtension> 23 | { 24 | public DModule SyntaxTree 25 | { 26 | get { 27 | return Document.GetDAst (); 28 | } 29 | } 30 | 31 | public override void Initialize() 32 | { 33 | base.Initialize(); 34 | 35 | // Enable proper semantic highlighting because the syntaxmode won't be given the editor doc by default. 36 | var sm = Document.Editor.Document.SyntaxMode as DSyntaxMode; 37 | if (sm != null) 38 | sm.GuiDocument = Document; 39 | } 40 | 41 | protected override bool TryResolve(out Tuple resolveResult) 42 | { 43 | ResolutionContext lastCtxt; 44 | IEditorData ed; 45 | var rr = DResolverWrapper.ResolveHoveredCode(out lastCtxt, out ed, Document); 46 | 47 | if (rr == null || rr.Length < 1 || !(rr[0] is DSymbol)) 48 | { 49 | resolveResult = null; 50 | return false; 51 | } 52 | 53 | resolveResult = new Tuple(lastCtxt, rr[0] as DSymbol); 54 | 55 | return true; 56 | } 57 | 58 | protected override IEnumerable GetReferences(Tuple tup, System.Threading.CancellationToken token) 59 | { 60 | var ctxt = tup.Item1; 61 | ctxt.CancellationToken = token; 62 | var mr = tup.Item2; 63 | 64 | var referencedNode = mr.Definition; 65 | 66 | // Slightly hacky: To keep highlighting the id of e.g. a NewExpression, take the ctor's parent node (i.e. the class node) 67 | if (referencedNode is DMethod && ((DMethod)referencedNode).SpecialType == DMethod.MethodType.Constructor) 68 | { 69 | mr = mr.Base as DSymbol; 70 | if (mr == null) 71 | yield break; 72 | referencedNode = mr.Definition; 73 | } 74 | 75 | IEnumerable refs = null; 76 | 77 | CodeCompletion.DoTimeoutableCompletionTask (null, ctxt, () => { 78 | try { 79 | refs = D_Parser.Refactoring.ReferencesFinder.SearchModuleForASTNodeReferences (SyntaxTree, referencedNode, ctxt); 80 | } catch (Exception ex) { 81 | LoggingService.LogInfo ("Error during highlighting usages", ex); 82 | } 83 | }); 84 | 85 | if(refs != null) 86 | foreach (var sr in refs) 87 | { 88 | CodeLocation loc; 89 | int len; 90 | if (sr is INode) 91 | { 92 | loc = (sr as INode).NameLocation; 93 | len = (sr as INode).Name.Length; 94 | } 95 | else if (sr is TemplateParameter) 96 | { 97 | loc = (sr as TemplateParameter).NameLocation; 98 | len = (sr as TemplateParameter).Name.Length; 99 | } 100 | else 101 | { 102 | loc = sr.Location; 103 | len = sr.EndLocation.Column - loc.Column; 104 | } 105 | 106 | yield return new Ide.FindInFiles.MemberReference(sr, 107 | new ICSharpCode.NRefactory.TypeSystem.DomRegion(Document.FileName, loc.Line, loc.Column, loc.Line, loc.Column + len), 108 | Document.Editor.LocationToOffset(loc.Line, loc.Column), len); 109 | } 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/CompilerOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Mono.Addins; 7 | using MonoDevelop.Core; 8 | using MonoDevelop.Ide.Projects; 9 | using MonoDevelop.Ide.Gui.Dialogs; 10 | using MonoDevelop.D.Building; 11 | 12 | namespace MonoDevelop.D.OptionPanels 13 | { 14 | /// 15 | /// This panel provides UI access to project independent D settings such as generic compiler configurations, library and import paths etc. 16 | /// 17 | public partial class CompilerOptions : Gtk.Bin 18 | { 19 | private Gtk.ListStore compilerStore = new Gtk.ListStore (typeof(string)); 20 | private DCompilerService configuration; 21 | 22 | public CompilerOptions () 23 | { 24 | this.Build (); 25 | 26 | cmbCompiler.Clear (); 27 | Gtk.CellRendererText cellRenderer = new Gtk.CellRendererText (); 28 | cmbCompiler.PackStart (cellRenderer, false); 29 | cmbCompiler.AddAttribute (cellRenderer, "text", 0); 30 | 31 | cmbCompiler.Model = compilerStore; 32 | 33 | foreach (var cmp in DCompilerService.Instance.Compilers) 34 | compilerStore.AppendValues (cmp.Vendor); 35 | } 36 | 37 | public void Load (DCompilerService config) 38 | { 39 | configuration = config; 40 | 41 | //cmbCompiler.Active = (int)config.DefaultCompiler; 42 | Gtk.TreeIter iter; 43 | cmbCompiler.Model.GetIterFirst (out iter); 44 | if (cmbCompiler.Model.GetIterFirst (out iter)) { 45 | do { 46 | if (config.DefaultCompiler == cmbCompiler.Model.GetValue (iter, 0) as string) { 47 | cmbCompiler.SetActiveIter (iter); 48 | break; 49 | } 50 | } while (cmbCompiler.Model.IterNext (ref iter)); 51 | } 52 | 53 | check_EnableUFCSCompletion.Active = config.CompletionOptions.ShowUFCSItems; 54 | } 55 | 56 | public bool Validate () 57 | { 58 | return true; 59 | } 60 | 61 | public bool Store () 62 | { 63 | if (configuration == null) 64 | return false; 65 | 66 | //configuration.DefaultCompiler = (DCompilerVendor)cmbCompiler.Active; 67 | Gtk.TreeIter iter; 68 | if (cmbCompiler.GetActiveIter (out iter)) 69 | configuration.DefaultCompiler = cmbCompiler.Model.GetValue (iter, 0) as string; 70 | 71 | configuration.CompletionOptions.ShowUFCSItems = check_EnableUFCSCompletion.Active; 72 | 73 | return true; 74 | } 75 | 76 | } 77 | 78 | public class CompilerOptionsBinding : OptionsPanel 79 | { 80 | private CompilerOptions panel; 81 | 82 | public override Gtk.Widget CreatePanelWidget () 83 | { 84 | panel = new CompilerOptions (); 85 | panel.Load (DCompilerService.Instance); 86 | return panel; 87 | } 88 | 89 | public override bool ValidateChanges () 90 | { 91 | return panel.Validate (); 92 | } 93 | 94 | public override void ApplyChanges () 95 | { 96 | panel.Store (); 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/DubOptionPanel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DubOptionPanel.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using MonoDevelop.Ide.Gui.Dialogs; 27 | 28 | namespace MonoDevelop.D.OptionPanels 29 | { 30 | [System.ComponentModel.ToolboxItem (true)] 31 | public partial class DubOptionPanel : Gtk.Bin 32 | { 33 | public DubOptionPanel () 34 | { 35 | this.Build (); 36 | 37 | text_dub.Text = DubSettings.Instance.DubCommand; 38 | text_commonArgs.Text = DubSettings.Instance.CommonArgs; 39 | } 40 | 41 | public void ApplyChanges() 42 | { 43 | DubSettings.Instance.DubCommand = text_dub.Text; 44 | DubSettings.Instance.CommonArgs = text_commonArgs.Text; 45 | } 46 | 47 | public bool Valid 48 | { 49 | get{ 50 | return !string.IsNullOrWhiteSpace(text_dub.Text); 51 | } 52 | } 53 | } 54 | 55 | public class DubOptionPanelBinding : OptionsPanel 56 | { 57 | DubOptionPanel pan; 58 | public override Gtk.Widget CreatePanelWidget () 59 | { 60 | return pan = new DubOptionPanel (); 61 | } 62 | 63 | public override void ApplyChanges () 64 | { 65 | pan.ApplyChanges (); 66 | } 67 | 68 | public override bool ValidateChanges () 69 | { 70 | return pan.Valid; 71 | } 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/EditCompilerName.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoDevelop.D.OptionPanels 3 | { 4 | public partial class EditCompilerName : Gtk.Dialog 5 | { 6 | public EditCompilerName () 7 | { 8 | this.Build (); 9 | } 10 | 11 | public string PresetName { 12 | get { return txtPresetName.Text.Trim (); } 13 | set { txtPresetName.Text = value; } 14 | } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/ProjectDependenciesWidget.cs: -------------------------------------------------------------------------------- 1 | using Gtk; 2 | using MonoDevelop.D.Projects; 3 | using System; 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using MonoDevelop.Projects; 7 | 8 | namespace MonoDevelop.D 9 | { 10 | [System.ComponentModel.ToolboxItem(true)] 11 | public partial class ProjectDependenciesWidget : Bin 12 | { 13 | public readonly DProject Project; 14 | public readonly DProjectConfiguration CurrentConfig; 15 | public ProjectDependenciesWidget (DProject prj, DProjectConfiguration cfg) 16 | { 17 | this.Build (); 18 | Show(); 19 | 20 | Project = prj; 21 | CurrentConfig = cfg; 22 | } 23 | 24 | public void Load() 25 | { 26 | // Remove old children list 27 | var depsChildren = ((ArrayList)vbox_ProjectDeps.AllChildren); 28 | for (int k = depsChildren.Count - 1; k >= 0; k--) 29 | vbox_ProjectDeps.Remove((Widget)depsChildren[k]); 30 | 31 | // Init new project dep list 32 | int i = 0; 33 | var refs_ = Project.References.ReferencedProjectIds; 34 | var refs = refs_ as IList ?? new List(refs_); 35 | 36 | foreach(var prj in Project.ParentSolution.GetAllProjects()) 37 | { 38 | if (prj == Project) 39 | continue; 40 | 41 | var cb = new CheckButton(prj.Name){ 42 | CanFocus=true, 43 | DrawIndicator=true, 44 | UseUnderline=false, 45 | Active = refs.Contains(prj.ItemId) 46 | }; 47 | 48 | cb.Data.Add("prj", prj); 49 | 50 | vbox_ProjectDeps.Add(cb); 51 | 52 | var bc=(Box.BoxChild)vbox_ProjectDeps[cb]; 53 | bc.Expand=false; 54 | bc.Fill=false; 55 | bc.Position=i++; 56 | } 57 | vbox_ProjectDeps.ShowAll(); 58 | } 59 | 60 | public void Store() 61 | { 62 | var tbl = new List(Project.References.ReferencedProjectIds); 63 | var refs = Project.References as DefaultDReferencesCollection; 64 | 65 | foreach (var i in vbox_ProjectDeps) 66 | { 67 | var cb = i as CheckButton; 68 | 69 | if (cb == null) 70 | continue; 71 | 72 | var prj = cb.Data["prj"] as DProject; 73 | if (prj == null) 74 | continue; 75 | 76 | var id = prj.ItemId; 77 | 78 | if (cb.Active) { 79 | if (!tbl.Contains (id)) 80 | refs.ProjectDependencies.Add(id); 81 | else 82 | tbl.Remove (id); 83 | } else { 84 | if (tbl.Contains (id)) { 85 | refs.ProjectDependencies.Remove (id); 86 | tbl.Remove (id); 87 | } 88 | } 89 | } 90 | 91 | foreach (var id in tbl) 92 | refs.ProjectDependencies.Remove (id); 93 | } 94 | } 95 | } 96 | 97 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/ProjectDependencyPanelBinding.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Ide.Gui.Dialogs; 2 | using Gtk; 3 | using MonoDevelop.D.Projects; 4 | 5 | namespace MonoDevelop.D.OptionsPanels 6 | { 7 | public class ProjectDependencyPanelBinding : MultiConfigItemOptionsPanel 8 | { 9 | ProjectDependenciesWidget w; 10 | 11 | public override Widget CreatePanelWidget () 12 | { 13 | if(w==null) 14 | w = new ProjectDependenciesWidget(ConfiguredProject as DProject, CurrentConfiguration as DProjectConfiguration); 15 | 16 | return w; 17 | } 18 | 19 | public override void ApplyChanges () 20 | { 21 | w.Store(); 22 | } 23 | 24 | public override void LoadConfigData () 25 | { 26 | w.Load(); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/ProjectIncludesWidget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoDevelop.Core; 3 | using MonoDevelop.D.Projects; 4 | namespace MonoDevelop.D 5 | { 6 | [System.ComponentModel.ToolboxItem(true)] 7 | public partial class ProjectIncludesWidget : Gtk.Bin 8 | { 9 | public readonly DProject Project; 10 | public readonly DProjectConfiguration CurrentConfig; 11 | public ProjectIncludesWidget (DProject prj, DProjectConfiguration cfg) 12 | { 13 | this.Build (); 14 | 15 | Project = prj; 16 | CurrentConfig = cfg; 17 | } 18 | 19 | public void Load() 20 | { 21 | text_Includes.Buffer.Text = string.Join ("\n", Project.References.RawIncludes); 22 | } 23 | 24 | public void Store() 25 | { 26 | int oldHash=0, newHash = 0; 27 | var refs = Project.References.RawIncludes; 28 | foreach (var p in refs) 29 | oldHash += p.GetHashCode (); 30 | refs.Clear (); 31 | 32 | foreach (var p in text_Includes.Buffer.Text.Split('\n')) { 33 | var p_ = p.Trim().TrimEnd ('\\', '/'); 34 | if (string.IsNullOrWhiteSpace(p_)) 35 | continue; 36 | refs.Add (p_); 37 | newHash += p_.GetHashCode (); 38 | } 39 | 40 | if (oldHash != newHash) { // Only reparse if paths changed 41 | Project.NeedsFullRebuild = true; 42 | 43 | try { 44 | // Update parse cache immediately 45 | Project.UpdateLocalIncludeCache (); 46 | } catch (Exception ex) { 47 | LoggingService.LogError ("Include path analysis error", ex); 48 | } 49 | } 50 | } 51 | 52 | protected void OnButtonAddIncludeClicked(object sender, EventArgs e) 53 | { 54 | var dialog = new Gtk.FileChooserDialog( 55 | "Select D Source Folder", 56 | Ide.IdeApp.Workbench.RootWindow, 57 | Gtk.FileChooserAction.SelectFolder, 58 | "Cancel", 59 | Gtk.ResponseType.Cancel, 60 | "Ok", 61 | Gtk.ResponseType.Ok) 62 | { 63 | TransientFor = Toplevel as Gtk.Window, 64 | WindowPosition = Gtk.WindowPosition.Center 65 | }; 66 | 67 | try 68 | { 69 | if (dialog.Run() == (int)Gtk.ResponseType.Ok) 70 | { 71 | text_Includes.Buffer.Text += (text_Includes.Buffer.CharCount == 0 ? "" : "\n") + string.Join("\n", dialog.Filenames); 72 | } 73 | } 74 | finally 75 | { 76 | dialog.Destroy(); 77 | } 78 | } 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/ProjectIncludesWidgetBinding.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Ide.Gui.Dialogs; 2 | using Gtk; 3 | using MonoDevelop.D.Projects; 4 | 5 | namespace MonoDevelop.D.OptionsPanels 6 | { 7 | public class ProjectIncludesWidgetBinding : MultiConfigItemOptionsPanel 8 | { 9 | ProjectIncludesWidget w; 10 | 11 | public override Widget CreatePanelWidget () 12 | { 13 | if(w==null) 14 | w = new ProjectIncludesWidget(ConfiguredProject as DProject, CurrentConfiguration as DProjectConfiguration); 15 | 16 | return w; 17 | } 18 | 19 | public override void ApplyChanges () 20 | { 21 | w.Store(); 22 | } 23 | 24 | public override void LoadConfigData () 25 | { 26 | w.Load(); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/ResourcesCompilerOptions.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.D.Building; 2 | using MonoDevelop.Ide.Gui.Dialogs; 3 | 4 | namespace MonoDevelop.D 5 | { 6 | public partial class ResourcesCompilerOptionsPanel : Gtk.Bin 7 | { 8 | public ResourcesCompilerOptionsPanel () 9 | { 10 | this.Build (); 11 | } 12 | 13 | public void Load() 14 | { 15 | text_CompilerExecutable.Text=Win32ResourceCompiler.Instance. Executable; 16 | text_BuildArgs.Text = Win32ResourceCompiler.Instance.Arguments; 17 | } 18 | 19 | public bool Validate() 20 | { 21 | return text_CompilerExecutable.Text!="" && text_BuildArgs.Text!=""; 22 | } 23 | 24 | public void Store() 25 | { 26 | Win32ResourceCompiler.Instance.Executable = text_CompilerExecutable.Text; 27 | Win32ResourceCompiler.Instance.Arguments = text_BuildArgs.Text; 28 | } 29 | } 30 | 31 | public class ResourceCompilerOptionsBinding : OptionsPanel 32 | { 33 | private ResourcesCompilerOptionsPanel panel; 34 | 35 | public override Gtk.Widget CreatePanelWidget () 36 | { 37 | panel = new ResourcesCompilerOptionsPanel (); 38 | panel.Load(); 39 | return panel; 40 | } 41 | 42 | public override bool ValidateChanges() 43 | { 44 | return panel.Validate(); 45 | } 46 | 47 | public override void ApplyChanges () 48 | { 49 | panel.Store (); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/OptionPanels/UnittestOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UnittestOptions.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Ide.Gui.Dialogs; 28 | using MonoDevelop.D.Unittest; 29 | 30 | namespace MonoDevelop.D.OptionPanels 31 | { 32 | [System.ComponentModel.ToolboxItem (true)] 33 | public partial class UnittestOptions : Gtk.Bin 34 | { 35 | public UnittestOptions () 36 | { 37 | this.Build (); 38 | 39 | text_UnittestCommand.Text = UnittestSettings.UnittestCommand; 40 | text_MainCreationFlag.Text = UnittestSettings.MainMethodFlag; 41 | } 42 | 43 | public void Save() 44 | { 45 | UnittestSettings.UnittestCommand = text_UnittestCommand.Text; 46 | UnittestSettings.MainMethodFlag = text_MainCreationFlag.Text; 47 | } 48 | 49 | protected void Reset_MainMethodFlag (object sender, EventArgs e) 50 | { 51 | text_MainCreationFlag.Text = UnittestSettings.MainMethodFlag_Default; 52 | } 53 | 54 | protected void Reset_UnittestCmd (object sender, EventArgs e) 55 | { 56 | text_UnittestCommand.Text = UnittestSettings.UnittestCommand_Default; 57 | } 58 | } 59 | 60 | public class UnittestOptionsBinding : OptionsPanel 61 | { 62 | UnittestOptions w; 63 | public override Gtk.Widget CreatePanelWidget () 64 | { 65 | return w = new UnittestOptions (); 66 | } 67 | 68 | public override void ApplyChanges () 69 | { 70 | w.Save (); 71 | } 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Parser/DPseudoUnresolvedFile.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DPseudoUnresolvedFile.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2014 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using ICSharpCode.NRefactory.TypeSystem; 28 | using System.Collections.Generic; 29 | using ICSharpCode.NRefactory; 30 | 31 | namespace MonoDevelop.D.Parser 32 | { 33 | public class DPseudoUnresolvedFile : IUnresolvedFile 34 | { 35 | public readonly ParsedDModule DModule; 36 | 37 | public DPseudoUnresolvedFile (ParsedDModule dmod) 38 | { 39 | this.DModule = dmod; 40 | } 41 | 42 | #region IUnresolvedFile implementation 43 | 44 | public IUnresolvedTypeDefinition GetTopLevelTypeDefinition (TextLocation location) 45 | { 46 | return null; 47 | } 48 | 49 | public IUnresolvedTypeDefinition GetInnermostTypeDefinition (TextLocation location) 50 | { 51 | return null; 52 | } 53 | 54 | public IUnresolvedMember GetMember (TextLocation location) 55 | { 56 | return null; 57 | } 58 | 59 | public string FileName { 60 | get{ return DModule.FileName; } 61 | } 62 | 63 | public DateTime? LastWriteTime { 64 | get ; 65 | set ; 66 | } 67 | 68 | public IList TopLevelTypeDefinitions { 69 | get { 70 | return EmptyList.Instance; 71 | } 72 | } 73 | 74 | public IList AssemblyAttributes { 75 | get { 76 | return EmptyList.Instance; 77 | } 78 | } 79 | 80 | public IList ModuleAttributes { 81 | get { 82 | return EmptyList.Instance; 83 | } 84 | } 85 | 86 | public IList Errors { 87 | get { 88 | return EmptyList.Instance; 89 | } 90 | } 91 | 92 | #endregion 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Parser/FoldingParser.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using MonoDevelop.Ide.TypeSystem; 3 | 4 | namespace MonoDevelop.D.Parser 5 | { 6 | public class FoldingParser : IFoldingParser 7 | { 8 | public ParsedDocument Parse(string fileName, string content) 9 | { 10 | using (var s = new StringReader(content)) 11 | return DParserWrapper.LastParsedMod = DParserWrapper.Instance.Parse(true, fileName, s); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Profiler/Commands/ProfilerCommands.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace MonoDevelop.D.Profiler.Commands 3 | { 4 | public enum ProfilerCommands 5 | { 6 | SwitchProfilerMode, 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Profiler/Commands/ProfilerModeHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // ProfilerModeHandler.cs 3 | // 4 | // Author: 5 | // foerdi <> 6 | // 7 | // Copyright (c) 2013 foerdi 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using MonoDevelop.Components.Commands; 27 | using MonoDevelop.D.Profiler.Gui; 28 | using MonoDevelop.Ide.Gui; 29 | 30 | namespace MonoDevelop.D.Profiler.Commands 31 | { 32 | public class ProfilerModeHandler : CommandHandler 33 | { 34 | private static bool isProfilerMode; 35 | public static bool IsProfilerMode 36 | { 37 | get { return isProfilerMode; } 38 | set 39 | { 40 | var changed = isProfilerMode != value; 41 | isProfilerMode = value; 42 | 43 | var pad = Ide.IdeApp.Workbench.GetPad (); 44 | if(pad == null) 45 | return; 46 | var dpad = pad.Content as DProfilerPad; 47 | if (dpad == null) 48 | return; 49 | 50 | if (isProfilerMode) { 51 | pad.Visible = true; 52 | if (changed) 53 | pad.BringToFront (); 54 | } 55 | 56 | dpad.Widget.RefreshSwitchProfilingIcon(); 57 | } 58 | } 59 | 60 | protected override void Update (CommandInfo info) 61 | { 62 | base.Update (info); 63 | info.Checked = IsProfilerMode; 64 | } 65 | 66 | protected override void Run () 67 | { 68 | IsProfilerMode = !IsProfilerMode; 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Profiler/Gui/CodeCoverageEditorExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MonoDevelop.Ide.Gui.Content; 3 | 4 | namespace MonoDevelop.D.Profiler.Gui 5 | { 6 | public class CodeCoverageEditorExtension : TextEditorExtension 7 | { 8 | public override bool ExtendsEditor (MonoDevelop.Ide.Gui.Document doc, IEditableTextBuffer editor) 9 | { 10 | return doc.IsFile && DLanguageBinding.IsDFile(doc.FileName); 11 | } 12 | 13 | public override void Initialize () 14 | { 15 | Document.Window.AttachViewContent (new CodeCoverageView (Document)); 16 | base.Initialize (); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Profiler/Gui/DProfilerPad.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Ide.Gui.Pads; 2 | using MonoDevelop.D.Profiler.Gui; 3 | using MonoDevelop.Ide.Gui.Components; 4 | using MonoDevelop.Ide.Gui; 5 | using MonoDevelop.D.Profiler.Commands; 6 | using MonoDevelop.D.Projects; 7 | 8 | namespace MonoDevelop.D.Profiler.Gui 9 | { 10 | public class DProfilerPad : TreeViewPad 11 | { 12 | private ProfilerPadWidget widget; 13 | public TraceLogParser TraceParser {get; private set;} 14 | 15 | public ProfilerPadWidget Widget 16 | { 17 | get { return widget; } 18 | } 19 | 20 | public DProfilerPad () 21 | { 22 | widget = new ProfilerPadWidget(this); 23 | TraceParser = new TraceLogParser(widget); 24 | } 25 | 26 | public override void Initialize (NodeBuilder[] builders, TreePadOption[] options, string contextMenuPath) 27 | { 28 | base.Initialize (builders, options, contextMenuPath); 29 | 30 | widget.ShowAll(); 31 | } 32 | 33 | public override Gtk.Widget Control 34 | { 35 | get { return widget; } 36 | } 37 | 38 | public void AnalyseTraceFile() 39 | { 40 | TraceParser.Parse(); 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/ProjectFormats.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/DConfigurationMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoDevelop.D 4 | { 5 | [Flags] 6 | public enum DConfigurationMode 7 | { 8 | Default, 9 | Unittest, 10 | Profile, 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/DProjectBinding.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Projects; 2 | using System.Xml; 3 | using System.IO; 4 | 5 | namespace MonoDevelop.D.Projects 6 | { 7 | public class DProjectBinding:IProjectBinding 8 | { 9 | public bool CanCreateSingleFileProject(string sourceFile) 10 | { 11 | return DLanguageBinding.IsDFile(sourceFile); 12 | } 13 | 14 | public Project CreateProject(ProjectCreateInformation info, XmlElement projectOptions) 15 | { 16 | return new DProject(info,projectOptions); 17 | } 18 | 19 | public Project CreateSingleFileProject(string sourceFile) 20 | { 21 | // Create project information using sourceFile's path 22 | var info = new ProjectCreateInformation() 23 | { 24 | ProjectName = Path.GetFileNameWithoutExtension(sourceFile), 25 | SolutionPath = Path.GetDirectoryName(sourceFile), 26 | ProjectBasePath = Path.GetDirectoryName(sourceFile), 27 | }; 28 | 29 | var prj = CreateProject(info, null); 30 | prj.AddFile(sourceFile); 31 | return prj; 32 | } 33 | 34 | public string Name 35 | { 36 | get { return "D"; } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/DefaultDReferencesCollection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DefaultDReferencesCollection.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Collections.ObjectModel; 28 | using MonoDevelop.D.Building; 29 | using System.Collections.Generic; 30 | 31 | namespace MonoDevelop.D.Projects 32 | { 33 | public class DefaultDReferencesCollection: DProjectReferenceCollection 34 | { 35 | public ObservableCollection ProjectDependencies; 36 | 37 | public override event EventHandler Update; 38 | 39 | public DefaultDReferencesCollection(DProject prj, bool initDepCollection = true) 40 | : base(prj) 41 | { 42 | if(initDepCollection) 43 | { 44 | ProjectDependencies = new ObservableCollection(); 45 | ProjectDependencies.CollectionChanged+=OnProjectDepChanged; 46 | } 47 | } 48 | 49 | internal void InitRefCollection(IEnumerable IDs, IEnumerable includes) 50 | { 51 | ProjectDependencies = new ObservableCollection(IDs); 52 | ProjectDependencies.CollectionChanged+=OnProjectDepChanged; 53 | 54 | foreach (var p in includes) 55 | RawIncludes.Add (ProjectBuilder.EnsureCorrectPathSeparators (p)); 56 | } 57 | 58 | void OnProjectDepChanged(object o, System.Collections.Specialized.NotifyCollectionChangedEventArgs ea) 59 | { 60 | Owner.NeedsFullRebuild = true; 61 | if(Update!=null) 62 | Update(o, ea); 63 | } 64 | 65 | public override void DeleteProjectRef (string projectId) 66 | { 67 | ProjectDependencies.Remove (projectId); 68 | } 69 | 70 | public override bool AddReference () 71 | { 72 | //TODO: Show dialog where a user may put in includes/library files or such.. 73 | //throw new NotImplementedException (); 74 | return false; 75 | } 76 | 77 | public override bool CanDelete { 78 | get { 79 | return true; 80 | } 81 | } 82 | 83 | public override bool CanAdd { 84 | get { 85 | return true; 86 | } 87 | } 88 | 89 | public override IEnumerable ReferencedProjectIds { 90 | get { 91 | return ProjectDependencies; 92 | } 93 | } 94 | 95 | public override bool HasReferences { 96 | get { 97 | return ProjectDependencies.Count > 0 || base.HasReferences; 98 | } 99 | } 100 | 101 | public override void FireUpdate () 102 | { 103 | if(Update!=null) 104 | Update (this, null); 105 | } 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/DubFileFormat.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Core; 2 | using MonoDevelop.Projects.Extensions; 3 | using System; 4 | using System.Collections.Generic; 5 | using MonoDevelop.Projects; 6 | using System.Linq; 7 | using System.IO; 8 | 9 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 10 | { 11 | public class DubFileFormat : IFileFormat 12 | { 13 | public bool CanReadFile(FilePath file, Type expectedObjectType) 14 | { 15 | return DubFileManager.Instance.CanLoad(file.FileName) && 16 | (expectedObjectType.Equals(typeof(WorkspaceItem)) || 17 | expectedObjectType.Equals(typeof(SolutionEntityItem))); 18 | } 19 | 20 | public bool CanWriteFile(object obj) 21 | { 22 | return true; // Everything has to be manipulated manually (atm)! 23 | } 24 | 25 | public void ConvertToFormat(object obj) 26 | { 27 | 28 | } 29 | 30 | public IEnumerable GetCompatibilityWarnings(object obj) 31 | { 32 | yield return string.Empty; 33 | } 34 | 35 | public List GetItemFiles(object obj) 36 | { 37 | return new List(); 38 | } 39 | 40 | public FilePath GetValidFormatName(object obj, FilePath fileName) 41 | { 42 | return fileName; 43 | } 44 | 45 | public object ReadFile(FilePath file, Type expectedType, IProgressMonitor monitor) 46 | { 47 | if (expectedType.IsAssignableFrom(typeof(WorkspaceItem))) 48 | return DubFileManager.Instance.LoadAsSolution(file, monitor); 49 | if (expectedType.IsAssignableFrom(typeof(SolutionEntityItem))) 50 | return DubFileManager.Instance.LoadProject(file, Ide.IdeApp.Workspace.GetAllSolutions().First(), monitor); 51 | return null; 52 | } 53 | 54 | public bool SupportsFramework(Core.Assemblies.TargetFramework framework) 55 | { 56 | return false; 57 | } 58 | 59 | public bool SupportsMixedFormats { get { return true; } } 60 | 61 | public void WriteFile(FilePath file, object obj, IProgressMonitor monitor) 62 | { 63 | //monitor.ReportError ("Can't write dub package information! Change it manually in the definition file!", new InvalidOperationException ()); 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/DubFileManager.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using MonoDevelop.Projects; 8 | 9 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 10 | { 11 | public class DubFileManager 12 | { 13 | #region Properties 14 | 15 | public static readonly DubFileManager Instance = new DubFileManager(); 16 | 17 | readonly HashSet supportedDubFileFormats = new HashSet { 18 | new DubJson (), 19 | new DubSdl() 20 | }; 21 | 22 | #endregion 23 | 24 | DubFileManager() 25 | { 26 | } 27 | 28 | public bool CanLoad(string file) 29 | { 30 | return supportedDubFileFormats.Any((i) => i.CanLoad(file)); 31 | } 32 | 33 | public DubSolution LoadAsSolution(string file, IProgressMonitor monitor) 34 | { 35 | var sln = new DubSolution{ 36 | FileName = file, 37 | BaseDirectory = new FilePath(file).ParentDirectory 38 | }; 39 | 40 | var defaultPackage = LoadProject(file, sln, monitor, LoadFlags.None); 41 | 42 | sln.StartupItem = defaultPackage; 43 | 44 | LoadSubProjects(defaultPackage, monitor); 45 | 46 | // Populate project configurations to solution 47 | if (defaultPackage.Configurations.Count == 0) 48 | sln.CreateDefaultConfigurations (); 49 | else { 50 | foreach (var prjCfg in defaultPackage.Configurations) 51 | sln.AddConfiguration (prjCfg.Name, false); 52 | } 53 | 54 | // Apply subConfigurations 55 | var subConfigurations = new Dictionary(defaultPackage.CommonBuildSettings.subConfigurations); 56 | 57 | foreach (var item in sln.Items) 58 | { 59 | var prj = item as SolutionEntityItem; 60 | if (prj == null) 61 | continue; 62 | 63 | foreach (var cfg in sln.Configurations) 64 | { 65 | var prjItem = cfg.GetEntryForItem(prj); 66 | string cfgId; 67 | if (subConfigurations.TryGetValue(prj.ItemId, out cfgId)) 68 | prjItem.ItemConfiguration = cfgId; 69 | 70 | var prjCfg = defaultPackage.GetConfiguration(cfg.Selector) as DubProjectConfiguration; 71 | if (prjCfg != null && prjCfg.BuildSettings.subConfigurations.TryGetValue(prj.ItemId, out cfgId)) 72 | prjItem.ItemConfiguration = cfgId; 73 | } 74 | } 75 | 76 | sln.LoadUserProperties(); 77 | 78 | return sln; 79 | } 80 | 81 | public enum LoadFlags 82 | { 83 | None, 84 | LoadReferences 85 | } 86 | 87 | public DubProject LoadProject(string file, Solution parentSolution, IProgressMonitor monitor, LoadFlags flags = LoadFlags.LoadReferences, DubProject superProject = null) 88 | { 89 | if(monitor != null) 90 | monitor.BeginTask("Load dub project '" + file + "'", 1); 91 | try 92 | { 93 | var prj = supportedDubFileFormats.First((i) => i.CanLoad(file)).Load(file, superProject, parentSolution); 94 | if (flags.HasFlag(LoadFlags.LoadReferences)) 95 | LoadSubProjects(prj, monitor); 96 | return prj; 97 | } 98 | finally 99 | { 100 | if (monitor != null) 101 | monitor.EndTask(); 102 | } 103 | } 104 | 105 | public void LoadSubProjects(DubProject defaultPackage, IProgressMonitor monitor) 106 | { 107 | var sln = defaultPackage.ParentSolution; 108 | 109 | foreach (var dep in defaultPackage.DubReferences) 110 | { 111 | var file = DubFileReader.GetDubFilePath(defaultPackage, dep.Path); 112 | if (String.IsNullOrWhiteSpace(dep.Path) || !CanLoad(file)) 113 | continue; 114 | 115 | var subProject = supportedDubFileFormats.First((i) => i.CanLoad(file)).Load(file, null, sln); 116 | 117 | if (defaultPackage != subProject) 118 | { 119 | LoadSubProjects (subProject, monitor); 120 | } 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/JSON/JSONArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 5 | { 6 | public class JSONArray : JSONThing 7 | { 8 | public readonly List Items = new List(); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/JSON/JSONObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 5 | { 6 | public class JSONObject : JSONThing 7 | { 8 | public readonly Dictionary Properties = new Dictionary(); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/JSON/JSONThing.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 4 | { 5 | public interface JSONThing{ } 6 | } 7 | 8 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/JSON/JSONThingDeserializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using System.IO; 4 | 5 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 6 | { 7 | public class JSONThingDeserializer 8 | { 9 | public JSONObject Deserialize(TextReader tr) 10 | { 11 | using (var r = new JsonTextReader (tr)) { 12 | r.Read (); 13 | return ReadObject (r); 14 | } 15 | } 16 | 17 | JSONObject ReadObject(JsonReader r) 18 | { 19 | if (r.TokenType != JsonToken.StartObject) 20 | throw new InvalidDataException ("Object begin expected"); 21 | r.Read (); 22 | 23 | var o = new JSONObject(); 24 | while (r.TokenType == JsonToken.PropertyName) { 25 | var name = (r.Value as string).ToLowerInvariant(); 26 | r.Read (); 27 | var thing = ReadThing (r); 28 | 29 | o.Properties.Add (name, thing); 30 | } 31 | 32 | if (r.TokenType != JsonToken.EndObject) 33 | throw new InvalidDataException ("Object end expected"); 34 | r.Read (); 35 | 36 | return o; 37 | } 38 | 39 | JSONThing ReadThing(JsonReader r) 40 | { 41 | switch (r.TokenType) { 42 | case JsonToken.Null: 43 | r.Read (); 44 | return new JSONValueLeaf{ Value = string.Empty }; 45 | case JsonToken.Comment: 46 | r.Read (); 47 | return ReadThing (r); 48 | case JsonToken.Integer: 49 | case JsonToken.Float: 50 | case JsonToken.Boolean: 51 | case JsonToken.String: 52 | var ret = new JSONValueLeaf{ Value = r.Value.ToString() }; 53 | r.Read (); 54 | return ret; 55 | case JsonToken.StartObject: 56 | return ReadObject(r); 57 | case JsonToken.StartArray: 58 | return ReadArray(r); 59 | default: 60 | throw new InvalidDataException("Object, array or string value expected"); 61 | } 62 | } 63 | 64 | JSONArray ReadArray(JsonReader r) 65 | { 66 | if (r.TokenType != JsonToken.StartArray) 67 | throw new InvalidDataException ("Array begin expected"); 68 | r.Read (); 69 | 70 | var array = new JSONArray (); 71 | while (r.TokenType != JsonToken.EndArray) { 72 | array.Items.Add (ReadThing (r)); 73 | } 74 | 75 | if (r.TokenType != JsonToken.EndArray) 76 | throw new InvalidDataException ("Array end expected"); 77 | r.Read (); 78 | 79 | return array; 80 | } 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/JSON/JSONValueLeaf.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 4 | { 5 | public class JSONValueLeaf : JSONThing 6 | { 7 | public string Value { get; set; } 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/PackageJson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats 8 | { 9 | class PackageJson : DubJson 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/SDL/SDLDeclaration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats.SDL 8 | { 9 | public class SDLDeclaration 10 | { 11 | public readonly string Name; 12 | public readonly Tuple[] Attributes; 13 | 14 | public SDLDeclaration(string name, IEnumerable> attributes) 15 | { 16 | this.Name = name; 17 | this.Attributes = attributes.ToArray(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DefinitionFormats/SDL/SDLObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MonoDevelop.D.Projects.Dub.DefinitionFormats.SDL 8 | { 9 | public class SDLObject : SDLDeclaration 10 | { 11 | public readonly SDLDeclaration[] Children; 12 | 13 | public SDLObject(string name, IEnumerable> attributes, SDLDeclaration[] children) : base(name, attributes) { 14 | Children = children; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DubBuildSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using MonoDevelop.Projects; 4 | 5 | namespace MonoDevelop.D.Projects.Dub 6 | { 7 | public class DubBuildSettings : Dictionary>, ICloneable 8 | { 9 | public const string TargetTypeProperty = "targettype"; 10 | public const string TargetNameProperty = "targetname"; 11 | public const string TargetPathProperty = "targetpath"; 12 | public const string SourcePathsProperty = "sourcepaths"; 13 | public const string SourceFilesProperty = "sourcefiles"; 14 | public const string ImportPathsProperty = "importpaths"; 15 | public const string VersionsProperty = "versions"; 16 | 17 | public object Clone() 18 | { 19 | var s = new DubBuildSettings(); 20 | 21 | foreach (var kv in this) 22 | { 23 | var newList = new List(); 24 | foreach (var setting in kv.Value) 25 | newList.Add(setting.Clone() as DubBuildSetting); 26 | s[kv.Key] = newList; 27 | } 28 | 29 | return s; 30 | } 31 | 32 | public readonly Dictionary dependencies = new Dictionary(); 33 | public readonly Dictionary subConfigurations = new Dictionary(); 34 | 35 | public static HashSet OsVersions = new HashSet { 36 | "windows", "win32", "win64", "linux", "osx", 37 | "freebsd", "openbsd", "netbsd", "dragonflybsd", "bsd", 38 | "solaris", "posix", "aix", "haiku", "skyos", "sysv3", "sysv4", "hurd", 39 | "android" 40 | }; 41 | 42 | public static HashSet Architectures = new HashSet { 43 | "Alpha_HardFloat", "Alpha_SoftFloat", "Alpha", "SH64", "SH", "HPPA64", "HPPA", "S390X", "", "S390", 44 | "SPARC64", "SPARC_HardFloat", "SPARC_SoftFloat", "SPARC_V8Plus", "SPARC", 45 | "MIPS_HardFloat", "MIPS_SoftFloat", "MIPS_EABI", "MIPS_N64", "MIPS_O64", "MIPS_N32", "MIPS_O32", "MIPS64", "MIPS32", 46 | "ia64", 47 | "PPC64", "PPC_HardFloat", "PPC_SoftFloat", "PPC", "AArch64", 48 | "ARM_HardFloat", "ARM_SoftFP", "ARM_SoftFloat", "ARM_Thumb", "arm", 49 | "x86_64", "x86" 50 | }; 51 | 52 | public void TryGetTargetTypeProperty(DubProject prj, ConfigurationSelector cfg, ref string targetType) 53 | { 54 | List l; 55 | if (TryGetValue(DubBuildSettings.TargetTypeProperty, out l)) 56 | foreach (var sett in l) 57 | if (prj.BuildSettingMatchesConfiguration(sett, cfg)) 58 | targetType = sett.Values[0]; 59 | } 60 | 61 | public void TryGetTargetFileProperties(DubProject prj, ConfigurationSelector configuration, ref string targetType, ref string targetName, ref string targetPath) 62 | { 63 | List l; 64 | if (TryGetValue(DubBuildSettings.TargetNameProperty, out l)) 65 | foreach (var sett in l) 66 | if (prj.BuildSettingMatchesConfiguration(sett, configuration)) 67 | targetName = sett.Values[0]; 68 | 69 | if (TryGetValue(DubBuildSettings.TargetPathProperty, out l)) 70 | foreach (var sett in l) 71 | if (prj.BuildSettingMatchesConfiguration(sett, configuration)) 72 | targetPath = sett.Values[0]; 73 | 74 | TryGetTargetTypeProperty(prj, configuration, ref targetType); 75 | } 76 | } 77 | 78 | public class DubBuildSetting : ICloneable 79 | { 80 | public string Name; 81 | public string OperatingSystem; 82 | public string Architecture; 83 | public string Compiler; 84 | public string[] Values; 85 | 86 | public object Clone() 87 | { 88 | return new DubBuildSetting 89 | { 90 | Name = Name, 91 | OperatingSystem = OperatingSystem, 92 | Architecture = Architecture, 93 | Compiler = Compiler, 94 | Values = Values 95 | }; 96 | } 97 | } 98 | 99 | public class DubProjectDependency 100 | { 101 | public string Name; 102 | public string Version; 103 | /// 104 | /// May contain inappropriate directory path separators! (Win, Non-Win OS) 105 | /// 106 | public string Path; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DubProjectConfiguration.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Projects; 2 | 3 | namespace MonoDevelop.D.Projects.Dub 4 | { 5 | public class DubProjectConfiguration : ProjectConfiguration 6 | { 7 | public const string DefaultConfigId = "Default"; 8 | public DubBuildSettings BuildSettings = new DubBuildSettings(); 9 | 10 | public Building.DCompileTarget TargetType 11 | { 12 | get{ 13 | string targetType = null; 14 | var prj = base.ParentItem as DubProject; 15 | prj.CommonBuildSettings.TryGetTargetTypeProperty (prj, Selector, ref targetType); 16 | BuildSettings.TryGetTargetTypeProperty (prj, Selector, ref targetType); 17 | 18 | if (targetType == null) 19 | return Building.DCompileTarget.Executable; 20 | 21 | switch (targetType.ToLowerInvariant ()) { 22 | case "shared": 23 | return Building.DCompileTarget.SharedLibrary; 24 | case "static": 25 | return Building.DCompileTarget.StaticLibrary; 26 | default: 27 | return Building.DCompileTarget.Executable; 28 | } 29 | } 30 | } 31 | 32 | public override void CopyFrom (ItemConfiguration conf) 33 | { 34 | var cfg = conf as DubProjectConfiguration; 35 | if (cfg != null) { 36 | BuildSettings = cfg.BuildSettings; 37 | } 38 | base.CopyFrom (conf); 39 | } 40 | 41 | public DubProjectConfiguration() 42 | { 43 | Platform = "AnyCPU"; 44 | ExternalConsole = true; 45 | PauseConsoleOutput = true; 46 | DebugMode = true; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DubProjectItemTypeHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Xml; 4 | using Mono.Addins; 5 | using MonoDevelop.Projects.Formats.MSBuild; 6 | using MonoDevelop.Core; 7 | using MonoDevelop.Projects.Extensions; 8 | using MonoDevelop.Projects; 9 | using MonoDevelop.D.Projects.Dub.DefinitionFormats; 10 | 11 | namespace MonoDevelop.D.Projects.Dub 12 | { 13 | class DubProjectItemTypeHandler : ItemTypeNode 14 | { 15 | public Type ItemType { get { return typeof(DubProject); } } 16 | 17 | public override bool CanHandleItem (SolutionEntityItem item) 18 | { 19 | return ItemType != null && ItemType.IsAssignableFrom (item.GetType ()); 20 | } 21 | 22 | public override bool CanHandleFile (string fileName, string typeGuid) 23 | { 24 | return string.Compare (typeGuid, this.Guid, true) == 0 || DubFileManager.Instance.CanLoad (fileName); 25 | } 26 | 27 | public override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName, MSBuildFileFormat expectedFormat, string itemGuid) 28 | { 29 | return DubFileManager.Instance.LoadProject (fileName, Ide.IdeApp.Workspace.GetAllSolutions () [0], monitor); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DubSettings.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DubSettings.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using MonoDevelop.Core; 27 | using System.Xml; 28 | 29 | namespace MonoDevelop.D 30 | { 31 | public class DubSettings : ICustomXmlSerializer 32 | { 33 | #region Properties 34 | const string DubSettingsPropId = "MonoDevelop.D.Dub"; 35 | static DubSettings inst; 36 | public static DubSettings Instance 37 | { 38 | get{ 39 | if (inst == null) { 40 | inst = PropertyService.Get (DubSettingsPropId); 41 | if (inst == null) 42 | inst = new DubSettings (); 43 | } 44 | 45 | return inst; 46 | } 47 | } 48 | 49 | public static void Save() 50 | { 51 | PropertyService.Set (DubSettingsPropId, Instance); 52 | } 53 | 54 | public string DubCommand = "dub"; 55 | public string CommonArgs = string.Empty; 56 | #endregion 57 | 58 | #region Loading & Saving 59 | public void WriteTo (XmlWriter w) 60 | { 61 | w.WriteStartElement ("cmd"); 62 | w.WriteCData (DubCommand); 63 | w.WriteEndElement (); 64 | 65 | w.WriteStartElement ("commonargs"); 66 | w.WriteCData (CommonArgs); 67 | w.WriteEndElement (); 68 | } 69 | 70 | public ICustomXmlSerializer ReadFrom (XmlReader r) 71 | { 72 | while (r.Read ()) { 73 | switch (r.LocalName) { 74 | case "cmd": 75 | DubCommand = r.ReadString (); 76 | break; 77 | case "commonargs": 78 | CommonArgs = r.ReadString (); 79 | break; 80 | } 81 | } 82 | return this; 83 | } 84 | #endregion 85 | } 86 | } 87 | 88 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DubSolution.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Projects; 2 | using System; 3 | using MonoDevelop.Core.Execution; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | 7 | namespace MonoDevelop.D.Projects.Dub 8 | { 9 | /// 10 | /// A dub package container. 11 | /// 12 | public class DubSolution : Solution 13 | { 14 | public readonly SolutionFolder ExternalDepFolder = new SolutionFolder { Name = "External Dependencies" }; 15 | 16 | public DubSolution() 17 | { 18 | RootFolder.AddItem (ExternalDepFolder); 19 | } 20 | 21 | internal void AddProject(AbstractDProject sub) 22 | { 23 | var folder = sub.BaseDirectory == BaseDirectory || sub.BaseDirectory.IsChildPathOf (BaseDirectory) ? RootFolder : ExternalDepFolder; 24 | 25 | if (folder == ExternalDepFolder && sub is DubProject) { 26 | var packageName = (sub as DubProject).packageName.Split(':'); 27 | for (int i = 0; i < packageName.Length - 1; i++) { 28 | bool foundSubFolder = false; 29 | foreach (var subFolder in folder.GetAllItems()) { 30 | if (String.Equals (subFolder.Name, packageName [i], StringComparison.CurrentCultureIgnoreCase)) { 31 | folder = subFolder; 32 | foundSubFolder = true; 33 | break; 34 | } 35 | } 36 | if (!foundSubFolder) { 37 | var newSubFolder = new SolutionFolder{ Name = packageName [i] }; 38 | folder.AddItem (newSubFolder); 39 | folder = newSubFolder; 40 | } 41 | } 42 | } 43 | 44 | if (!folder.Items.Contains (sub)) 45 | folder.AddItem (sub, false); 46 | } 47 | 48 | public override string Name 49 | { 50 | get 51 | { 52 | return StartupItem != null ? StartupItem.Name : base.Name; 53 | } 54 | set 55 | { 56 | 57 | } 58 | } 59 | 60 | public override Core.FilePath FileName 61 | { 62 | get 63 | { 64 | return StartupItem != null ? StartupItem.FileName : base.FileName; 65 | } 66 | set 67 | { 68 | } 69 | } 70 | 71 | public override void Dispose () 72 | { 73 | StartupItem = null; 74 | base.Dispose (); 75 | GC.ReRegisterForFinalize (this); 76 | } 77 | 78 | protected override BuildResult OnBuild (MonoDevelop.Core.IProgressMonitor monitor, ConfigurationSelector configuration) 79 | { 80 | var s = StartupItem as Project; 81 | 82 | if (s == null) 83 | return new BuildResult{ FailedBuildCount = 1, CompilerOutput = "No default package specified!", BuildCount = 0 }; 84 | 85 | return StartupItem.Build(monitor, configuration); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/Dub/DubSubPackage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DubSubPackage.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using Newtonsoft.Json; 28 | using MonoDevelop.Projects; 29 | using System.Collections.Generic; 30 | using System.Linq; 31 | using MonoDevelop.Core; 32 | 33 | namespace MonoDevelop.D.Projects.Dub 34 | { 35 | public class DubSubPackage : DubProject 36 | { 37 | public bool useOriginalBasePath; 38 | public FilePath OriginalBasePath; 39 | public FilePath VirtualBasePath; 40 | 41 | protected override FilePath GetDefaultBaseDirectory () 42 | { 43 | return useOriginalBasePath ? OriginalBasePath : VirtualBasePath; 44 | } 45 | 46 | public override IEnumerable GetSourcePaths (ConfigurationSelector sel) 47 | { 48 | useOriginalBasePath = true; 49 | var en = base.GetSourcePaths (sel).ToList(); 50 | useOriginalBasePath = false; 51 | return en; 52 | } 53 | 54 | protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) 55 | { 56 | useOriginalBasePath = true; 57 | base.DoExecute (monitor, context, configuration); 58 | useOriginalBasePath = false; 59 | } 60 | 61 | protected override BuildResult DoBuild (IProgressMonitor monitor, ConfigurationSelector configuration) 62 | { 63 | useOriginalBasePath = true; 64 | var res = base.DoBuild (monitor, configuration); 65 | useOriginalBasePath = false; 66 | return res; 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/ProjectJsonConfig.cs: -------------------------------------------------------------------------------- 1 | namespace MonoDevelop.D.Projects 2 | { 3 | public class ExtendedProjectConfig 4 | { 5 | public string BuildCommand; 6 | public string BuildArguments; 7 | public string RunCommand; 8 | public string RunArguments; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/ProjectPad/DProjectNodeExtension.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DProjectNodeExtension.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | 27 | using System; 28 | using MonoDevelop.D.Projects; 29 | using MonoDevelop.Ide.Gui.Components; 30 | 31 | namespace MonoDevelop.D.Projects.ProjectPad 32 | { 33 | /// 34 | /// Extends project nodes which represent D projects by their references. 35 | /// 36 | public class DProjectNodeExtension : NodeBuilderExtension 37 | { 38 | public override bool CanBuildNode (Type dataType) 39 | { 40 | return dataType.IsSubclassOf(typeof(AbstractDProject)); 41 | } 42 | 43 | public override void BuildChildNodes(ITreeBuilder builder, object dataObject) 44 | { 45 | var project = dataObject as AbstractDProject; 46 | 47 | var refs = project.References; 48 | if(refs != null) 49 | builder.AddChild (refs); 50 | 51 | base.BuildChildNodes(builder, dataObject); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/VisualD/VisualDPrjConfig.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VisualDPrjConfig.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using System.Xml; 28 | using MonoDevelop.Projects; 29 | using System.Collections.Generic; 30 | 31 | namespace MonoDevelop.D.Projects.VisualD 32 | { 33 | public class VisualDPrjConfig : ProjectConfiguration 34 | { 35 | #region Properties 36 | public readonly Dictionary Properties = new Dictionary(); 37 | #endregion 38 | 39 | public VisualDPrjConfig (string name) : base(name) 40 | { 41 | } 42 | 43 | public static VisualDPrjConfig ReadAndAdd(VisualDProject prj, string name, string platform, XmlReader x) 44 | { 45 | var c = prj.AddNewConfiguration (name ?? "Unknown") as VisualDPrjConfig; 46 | c.Platform = platform; 47 | 48 | while (x.Read ()) { 49 | var n = x.LocalName; 50 | if (string.IsNullOrWhiteSpace (n) || n == "Config") 51 | continue; 52 | var content = x.ReadElementContentAsString(); 53 | 54 | if (!string.IsNullOrWhiteSpace (content)) 55 | c.Properties [n] = content; 56 | } 57 | 58 | return c; 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/VisualD/VisualDProject.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VisualDProject.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using MonoDevelop.D.Projects; 27 | using MonoDevelop.Projects; 28 | 29 | namespace MonoDevelop.D.Projects.VisualD 30 | { 31 | public class VisualDProject : AbstractDProject 32 | { 33 | #region Properties 34 | DProjectReferenceCollection references; 35 | internal string ItemIdToAssign 36 | { 37 | set{ 38 | var h = ItemHandler as MonoDevelop.Projects.Formats.MSBuild.MSBuildProjectHandler; 39 | if (h != null) 40 | h.ItemId = value; 41 | } 42 | } 43 | #endregion 44 | 45 | public VisualDProject () 46 | { 47 | references = new VisualDProjectReferenceCollection (this); 48 | } 49 | 50 | protected override void OnSave(Core.IProgressMonitor monitor) 51 | { 52 | //base.OnSave(monitor); 53 | } 54 | 55 | public override SolutionItemConfiguration CreateConfiguration (string name) 56 | { 57 | return new VisualDPrjConfig (name); 58 | } 59 | 60 | public override DProjectReferenceCollection References 61 | { 62 | get { return references; } 63 | } 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Projects/VisualD/VisualDProjectReferenceCollection.cs: -------------------------------------------------------------------------------- 1 | // 2 | // VisualDProjectReferenceCollection.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | 28 | namespace MonoDevelop.D.Projects.VisualD 29 | { 30 | public class VisualDProjectReferenceCollection : DProjectReferenceCollection 31 | { 32 | public new VisualDProject Owner {get{ return base.Owner as VisualDProject; }} 33 | 34 | public VisualDProjectReferenceCollection (VisualDProject prj) : base(prj) 35 | { 36 | } 37 | 38 | #region implemented abstract members of DProjectReferenceCollection 39 | 40 | public override void DeleteProjectRef (string projectId) 41 | { 42 | 43 | } 44 | 45 | public override void FireUpdate () 46 | { 47 | if (Update != null) 48 | Update (this, EventArgs.Empty); 49 | } 50 | 51 | public override bool AddReference () 52 | { 53 | return false; 54 | } 55 | 56 | public override event EventHandler Update; 57 | 58 | #endregion 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/CodeActions/DCodeActionSource.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MonoDevelop.CodeActions; 3 | 4 | namespace MonoDevelop.D.Refactoring.CodeActions 5 | { 6 | public class DCodeActionSource : ICodeActionProviderSource 7 | { 8 | readonly List providers = new List (); 9 | 10 | public DCodeActionSource () 11 | { 12 | //TODO: Add nice code refactorings like "Extract Method", "Create Class of selected identifier", "Optimize out while(true)" and so on.. 13 | } 14 | 15 | public IEnumerable GetProviders () 16 | { 17 | return providers; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/DRefactoringContext.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DRefactoringContext.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Ide.Gui; 28 | using MonoDevelop.Ide.TypeSystem; 29 | using MonoDevelop.D.Parser; 30 | using D_Parser.Resolver; 31 | using MonoDevelop.D.Resolver; 32 | using D_Parser.Completion; 33 | using D_Parser.Resolver.TypeResolution; 34 | using D_Parser.Dom; 35 | 36 | namespace MonoDevelop.D.Refactoring 37 | { 38 | public class DRefactoringContext : IRefactoringContext 39 | { 40 | public readonly Document Doc; 41 | public readonly ParsedDModule ParsedDoc; 42 | AbstractType[] lastResults; 43 | 44 | public IEditorData ed; 45 | public LooseResolution.NodeResolutionAttempt resultResolutionAttempt; 46 | public ISyntaxRegion syntaxObject; 47 | 48 | public AbstractType[] CurrentResults 49 | { 50 | get{ 51 | if (lastResults == null) 52 | lastResults = DResolverWrapper.ResolveHoveredCodeLoosely (out ed, out resultResolutionAttempt, out syntaxObject, Doc); 53 | 54 | return lastResults; 55 | } 56 | } 57 | 58 | public DRefactoringContext (Document doc, ParsedDModule mod) 59 | { 60 | this.ParsedDoc = mod; 61 | this.Doc = doc; 62 | } 63 | 64 | public IDisposable CreateScript () 65 | { 66 | return null; 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/DustMiteIntegration/DustMite.cs: -------------------------------------------------------------------------------- 1 | // 2 | // DustMite.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2014 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Components.Commands; 28 | using MonoDevelop.D.Projects; 29 | using MonoDevelop.Core; 30 | using MonoDevelop.Ide; 31 | 32 | namespace MonoDevelop.D.Refactoring 33 | { 34 | public class DustMite : CommandHandler 35 | { 36 | #region Properties 37 | public static readonly object InvokeCommandId; 38 | AbstractDProject prj; 39 | 40 | #endregion 41 | 42 | protected override void Update (CommandInfo info) 43 | { 44 | prj = Ide.IdeApp.ProjectOperations.CurrentSelectedItem as AbstractDProject; 45 | info.Bypass = prj != null; 46 | base.Update (info); 47 | } 48 | 49 | protected override void Run () 50 | { 51 | using (var dlg = new DustMiteArgDlg (prj)) 52 | MessageService.RunCustomDialog (dlg); 53 | } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/ImportSymbolSelectionDlg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Gtk; 3 | using D_Parser.Dom; 4 | using MonoDevelop.Ide; 5 | using System.Collections.Generic; 6 | 7 | namespace MonoDevelop.D 8 | { 9 | public partial class ImportSymbolSelectionDlg : Dialog 10 | { 11 | public static T Show(IEnumerable items, string title, Func nameGetter = null) where T : class 12 | { 13 | var dlg = new ImportSymbolSelectionDlg(items, nameGetter); 14 | dlg.Title = title; 15 | 16 | if(MessageService.RunCustomDialog(dlg, IdeApp.Workbench.RootWindow) != (int)ResponseType.Ok) 17 | return default(T); 18 | 19 | var n = dlg.SelectedNode; 20 | dlg.Destroy(); 21 | return (T)n; 22 | } 23 | 24 | ImportSymbolSelectionDlg (IEnumerable nodes, Func nameGetter = null) 25 | { 26 | this.Build (); 27 | 28 | SetResponseSensitive(ResponseType.Ok, true); 29 | SetResponseSensitive(ResponseType.Cancel, true); 30 | 31 | buttonOk.GrabFocus(); 32 | Modal = true; 33 | WindowPosition = Gtk.WindowPosition.CenterOnParent; 34 | 35 | // Init name column 36 | var nameCol = new TreeViewColumn(); 37 | var textRenderer = new CellRendererText(); 38 | nameCol.PackStart(textRenderer, true); 39 | nameCol.AddAttribute(textRenderer, "text", 0); 40 | list.AppendColumn(nameCol); 41 | 42 | // Init list model 43 | var nodeStore = new ListStore(typeof(string),typeof(INode)); 44 | list.Model = nodeStore; 45 | 46 | // Fill list 47 | foreach (var n in nodes) 48 | if(n!=null) 49 | nodeStore.AppendValues(nameGetter != null ? nameGetter(n) : n.ToString(), n); 50 | 51 | // Select first result 52 | TreeIter iter; 53 | if(nodeStore.GetIterFirst(out iter)) 54 | list.Selection.SelectIter(iter); 55 | } 56 | 57 | public object SelectedNode 58 | { 59 | get{ 60 | TreeIter iter; 61 | if(!list.Selection.GetSelected(out iter)) 62 | return null; 63 | 64 | return list.Model.GetValue(iter, 1); 65 | } 66 | } 67 | 68 | [GLib.ConnectBefore] 69 | protected void OnListButtonPressEvent (object o, ButtonPressEventArgs args) 70 | { 71 | // Handle double-click 72 | if (args.Event.Type == Gdk.EventType.TwoButtonPress) 73 | { 74 | Respond(ResponseType.Ok); 75 | args.RetVal = true; 76 | Hide(); 77 | } 78 | } 79 | 80 | protected void OnButtonCancelClicked (object sender, EventArgs e) 81 | { 82 | Respond(ResponseType.Cancel); 83 | Hide(); 84 | } 85 | 86 | protected void OnButtonOkClicked (object sender, EventArgs e) 87 | { 88 | Respond(ResponseType.Ok); 89 | Hide(); 90 | } 91 | 92 | protected void OnKeyPressEvent(object o, KeyPressEventArgs e) 93 | { 94 | if (e.Event.Key == Gdk.Key.Return) 95 | { 96 | Respond(ResponseType.Ok); 97 | Hide(); 98 | } 99 | } 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/RefactoringCommandsExtension.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Ide.Gui.Content; 2 | using MonoDevelop.Components.Commands; 3 | using MonoDevelop.Refactoring; 4 | using MonoDevelop.Ide.Commands; 5 | 6 | namespace MonoDevelop.D.Refactoring 7 | { 8 | public class RefactoringCommandsExtension : TextEditorExtension 9 | { 10 | readonly RefactoringCommandCapsule caps = new RefactoringCommandCapsule(); 11 | 12 | bool Update() 13 | { 14 | return caps.Update (document) && caps.resultResolutionAttempt != D_Parser.Resolver.LooseResolution.NodeResolutionAttempt.RawSymbolLookup; 15 | } 16 | 17 | [CommandHandler(RefactoryCommands.FindReferences)] 18 | void FindReferences() 19 | { 20 | if(Update()) 21 | caps.FindReferences (false); 22 | } 23 | 24 | [CommandHandler(RefactoryCommands.FindAllReferences)] 25 | void FindAllReferences() 26 | { 27 | if (Update()) 28 | caps.FindReferences(true); 29 | } 30 | 31 | [CommandHandler(RefactoryCommands.FindDerivedClasses)] 32 | void FindDerivedClasses() 33 | { 34 | if (Update()) 35 | caps.FindDerivedClasses(); 36 | } 37 | 38 | [CommandHandler(RefactoryCommands.GotoDeclaration)] 39 | void GotoDeclaration() 40 | { 41 | if(Update()) 42 | caps.GotoDeclaration (); 43 | } 44 | 45 | [CommandUpdateHandler(EditCommands.Rename)] 46 | [CommandUpdateHandler(RefactoryCommands.FindReferences)] 47 | [CommandUpdateHandler(RefactoryCommands.FindAllReferences)] 48 | [CommandUpdateHandler(RefactoryCommands.FindDerivedClasses)] 49 | [CommandUpdateHandler(RefactoryCommands.GotoDeclaration)] 50 | [CommandUpdateHandler(RefactoryCommands.ImportSymbol)] 51 | void Rename_Update(CommandInfo ci) 52 | { 53 | ci.Bypass = false; 54 | } 55 | 56 | [CommandHandler(EditCommands.Rename)] 57 | void Rename() 58 | { 59 | if(Update()) 60 | caps.RenameSymbol (); 61 | } 62 | 63 | [CommandHandler(RefactoryCommands.ImportSymbol)] 64 | void TryImportMissingSymbol() 65 | { 66 | if(!Update() && caps.lastResults != null && caps.resultResolutionAttempt == D_Parser.Resolver.LooseResolution.NodeResolutionAttempt.RawSymbolLookup) 67 | caps.TryImportMissingSymbol (); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/Renaming/DRenameHandler.cs: -------------------------------------------------------------------------------- 1 | // by Alexander Bothe (info@alexanderbothe.com) 2 | using D_Parser.Dom; 3 | using MonoDevelop.Refactoring; 4 | 5 | namespace MonoDevelop.D.Refactoring 6 | { 7 | public class DRenameHandler : AbstractRefactoringCommandHandler 8 | { 9 | protected override void Update (RefactoringOptions options, MonoDevelop.Components.Commands.CommandInfo info) 10 | { 11 | var renameRefactoring = new DRenameRefactoring (); 12 | if (!renameRefactoring.IsValid (options)) 13 | info.Bypass = true; 14 | } 15 | 16 | /// must be a DSymbol 17 | protected override void Run(object data) 18 | { 19 | var doc = Ide.IdeApp.Workbench.ActiveDocument; 20 | 21 | if(doc!=null) 22 | this.Run(new RefactoringOptions(doc) { SelectedItem = data }); 23 | } 24 | 25 | protected override void Run (RefactoringOptions options) 26 | { 27 | var renameRefactoring = new DRenameRefactoring (); 28 | if (renameRefactoring.IsValid (options)) 29 | renameRefactoring.Run (options); 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/Renaming/DRenameNameDialog.cs: -------------------------------------------------------------------------------- 1 | // by Alexander Bothe (info@alexanderbothe.com) 2 | using System; 3 | using D_Parser.Dom; 4 | using Gtk; 5 | using MonoDevelop.D.Refactoring; 6 | using MonoDevelop.Ide; 7 | using MonoDevelop.Refactoring; 8 | using MonoDevelop.Refactoring.Rename; 9 | 10 | // Couple of code parts were taken from RenameItemDialog.cs 11 | //TODO: Propose more general rename item dialog structures -- ValidateName, setting the initial entry text etc.. 12 | 13 | namespace MonoDevelop.D 14 | { 15 | public partial class DRenameNameDialog : Dialog 16 | { 17 | DRenameRefactoring rename; 18 | RefactoringOptions options; 19 | string originalName; 20 | 21 | public DRenameNameDialog (RefactoringOptions options,DRenameRefactoring rename) 22 | { 23 | this.rename = rename; 24 | this.options = options; 25 | 26 | this.Build (); 27 | var ds = (INode)options.SelectedItem; 28 | 29 | #region Adjust dialog title 30 | var app = "Renaming "; 31 | 32 | if (ds is DClassLike) 33 | { 34 | var dc = (DClassLike)ds; 35 | app+=dc.ClassType.ToString(); 36 | } 37 | else if (ds is DMethod) 38 | app += "method"; 39 | else if (ds is DVariable) 40 | app += ((DVariable)ds).IsAlias ? "alias" : "variable"; 41 | else 42 | app += "item"; 43 | 44 | Title = app; 45 | #endregion 46 | 47 | text_NewId.Text = originalName = ds.Name; 48 | 49 | buttonPreview.Sensitive = buttonOk.Sensitive = false; 50 | 51 | buttonOk.Clicked += OnOKClicked; 52 | buttonPreview.Clicked += OnPreviewClicked; 53 | text_NewId.Changed += delegate { setNotifyIcon(buttonPreview.Sensitive = buttonOk.Sensitive = ValidateName()); }; 54 | ValidateName(); 55 | 56 | buttonOk.GrabDefault (); 57 | buttonOk.ReceivesDefault = true; 58 | text_NewId.GrabFocus (); 59 | } 60 | 61 | bool ValidateName() 62 | { 63 | return originalName != text_NewId.Text && 64 | DRenameRefactoring.IsValidIdentifier(text_NewId.Text); 65 | } 66 | 67 | void setNotifyIcon(bool hasCorrectUserInput) 68 | { 69 | img_wrongIdentifierNotification.SetFromIconName(hasCorrectUserInput ? "gtk-apply" : "gtk-cancel", IconSize.LargeToolbar); 70 | } 71 | 72 | RenameRefactoring.RenameProperties Properties 73 | { 74 | get 75 | { 76 | return new RenameRefactoring.RenameProperties() 77 | { 78 | NewName = text_NewId.Text, 79 | RenameFile = false //TODO 80 | }; 81 | } 82 | } 83 | 84 | void OnOKClicked(object sender, EventArgs e) 85 | { 86 | var properties = Properties; 87 | ((Widget)this).Destroy(); 88 | var changes = rename.PerformChanges(options, properties); 89 | var monitor = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor(this.Title, null); 90 | RefactoringService.AcceptChanges(monitor, changes); 91 | } 92 | 93 | void OnPreviewClicked(object sender, EventArgs e) 94 | { 95 | var properties = Properties; 96 | ((Widget)this).Destroy(); 97 | var changes = rename.PerformChanges(options, properties); 98 | MessageService.ShowCustomDialog(new RefactoringPreviewDialog(changes)); 99 | } 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/Renaming/DRenameRefactoring.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using MonoDevelop.Refactoring.Rename; 4 | using MonoDevelop.Refactoring; 5 | using D_Parser.Resolver; 6 | using System.Collections.Generic; 7 | using MonoDevelop.D.Parser; 8 | using D_Parser.Misc; 9 | using D_Parser.Dom; 10 | using MonoDevelop.Core; 11 | using MonoDevelop.Ide; 12 | using MonoDevelop.D.Projects; 13 | using MonoDevelop.D.Resolver; 14 | 15 | namespace MonoDevelop.D.Refactoring 16 | { 17 | public class DRenameRefactoring : RenameRefactoring 18 | { 19 | public override bool IsValid (RefactoringOptions options) 20 | { 21 | if (options == null) 22 | return false; 23 | 24 | var n = options.SelectedItem as INode; 25 | //TODO: Any further node types that cannot be renamed? 26 | return n != null && CanRenameNode(n); 27 | } 28 | 29 | public static bool CanRenameNode(INode n) 30 | { 31 | return !(n is DMethod) || ((DMethod)n).SpecialType == DMethod.MethodType.Normal; 32 | } 33 | 34 | public override List PerformChanges (RefactoringOptions options, object prop) 35 | { 36 | #region Init 37 | var renameProperties = prop as RenameProperties; 38 | if (renameProperties == null) return null; 39 | 40 | var changes = new List(); 41 | 42 | var doc = options.Document; 43 | if (doc == null) return null; 44 | 45 | var ast = doc.GetDAst(); 46 | if (ast == null) return null; 47 | 48 | var n = options.SelectedItem as INode; 49 | if (n == null) return null; 50 | 51 | var project = doc.HasProject ? doc.Project as AbstractDProject : null; 52 | 53 | var parseCache = DResolverWrapper.CreateParseCacheView(project); 54 | 55 | var modules = new List(); 56 | if(project == null) 57 | modules.Add(ast); 58 | else 59 | foreach(var p in project.GetSourcePaths()) 60 | modules.AddRange(GlobalParseCache.EnumModulesRecursively(p)); 61 | 62 | var ctxt = ResolutionContext.Create(parseCache, null,null); 63 | #endregion 64 | 65 | // Enumerate references 66 | foreach (var mod in modules) 67 | { 68 | if (mod == null) 69 | continue; 70 | 71 | var references = D_Parser.Refactoring.ReferencesFinder.SearchModuleForASTNodeReferences(mod, n, ctxt).ToList(); 72 | 73 | if (((DModule)n.NodeRoot).FileName == mod.FileName) 74 | references.Insert(0, new IdentifierDeclaration(n.NameHash) { Location = n.NameLocation }); 75 | 76 | if (references.Count < 1) 77 | continue; 78 | 79 | var txt = TextFileProvider.Instance.GetEditableTextFile(new FilePath(mod.FileName)); 80 | var prevReplacement = CodeLocation.Empty; 81 | foreach (ISyntaxRegion reference in references) 82 | { 83 | if (prevReplacement == reference.Location) 84 | continue; 85 | 86 | prevReplacement = reference.Location; 87 | changes.Add(new TextReplaceChange { 88 | FileName = mod.FileName, 89 | InsertedText = renameProperties.NewName, 90 | RemovedChars = n.Name.Length, 91 | Description = string.Format (GettextCatalog.GetString ("Replace '{0}' with '{1}'"), n.Name, renameProperties.NewName), 92 | Offset = txt.GetPositionFromLineColumn(reference.Location.Line, reference.Location.Column) 93 | }); 94 | } 95 | } 96 | 97 | return changes; 98 | } 99 | 100 | public override void Run (RefactoringOptions options) 101 | { 102 | MessageService.ShowCustomDialog(new DRenameNameDialog(options, this)); 103 | } 104 | 105 | public static bool IsValidIdentifier(string id) 106 | { 107 | // Prohibit empty identifiers 108 | if (string.IsNullOrWhiteSpace(id)) 109 | return false; 110 | 111 | // All id chars must be identifier chars 112 | foreach (var c in id) 113 | if (!D_Parser.Parser.Lexer.IsIdentifierPart(c)) 114 | return false; 115 | 116 | // New identifier might be a keyword.. 117 | return !D_Parser.Parser.DTokens.Keywords_Lookup.ContainsKey(id); 118 | } 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/SortImportsCommandHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // SortImportsCommandHandler.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2014 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System; 27 | using MonoDevelop.Components.Commands; 28 | using MonoDevelop.Ide; 29 | using MonoDevelop.Core; 30 | using D_Parser.Refactoring; 31 | using D_Parser.Resolver.TypeResolution; 32 | using MonoDevelop.D.Parser; 33 | using D_Parser.Dom; 34 | using MonoDevelop.D.Refactoring; 35 | using MonoDevelop.Ide.Gui; 36 | 37 | namespace MonoDevelop.D.Refactoring 38 | { 39 | class SortImportsCommandHandler : CommandHandler 40 | { 41 | const string SortImportsSeparatePackagesFromEachOtherPropId = "MonoDevelop.D.SortImportsSeparatePackagesFromEachOther"; 42 | public static bool SortImportsSeparatePackagesFromEachOther 43 | { 44 | get{ return PropertyService.Get (SortImportsSeparatePackagesFromEachOtherPropId, false); } 45 | set{ PropertyService.Set (SortImportsSeparatePackagesFromEachOtherPropId, value); } 46 | } 47 | 48 | public static bool CanSortImports(Document doc = null) 49 | { 50 | doc = doc ?? IdeApp.Workbench.ActiveDocument; 51 | 52 | if (doc == null) 53 | return false; 54 | 55 | var ddoc = doc.ParsedDocument as ParsedDModule; 56 | if (ddoc == null || ddoc.DDom == null) 57 | return false; 58 | 59 | return DResolver.SearchBlockAt (ddoc.DDom, new CodeLocation(doc.Editor.Caret.Column, doc.Editor.Caret.Line)) is DBlockNode; 60 | } 61 | 62 | public static void SortImports(Document doc = null) 63 | { 64 | doc = doc ?? IdeApp.Workbench.ActiveDocument; 65 | 66 | if (doc == null) 67 | return; 68 | 69 | var ddoc = doc.ParsedDocument as ParsedDModule; 70 | if (ddoc == null || ddoc.DDom == null) 71 | return; 72 | 73 | var scope = DResolver.SearchBlockAt (ddoc.DDom, new CodeLocation(doc.Editor.Caret.Column, doc.Editor.Caret.Line)) as DBlockNode; 74 | 75 | if (scope == null) 76 | return; 77 | 78 | var editor = doc.Editor; 79 | using (editor.Document.OpenUndoGroup (Mono.TextEditor.OperationType.Undefined)) { 80 | SortImportsRefactoring.SortImports(scope, new TextDocumentAdapter(editor), SortImportsSeparatePackagesFromEachOther); 81 | } 82 | 83 | editor.Parent.TextViewMargin.PurgeLayoutCache(); 84 | editor.Parent.QueueDraw(); 85 | } 86 | 87 | protected override void Update (CommandInfo info) 88 | { 89 | if (!CanSortImports(info.DataItem as Document)) 90 | { 91 | info.Bypass = true; 92 | return; 93 | } 94 | 95 | base.Update (info); 96 | } 97 | 98 | protected override void Run (object dataItem) 99 | { 100 | SortImports (dataItem as Document); 101 | } 102 | } 103 | } 104 | 105 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Refactoring/TextDocumentAdapter.cs: -------------------------------------------------------------------------------- 1 | using D_Parser.Refactoring; 2 | using Mono.TextEditor; 3 | using MonoDevelop.Ide.Gui; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace MonoDevelop.D.Refactoring 10 | { 11 | class TextDocumentAdapter : ITextDocument 12 | { 13 | readonly TextEditorData doc; 14 | 15 | public TextDocumentAdapter(TextEditorData doc) 16 | { 17 | this.doc = doc; 18 | } 19 | 20 | public int Length 21 | { 22 | get { 23 | return doc.Length; 24 | } 25 | } 26 | 27 | public char GetCharAt(int offset) 28 | { 29 | return doc.GetCharAt(offset); 30 | } 31 | 32 | public void Remove(int offset, int length) 33 | { 34 | doc.Remove(offset, length); 35 | } 36 | 37 | public void Insert(int offset, string text) 38 | { 39 | doc.Insert(offset, text); 40 | } 41 | 42 | public int LocationToOffset(int line, int col) 43 | { 44 | return doc.LocationToOffset(line, col); 45 | } 46 | 47 | public int OffsetToLineNumber(int offset) 48 | { 49 | return doc.OffsetToLineNumber(offset); 50 | } 51 | 52 | public string EolMarker 53 | { 54 | get { return doc.EolMarker; } 55 | } 56 | 57 | public string GetLineIndent(int line) 58 | { 59 | return doc.GetLineIndent(line); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Resolver/MonoDParseCacheView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using D_Parser.Misc; 3 | using System.Collections.Generic; 4 | using D_Parser.Dom; 5 | using MonoDevelop.D.Projects; 6 | using MonoDevelop.D.Building; 7 | using MonoDevelop.D.Projects.Dub; 8 | 9 | namespace MonoDevelop.D 10 | { 11 | public class MonoDParseCacheView : ParseCacheView 12 | { 13 | readonly Dictionary> cache = new Dictionary>(); 14 | readonly ISet globalIncludes = new HashSet(); 15 | 16 | public MonoDParseCacheView() 17 | { 18 | Add (globalIncludes, DCompilerService.Instance.GetDefaultCompiler ().IncludePaths); 19 | } 20 | 21 | static void Add(ISet results, IEnumerable paths) 22 | { 23 | RootPackage pack; 24 | foreach(var p in paths) 25 | if((pack = GlobalParseCache.GetRootPackage (p)) != null) { 26 | results.Add (pack); 27 | } 28 | } 29 | 30 | public override IEnumerable EnumRootPackagesSurroundingModule (DModule module) 31 | { 32 | if (module == null) 33 | return globalIncludes; 34 | 35 | ISet results; 36 | if (cache.TryGetValue (module, out results)) 37 | return results; 38 | 39 | results = new HashSet (); 40 | 41 | foreach(var prj in Ide.IdeApp.Workspace.GetAllProjects()) { 42 | var dprj = prj as AbstractDProject; 43 | 44 | if (dprj == null || !prj.IsFileInProject(module.FileName)) 45 | continue; 46 | 47 | Add (results, dprj.GetSourcePaths ()); 48 | 49 | Add (results, dprj.IncludePaths); 50 | 51 | if (dprj.LinkedFilePackage != null) 52 | results.Add (dprj.LinkedFilePackage); 53 | } 54 | 55 | if (results.Count == 0) 56 | results = globalIncludes; 57 | 58 | cache [module] = results; 59 | return results; 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Unittest/Commands/UnittestCommandHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UnittestCommandHandler.cs 3 | // 4 | // Author: 5 | // Foerdi 6 | // 7 | // https://github.com/aBothe/Mono-D/pull/334 8 | // 9 | // Copyright (c) 2013 10 | 11 | using MonoDevelop.Components.Commands; 12 | using MonoDevelop.Ide; 13 | using MonoDevelop.Projects; 14 | using MonoDevelop.D.Projects; 15 | using MonoDevelop.D.Projects.Dub; 16 | using System; 17 | using MonoDevelop.D.Building; 18 | using System.Collections.Generic; 19 | 20 | namespace MonoDevelop.D.Unittest.Commands 21 | { 22 | class UnittestCmdHdlrFromEditor : CommandHandler 23 | { 24 | protected override void Update (CommandInfo info) 25 | { 26 | var doc = IdeApp.Workbench.ActiveDocument; 27 | info.Visible = info.Enabled = doc != null && doc.HasProject && doc.Project is AbstractDProject; 28 | } 29 | 30 | protected override void Run (object dataItem) 31 | { 32 | var doc = IdeApp.Workbench.ActiveDocument; 33 | var prj = doc.Project as AbstractDProject; 34 | if (prj == null) 35 | return; 36 | 37 | var monitor = Ide.IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor("dunittests","Run Unittest", MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true); 38 | 39 | var pad = Ide.IdeApp.Workbench.ProgressMonitors.GetPadForMonitor(monitor); 40 | if (pad != null) 41 | pad.BringToFront(); 42 | 43 | if (IdeApp.Preferences.BeforeBuildSaveAction != BeforeCompileAction.Nothing) { //TODO: Handle prompt for save. 44 | foreach (var doc_ in new List (IdeApp.Workbench.Documents)) { 45 | if (doc_.IsDirty && doc_.Project != null) { 46 | doc_.Save (); 47 | if (doc_.IsDirty) { 48 | monitor.ReportError ("Couldn't save document \"" + doc_.Name + "\"", new Exception()); 49 | return; 50 | } 51 | } 52 | } 53 | } 54 | 55 | monitor.BeginTask("Starting Unit Tests", 1); 56 | 57 | DispatchService.BackgroundDispatch(()=>{ 58 | try{ 59 | if (prj is DubProject) 60 | { 61 | DubBuilder.ExecuteProject(prj as DubProject, monitor, 62 | new ExecutionContext(MonoDevelop.Core.Runtime.ProcessService.DefaultExecutionHandler, Ide.IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget), 63 | IdeApp.Workspace.ActiveConfiguration, "test"); 64 | } 65 | else if(prj is DProject) 66 | { 67 | var dprj = prj as DProject; 68 | var cfg = dprj.GetConfiguration(IdeApp.Workspace.ActiveConfiguration) as DProjectConfiguration; 69 | 70 | var cmd = UnittestCore.ExtractCommand(UnittestSettings.UnittestCommand); 71 | string args = UnittestCore.GetCommandArgs(UnittestSettings.UnittestCommand.Substring(cmd.Length + 1), doc.FileName, dprj, cfg); 72 | string errorOutput; 73 | string stdOutput; 74 | string execDir = cfg.OutputDirectory.ToAbsolute(prj.BaseDirectory); 75 | 76 | ProjectBuilder.ExecuteCommand(cmd, args, execDir, monitor, out stdOutput, out errorOutput); 77 | 78 | monitor.Log.WriteLine(stdOutput); 79 | monitor.Log.WriteLine(errorOutput); 80 | } 81 | } 82 | catch(Exception ex) 83 | { 84 | monitor.ReportError("Error during unit testing", ex); 85 | } 86 | finally 87 | { 88 | monitor.Log.WriteLine("unittest done."); 89 | monitor.EndTask(); 90 | monitor.Dispose(); 91 | } 92 | }); 93 | } 94 | } 95 | } 96 | 97 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Unittest/Commands/UnittestCommands.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UnittestCommands.cs 3 | // 4 | // Author: 5 | // Foerdi 6 | // 7 | // https://github.com/aBothe/Mono-D/pull/334 8 | // 9 | // Copyright (c) 2013 10 | 11 | 12 | namespace MonoDevelop.D.Unittest.Commands 13 | { 14 | public enum UnittestCommands 15 | { 16 | RunAll, 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Unittest/UnittestCore.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UnittestCore.cs 3 | // 4 | // Author: 5 | // Foerdi 6 | // 7 | // https://github.com/aBothe/Mono-D/pull/334 8 | // 9 | // Copyright (c) 2013 10 | 11 | using System; 12 | using MonoDevelop.D.Projects; 13 | using MonoDevelop.D.Building; 14 | using MonoDevelop.Core; 15 | using MonoDevelop.Ide.Gui; 16 | using System.Collections.Generic; 17 | using System.IO; 18 | using MonoDevelop.Core.Execution; 19 | using System.Linq; 20 | using D_Parser.Dom; 21 | 22 | namespace MonoDevelop.D.Unittest 23 | { 24 | public static class UnittestCore 25 | { 26 | private static IConsole console; 27 | 28 | public static void RunExternal(string filePath, DProject project, DProjectConfiguration conf) 29 | { 30 | if(console == null) 31 | console = ExternalConsoleFactory.Instance.CreateConsole(false); 32 | 33 | string args = GetCommandArgs(UnittestSettings.UnittestCommand, filePath, project, conf); 34 | //string execDir = GetExecDir(project, conf); 35 | 36 | //Runtime.ProcessService.StartConsoleProcess(cmdParts[0],args,execDir,console,null); 37 | } 38 | 39 | class UnittestMacros : OneStepBuildArgumentMacroProvider 40 | { 41 | public bool HasMain = false; 42 | public string compilerFlags; 43 | public string linkerFlags; 44 | 45 | public override void ManipulateMacros(Dictionary macros) 46 | { 47 | macros["main"] = HasMain ? string.Empty : UnittestSettings.MainMethodFlag; 48 | macros["compilerflags"] = compilerFlags; 49 | macros["linkerflags"] = linkerFlags; 50 | 51 | base.ManipulateMacros(macros); 52 | } 53 | } 54 | 55 | public static string GetCommandArgs(string baseCommandArgs, string filePath, DProject project, DProjectConfiguration conf) 56 | { 57 | var compiler =project.Compiler; 58 | ProjectBuilder.PrjPathMacroProvider prjPath = new ProjectBuilder.PrjPathMacroProvider { 59 | slnPath = project.ParentSolution != null ? ProjectBuilder.EnsureCorrectPathSeparators(project.ParentSolution.BaseDirectory) : "" 60 | }; 61 | 62 | List includes = new List(project.IncludePaths); 63 | includes.Add(project.BaseDirectory.FullPath); 64 | 65 | string[] src = {filePath}; 66 | var compilerMacro = new UnittestMacros 67 | { 68 | ObjectsStringPattern = compiler.ArgumentPatterns.ObjectFileLinkPattern, 69 | IncludesStringPattern = compiler.ArgumentPatterns.IncludePathPattern, 70 | 71 | SourceFiles = src, 72 | Includes = ProjectBuilder.FillInMacros(includes, prjPath), 73 | Libraries = ProjectBuilder.GetLibraries(conf, compiler), 74 | 75 | HasMain = HasMainMethod(D_Parser.Misc.GlobalParseCache.GetModule(filePath)), 76 | compilerFlags = conf.ExtraCompilerArguments, 77 | linkerFlags = conf.ExtraLinkerArguments 78 | }; 79 | 80 | return ProjectBuilder.FillInMacros(baseCommandArgs,compilerMacro, prjPath); 81 | } 82 | 83 | public static bool HasMainMethod(DModule ast) 84 | { 85 | if (ast == null) 86 | return false; 87 | 88 | //TODO: pragma(main) 89 | 90 | var en = ast["main"]; 91 | if (en != null && en.Any((m) => m is DMethod)) 92 | return true; 93 | 94 | en = ast["WinMain"]; 95 | return en != null && en.Any((m) => m is DMethod); 96 | } 97 | 98 | public static string ExtractCommand(string args) 99 | { 100 | args = args.TrimStart(); 101 | int i; 102 | if (args.Length > 0 && args[0] == '"') 103 | i = args.IndexOf('"'); 104 | else 105 | i = args.IndexOf(' '); 106 | 107 | if (i > 0) 108 | return args.Substring(0, i); 109 | 110 | return string.Empty; 111 | } 112 | } 113 | } 114 | 115 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/Unittest/UnittestSettings.cs: -------------------------------------------------------------------------------- 1 | // 2 | // UnittestOptions.cs 3 | // 4 | // Author: 5 | // Alexander Bothe 6 | // 7 | // Copyright (c) 2013 Alexander Bothe 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | using System.Xml; 27 | 28 | namespace MonoDevelop.D.Unittest 29 | { 30 | public static class UnittestSettings 31 | { 32 | // $main 33 | public const string UnittestCommand_Default = "rdmd -unittest -main $libs $includes $sources $compilerflags $linkerflags"; 34 | public static string UnittestCommand = UnittestCommand_Default; 35 | public const string MainMethodFlag_Default = "-main"; 36 | public static string MainMethodFlag=MainMethodFlag_Default; 37 | 38 | internal static void Load(XmlReader x) 39 | { 40 | while (x.Read ()) { 41 | switch (x.LocalName) { 42 | case "UnittestCommand": 43 | UnittestCommand = x.ReadString (); 44 | break; 45 | case "MainMethodFlag": 46 | MainMethodFlag = x.ReadString (); 47 | break; 48 | } 49 | } 50 | } 51 | 52 | internal static void Save(XmlWriter x) 53 | { 54 | x.WriteStartElement("UnittestCommand"); 55 | x.WriteCData(UnittestCommand); 56 | x.WriteEndElement(); 57 | 58 | x.WriteStartElement("MainMethodFlag"); 59 | x.WriteCData(MainMethodFlag); 60 | x.WriteEndElement(); 61 | } 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/gtk-gui/MonoDevelop.D.ImportSymbolSelectionDlg.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace MonoDevelop.D 4 | { 5 | public partial class ImportSymbolSelectionDlg 6 | { 7 | private global::Gtk.ScrolledWindow GtkScrolledWindow; 8 | private global::Gtk.TreeView list; 9 | private global::Gtk.Button buttonCancel; 10 | private global::Gtk.Button buttonOk; 11 | 12 | protected virtual void Build () 13 | { 14 | global::Stetic.Gui.Initialize (this); 15 | // Widget MonoDevelop.D.ImportSymbolSelectionDlg 16 | this.Name = "MonoDevelop.D.ImportSymbolSelectionDlg"; 17 | this.Title = global::MonoDevelop.Core.GettextCatalog.GetString ("Select symbol to import"); 18 | this.WindowPosition = ((global::Gtk.WindowPosition)(1)); 19 | this.Modal = true; 20 | // Internal child MonoDevelop.D.ImportSymbolSelectionDlg.VBox 21 | global::Gtk.VBox w1 = this.VBox; 22 | w1.Name = "dialog1_VBox"; 23 | w1.BorderWidth = ((uint)(2)); 24 | // Container child dialog1_VBox.Gtk.Box+BoxChild 25 | this.GtkScrolledWindow = new global::Gtk.ScrolledWindow (); 26 | this.GtkScrolledWindow.Name = "GtkScrolledWindow"; 27 | // Container child GtkScrolledWindow.Gtk.Container+ContainerChild 28 | this.list = new global::Gtk.TreeView (); 29 | this.list.CanFocus = true; 30 | this.list.Name = "list"; 31 | this.list.HeadersVisible = false; 32 | this.list.SearchColumn = 0; 33 | this.GtkScrolledWindow.Add (this.list); 34 | w1.Add (this.GtkScrolledWindow); 35 | global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(w1 [this.GtkScrolledWindow])); 36 | w3.Position = 0; 37 | // Internal child MonoDevelop.D.ImportSymbolSelectionDlg.ActionArea 38 | global::Gtk.HButtonBox w4 = this.ActionArea; 39 | w4.Name = "dialog1_ActionArea"; 40 | w4.Spacing = 10; 41 | w4.BorderWidth = ((uint)(5)); 42 | w4.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); 43 | // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild 44 | this.buttonCancel = new global::Gtk.Button (); 45 | this.buttonCancel.CanFocus = true; 46 | this.buttonCancel.Name = "buttonCancel"; 47 | this.buttonCancel.UseStock = true; 48 | this.buttonCancel.UseUnderline = true; 49 | this.buttonCancel.Label = "gtk-cancel"; 50 | w4.Add (this.buttonCancel); 51 | global::Gtk.ButtonBox.ButtonBoxChild w5 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w4 [this.buttonCancel])); 52 | w5.Expand = false; 53 | w5.Fill = false; 54 | // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild 55 | this.buttonOk = new global::Gtk.Button (); 56 | this.buttonOk.CanDefault = true; 57 | this.buttonOk.CanFocus = true; 58 | this.buttonOk.Name = "buttonOk"; 59 | this.buttonOk.UseUnderline = true; 60 | this.buttonOk.Label = global::MonoDevelop.Core.GettextCatalog.GetString ("_OK"); 61 | w4.Add (this.buttonOk); 62 | global::Gtk.ButtonBox.ButtonBoxChild w6 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w4 [this.buttonOk])); 63 | w6.Position = 1; 64 | w6.Expand = false; 65 | w6.Fill = false; 66 | if ((this.Child != null)) { 67 | this.Child.ShowAll (); 68 | } 69 | this.DefaultWidth = 578; 70 | this.DefaultHeight = 312; 71 | this.buttonOk.HasDefault = true; 72 | this.Show (); 73 | this.KeyPressEvent += new global::Gtk.KeyPressEventHandler (this.OnKeyPressEvent); 74 | this.list.ButtonPressEvent += new global::Gtk.ButtonPressEventHandler (this.OnListButtonPressEvent); 75 | this.buttonCancel.Clicked += new global::System.EventHandler (this.OnButtonCancelClicked); 76 | this.buttonOk.Clicked += new global::System.EventHandler (this.OnButtonOkClicked); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/gtk-gui/MonoDevelop.D.OptionPanels.DubOptionPanel.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace MonoDevelop.D.OptionPanels 4 | { 5 | public partial class DubOptionPanel 6 | { 7 | private global::Gtk.Table table1; 8 | private global::Gtk.Label label1; 9 | private global::Gtk.Label label2; 10 | private global::Gtk.Entry text_commonArgs; 11 | private global::Gtk.Entry text_dub; 12 | 13 | protected virtual void Build () 14 | { 15 | global::Stetic.Gui.Initialize (this); 16 | // Widget MonoDevelop.D.OptionPanels.DubOptionPanel 17 | global::Stetic.BinContainer.Attach (this); 18 | this.Name = "MonoDevelop.D.OptionPanels.DubOptionPanel"; 19 | // Container child MonoDevelop.D.OptionPanels.DubOptionPanel.Gtk.Container+ContainerChild 20 | this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false); 21 | this.table1.Name = "table1"; 22 | this.table1.RowSpacing = ((uint)(6)); 23 | this.table1.ColumnSpacing = ((uint)(6)); 24 | // Container child table1.Gtk.Table+TableChild 25 | this.label1 = new global::Gtk.Label (); 26 | this.label1.Name = "label1"; 27 | this.label1.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("dub executable"); 28 | this.table1.Add (this.label1); 29 | global::Gtk.Table.TableChild w1 = ((global::Gtk.Table.TableChild)(this.table1 [this.label1])); 30 | w1.XOptions = ((global::Gtk.AttachOptions)(4)); 31 | w1.YOptions = ((global::Gtk.AttachOptions)(4)); 32 | // Container child table1.Gtk.Table+TableChild 33 | this.label2 = new global::Gtk.Label (); 34 | this.label2.Name = "label2"; 35 | this.label2.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Generic dub arguments"); 36 | this.table1.Add (this.label2); 37 | global::Gtk.Table.TableChild w2 = ((global::Gtk.Table.TableChild)(this.table1 [this.label2])); 38 | w2.TopAttach = ((uint)(1)); 39 | w2.BottomAttach = ((uint)(2)); 40 | w2.XOptions = ((global::Gtk.AttachOptions)(4)); 41 | w2.YOptions = ((global::Gtk.AttachOptions)(4)); 42 | // Container child table1.Gtk.Table+TableChild 43 | this.text_commonArgs = new global::Gtk.Entry (); 44 | this.text_commonArgs.CanFocus = true; 45 | this.text_commonArgs.Name = "text_commonArgs"; 46 | this.text_commonArgs.IsEditable = true; 47 | this.text_commonArgs.InvisibleChar = '•'; 48 | this.table1.Add (this.text_commonArgs); 49 | global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1 [this.text_commonArgs])); 50 | w3.TopAttach = ((uint)(1)); 51 | w3.BottomAttach = ((uint)(2)); 52 | w3.LeftAttach = ((uint)(1)); 53 | w3.RightAttach = ((uint)(2)); 54 | w3.YOptions = ((global::Gtk.AttachOptions)(4)); 55 | // Container child table1.Gtk.Table+TableChild 56 | this.text_dub = new global::Gtk.Entry (); 57 | this.text_dub.CanFocus = true; 58 | this.text_dub.Name = "text_dub"; 59 | this.text_dub.IsEditable = true; 60 | this.text_dub.InvisibleChar = '•'; 61 | this.table1.Add (this.text_dub); 62 | global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table1 [this.text_dub])); 63 | w4.LeftAttach = ((uint)(1)); 64 | w4.RightAttach = ((uint)(2)); 65 | w4.YOptions = ((global::Gtk.AttachOptions)(4)); 66 | this.Add (this.table1); 67 | if ((this.Child != null)) { 68 | this.Child.ShowAll (); 69 | } 70 | this.Hide (); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/gtk-gui/MonoDevelop.D.OptionPanels.EditCompilerName.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace MonoDevelop.D.OptionPanels 4 | { 5 | public partial class EditCompilerName 6 | { 7 | private global::Gtk.VBox vbox3; 8 | private global::Gtk.Label label1; 9 | private global::Gtk.Entry txtPresetName; 10 | private global::Gtk.Button buttonCancel; 11 | private global::Gtk.Button buttonOk; 12 | 13 | protected virtual void Build () 14 | { 15 | global::Stetic.Gui.Initialize (this); 16 | // Widget MonoDevelop.D.OptionPanels.EditCompilerName 17 | this.Name = "MonoDevelop.D.OptionPanels.EditCompilerName"; 18 | this.Title = global::MonoDevelop.Core.GettextCatalog.GetString ("Edit compiler preset name"); 19 | this.WindowPosition = ((global::Gtk.WindowPosition)(4)); 20 | // Internal child MonoDevelop.D.OptionPanels.EditCompilerName.VBox 21 | global::Gtk.VBox w1 = this.VBox; 22 | w1.Name = "dialog1_VBox"; 23 | w1.BorderWidth = ((uint)(2)); 24 | // Container child dialog1_VBox.Gtk.Box+BoxChild 25 | this.vbox3 = new global::Gtk.VBox (); 26 | this.vbox3.Name = "vbox3"; 27 | this.vbox3.Spacing = 6; 28 | // Container child vbox3.Gtk.Box+BoxChild 29 | this.label1 = new global::Gtk.Label (); 30 | this.label1.Name = "label1"; 31 | this.label1.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Enter the new compiler preset name"); 32 | this.vbox3.Add (this.label1); 33 | global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.label1])); 34 | w2.Position = 0; 35 | w2.Expand = false; 36 | w2.Fill = false; 37 | // Container child vbox3.Gtk.Box+BoxChild 38 | this.txtPresetName = new global::Gtk.Entry (); 39 | this.txtPresetName.CanFocus = true; 40 | this.txtPresetName.Name = "txtPresetName"; 41 | this.txtPresetName.IsEditable = true; 42 | this.txtPresetName.InvisibleChar = '•'; 43 | this.vbox3.Add (this.txtPresetName); 44 | global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.txtPresetName])); 45 | w3.Position = 1; 46 | w3.Expand = false; 47 | w3.Fill = false; 48 | w1.Add (this.vbox3); 49 | global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox3])); 50 | w4.Position = 0; 51 | w4.Expand = false; 52 | w4.Fill = false; 53 | // Internal child MonoDevelop.D.OptionPanels.EditCompilerName.ActionArea 54 | global::Gtk.HButtonBox w5 = this.ActionArea; 55 | w5.Name = "dialog1_ActionArea"; 56 | w5.Spacing = 10; 57 | w5.BorderWidth = ((uint)(5)); 58 | w5.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); 59 | // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild 60 | this.buttonCancel = new global::Gtk.Button (); 61 | this.buttonCancel.CanDefault = true; 62 | this.buttonCancel.CanFocus = true; 63 | this.buttonCancel.Name = "buttonCancel"; 64 | this.buttonCancel.UseStock = true; 65 | this.buttonCancel.UseUnderline = true; 66 | this.buttonCancel.Label = "gtk-cancel"; 67 | this.AddActionWidget (this.buttonCancel, -6); 68 | global::Gtk.ButtonBox.ButtonBoxChild w6 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w5 [this.buttonCancel])); 69 | w6.Expand = false; 70 | w6.Fill = false; 71 | // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild 72 | this.buttonOk = new global::Gtk.Button (); 73 | this.buttonOk.CanDefault = true; 74 | this.buttonOk.CanFocus = true; 75 | this.buttonOk.Name = "buttonOk"; 76 | this.buttonOk.UseStock = true; 77 | this.buttonOk.UseUnderline = true; 78 | this.buttonOk.Label = "gtk-ok"; 79 | this.AddActionWidget (this.buttonOk, -5); 80 | global::Gtk.ButtonBox.ButtonBoxChild w7 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w5 [this.buttonOk])); 81 | w7.Position = 1; 82 | w7.Expand = false; 83 | w7.Fill = false; 84 | if ((this.Child != null)) { 85 | this.Child.ShowAll (); 86 | } 87 | this.DefaultWidth = 400; 88 | this.DefaultHeight = 134; 89 | this.Show (); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/gtk-gui/MonoDevelop.D.ProjectDependenciesWidget.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace MonoDevelop.D 4 | { 5 | public partial class ProjectDependenciesWidget 6 | { 7 | private global::Gtk.VBox vbox2; 8 | private global::Gtk.Label label16; 9 | private global::Gtk.ScrolledWindow scrolledwindow2; 10 | private global::Gtk.VBox vbox_ProjectDeps; 11 | 12 | protected virtual void Build () 13 | { 14 | global::Stetic.Gui.Initialize (this); 15 | // Widget MonoDevelop.D.ProjectDependenciesWidget 16 | global::Stetic.BinContainer.Attach (this); 17 | this.HeightRequest = 300; 18 | this.Name = "MonoDevelop.D.ProjectDependenciesWidget"; 19 | // Container child MonoDevelop.D.ProjectDependenciesWidget.Gtk.Container+ContainerChild 20 | this.vbox2 = new global::Gtk.VBox (); 21 | this.vbox2.Name = "vbox2"; 22 | this.vbox2.Spacing = 6; 23 | // Container child vbox2.Gtk.Box+BoxChild 24 | this.label16 = new global::Gtk.Label (); 25 | this.label16.Name = "label16"; 26 | this.label16.Xalign = 0F; 27 | this.label16.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Checking a project in this list will add an include (that points to the respective project's base directory) to this project automatically."); 28 | this.label16.Wrap = true; 29 | this.vbox2.Add (this.label16); 30 | global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label16])); 31 | w1.Position = 0; 32 | w1.Expand = false; 33 | // Container child vbox2.Gtk.Box+BoxChild 34 | this.scrolledwindow2 = new global::Gtk.ScrolledWindow (); 35 | this.scrolledwindow2.CanFocus = true; 36 | this.scrolledwindow2.Name = "scrolledwindow2"; 37 | // Container child scrolledwindow2.Gtk.Container+ContainerChild 38 | global::Gtk.Viewport w2 = new global::Gtk.Viewport (); 39 | w2.ShadowType = ((global::Gtk.ShadowType)(0)); 40 | // Container child GtkViewport.Gtk.Container+ContainerChild 41 | this.vbox_ProjectDeps = new global::Gtk.VBox (); 42 | this.vbox_ProjectDeps.Name = "vbox_ProjectDeps"; 43 | this.vbox_ProjectDeps.Spacing = 6; 44 | w2.Add (this.vbox_ProjectDeps); 45 | this.scrolledwindow2.Add (w2); 46 | this.vbox2.Add (this.scrolledwindow2); 47 | global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow2])); 48 | w5.Position = 1; 49 | this.Add (this.vbox2); 50 | if ((this.Child != null)) { 51 | this.Child.ShowAll (); 52 | } 53 | this.Show (); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/gtk-gui/MonoDevelop.D.ResourcesCompilerOptionsPanel.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace MonoDevelop.D 4 | { 5 | public partial class ResourcesCompilerOptionsPanel 6 | { 7 | private global::Gtk.Table table1; 8 | private global::Gtk.Label label3; 9 | private global::Gtk.Label label4; 10 | private global::Gtk.Entry text_BuildArgs; 11 | private global::Gtk.Entry text_CompilerExecutable; 12 | 13 | protected virtual void Build () 14 | { 15 | global::Stetic.Gui.Initialize (this); 16 | // Widget MonoDevelop.D.ResourcesCompilerOptionsPanel 17 | global::Stetic.BinContainer.Attach (this); 18 | this.Name = "MonoDevelop.D.ResourcesCompilerOptionsPanel"; 19 | // Container child MonoDevelop.D.ResourcesCompilerOptionsPanel.Gtk.Container+ContainerChild 20 | this.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false); 21 | this.table1.Name = "table1"; 22 | this.table1.RowSpacing = ((uint)(4)); 23 | this.table1.ColumnSpacing = ((uint)(2)); 24 | // Container child table1.Gtk.Table+TableChild 25 | this.label3 = new global::Gtk.Label (); 26 | this.label3.Name = "label3"; 27 | this.label3.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Compiler Executable"); 28 | this.table1.Add (this.label3); 29 | global::Gtk.Table.TableChild w1 = ((global::Gtk.Table.TableChild)(this.table1 [this.label3])); 30 | w1.XOptions = ((global::Gtk.AttachOptions)(4)); 31 | w1.YOptions = ((global::Gtk.AttachOptions)(4)); 32 | // Container child table1.Gtk.Table+TableChild 33 | this.label4 = new global::Gtk.Label (); 34 | this.label4.Name = "label4"; 35 | this.label4.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Build Arguments"); 36 | this.table1.Add (this.label4); 37 | global::Gtk.Table.TableChild w2 = ((global::Gtk.Table.TableChild)(this.table1 [this.label4])); 38 | w2.TopAttach = ((uint)(1)); 39 | w2.BottomAttach = ((uint)(2)); 40 | w2.XOptions = ((global::Gtk.AttachOptions)(4)); 41 | w2.YOptions = ((global::Gtk.AttachOptions)(4)); 42 | // Container child table1.Gtk.Table+TableChild 43 | this.text_BuildArgs = new global::Gtk.Entry (); 44 | this.text_BuildArgs.CanFocus = true; 45 | this.text_BuildArgs.Name = "text_BuildArgs"; 46 | this.text_BuildArgs.IsEditable = true; 47 | this.text_BuildArgs.InvisibleChar = '●'; 48 | this.table1.Add (this.text_BuildArgs); 49 | global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1 [this.text_BuildArgs])); 50 | w3.TopAttach = ((uint)(1)); 51 | w3.BottomAttach = ((uint)(2)); 52 | w3.LeftAttach = ((uint)(1)); 53 | w3.RightAttach = ((uint)(2)); 54 | w3.YOptions = ((global::Gtk.AttachOptions)(4)); 55 | // Container child table1.Gtk.Table+TableChild 56 | this.text_CompilerExecutable = new global::Gtk.Entry (); 57 | this.text_CompilerExecutable.CanFocus = true; 58 | this.text_CompilerExecutable.Name = "text_CompilerExecutable"; 59 | this.text_CompilerExecutable.IsEditable = true; 60 | this.text_CompilerExecutable.MaxLength = 250; 61 | this.text_CompilerExecutable.InvisibleChar = '●'; 62 | this.table1.Add (this.text_CompilerExecutable); 63 | global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table1 [this.text_CompilerExecutable])); 64 | w4.LeftAttach = ((uint)(1)); 65 | w4.RightAttach = ((uint)(2)); 66 | w4.YOptions = ((global::Gtk.AttachOptions)(4)); 67 | this.Add (this.table1); 68 | if ((this.Child != null)) { 69 | this.Child.ShowAll (); 70 | } 71 | this.Hide (); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/gtk-gui/generated.cs: -------------------------------------------------------------------------------- 1 | 2 | // This file has been generated by the GUI designer. Do not modify. 3 | namespace Stetic 4 | { 5 | internal class Gui 6 | { 7 | private static bool initialized; 8 | 9 | internal static void Initialize (Gtk.Widget iconRenderer) 10 | { 11 | if ((Gui.initialized == false)) { 12 | Gui.initialized = true; 13 | } 14 | } 15 | } 16 | 17 | internal class BinContainer 18 | { 19 | private Gtk.Widget child; 20 | private Gtk.UIManager uimanager; 21 | 22 | public static BinContainer Attach (Gtk.Bin bin) 23 | { 24 | BinContainer bc = new BinContainer (); 25 | bin.SizeRequested += new Gtk.SizeRequestedHandler (bc.OnSizeRequested); 26 | bin.SizeAllocated += new Gtk.SizeAllocatedHandler (bc.OnSizeAllocated); 27 | bin.Added += new Gtk.AddedHandler (bc.OnAdded); 28 | return bc; 29 | } 30 | 31 | private void OnSizeRequested (object sender, Gtk.SizeRequestedArgs args) 32 | { 33 | if ((this.child != null)) { 34 | args.Requisition = this.child.SizeRequest (); 35 | } 36 | } 37 | 38 | private void OnSizeAllocated (object sender, Gtk.SizeAllocatedArgs args) 39 | { 40 | if ((this.child != null)) { 41 | this.child.Allocation = args.Allocation; 42 | } 43 | } 44 | 45 | private void OnAdded (object sender, Gtk.AddedArgs args) 46 | { 47 | this.child = args.Widget; 48 | } 49 | 50 | public void SetUiManager (Gtk.UIManager uim) 51 | { 52 | this.uimanager = uim; 53 | this.child.Realized += new System.EventHandler (this.OnRealized); 54 | } 55 | 56 | private void OnRealized (object sender, System.EventArgs args) 57 | { 58 | if ((this.uimanager != null)) { 59 | Gtk.Widget w; 60 | w = this.child.Toplevel; 61 | if (((w != null) && typeof(Gtk.Window).IsInstanceOfType (w))) { 62 | ((Gtk.Window)(w)).AddAccelGroup (this.uimanager.AccelGroup); 63 | this.uimanager = null; 64 | } 65 | } 66 | } 67 | } 68 | 69 | internal class IconLoader 70 | { 71 | public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size) 72 | { 73 | Gdk.Pixbuf res = widget.RenderIcon (name, size, null); 74 | if ((res != null)) { 75 | return res; 76 | } else { 77 | int sz; 78 | int sy; 79 | global::Gtk.Icon.SizeLookup (size, out sz, out sy); 80 | try { 81 | return Gtk.IconTheme.Default.LoadIcon (name, sz, 0); 82 | } catch (System.Exception) { 83 | if ((name != "gtk-missing-image")) { 84 | return IconLoader.LoadIcon (widget, "gtk-missing-image", size); 85 | } else { 86 | Gdk.Pixmap pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, sz, sz); 87 | Gdk.GC gc = new Gdk.GC (pmap); 88 | gc.RgbFgColor = new Gdk.Color (255, 255, 255); 89 | pmap.DrawRectangle (gc, true, 0, 0, sz, sz); 90 | gc.RgbFgColor = new Gdk.Color (0, 0, 0); 91 | pmap.DrawRectangle (gc, false, 0, 0, (sz - 1), (sz - 1)); 92 | gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); 93 | gc.RgbFgColor = new Gdk.Color (255, 0, 0); 94 | pmap.DrawLine (gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4))); 95 | pmap.DrawLine (gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4))); 96 | return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz); 97 | } 98 | } 99 | } 100 | } 101 | } 102 | 103 | internal class ActionGroups 104 | { 105 | public static Gtk.ActionGroup GetActionGroup (System.Type type) 106 | { 107 | return ActionGroups.GetActionGroup (type.FullName); 108 | } 109 | 110 | public static Gtk.ActionGroup GetActionGroup (string name) 111 | { 112 | return null; 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-avx-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-avx-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-fpu-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-fpu-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-mmx-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-mmx-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-sse-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-sse-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-sse2-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-sse2-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-sse3-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-sse3-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-sse4.1-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-sse4.1-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-sse4.2-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-sse4.2-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-ssse3-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-ssse3-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-x64-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-x64-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/d-asm-x86-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/d-asm-x86-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/dfile16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/dfile16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/dfile32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/dfile32.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/dproj16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/dproj16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/dproj32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/dproj32.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-abstract-class-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-abstract-class-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-abstract-method-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-abstract-method-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-alias-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-alias-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-local-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-local-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-local-16.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-local-16.psd -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-parameter-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-parameter-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/element-union-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/element-union-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/lazy-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/lazy-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/out-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/out-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/ref-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/ref-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/icons/static-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/MonoDevelop.DBinding/icons/static-16.png -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/AnsiFile.cs: -------------------------------------------------------------------------------- 1 | using MonoDevelop.Ide.Templates; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace MonoDevelop.D.templates 9 | { 10 | class AnsiFile : TextFileDescriptionTemplate 11 | { 12 | public override System.IO.Stream CreateFileContent(MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, string language, string fileName, string identifier) 13 | { 14 | var s = base.CreateFileContent(policyParent, project, language, fileName, identifier); 15 | 16 | using (var r = new StreamReader(s)) 17 | return new MemoryStream(Encoding.ASCII.GetBytes(r.ReadToEnd()), false); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/ConsoleProject.xpt.xml: -------------------------------------------------------------------------------- 1 | 2 | 42 | 43 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/DFileDescriptionTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using D_Parser.Dom; 3 | using MonoDevelop.Core; 4 | using MonoDevelop.D.Formatting; 5 | using MonoDevelop.Ide.Gui.Content; 6 | using MonoDevelop.Ide.StandardHeader; 7 | using MonoDevelop.Ide.Templates; 8 | using MonoDevelop.D.Projects; 9 | 10 | namespace MonoDevelop.D.templates 11 | { 12 | public class DFileDescriptionTemplate : TextFileDescriptionTemplate 13 | { 14 | bool addStdHeader = true; 15 | 16 | public override string CreateContent(MonoDevelop.Projects.Project project, Dictionary tags, string language) 17 | { 18 | var cc = base.CreateContent(project, tags, language); 19 | 20 | if (addStdHeader) 21 | { 22 | StandardHeaderPolicy headerPolicy = project != null ? project.Policies.Get() : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy(); 23 | TextStylePolicy textPolicy = project != null ? project.Policies.Get("text/plain") : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy("text/plain"); 24 | DFormattingPolicy dPolicy = project != null ? project.Policies.Get("text/x-d") : MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy("text/x-d"); 25 | 26 | if (string.IsNullOrWhiteSpace(headerPolicy.Text) || !headerPolicy.IncludeInNewFiles) 27 | return cc; 28 | 29 | var eol = TextStylePolicy.GetEolMarker(textPolicy.EolMarker); 30 | 31 | var hdr= StringParserService.Parse(headerPolicy.Text, tags); 32 | 33 | if (dPolicy.CommentOutStandardHeaders) 34 | { 35 | var headerLines = hdr.Split('\n'); 36 | 37 | if (headerLines.Length == 1) 38 | return "/// " + headerLines[0].Trim() + eol + cc; 39 | else 40 | { 41 | var ret = "/**" + eol; 42 | for (int i = 0; i < headerLines.Length; i++) 43 | ret += " * " + headerLines[i].Trim() + eol; 44 | return ret + " */" + eol + cc; 45 | } 46 | } 47 | else 48 | return hdr + eol + cc; 49 | } 50 | 51 | return cc; 52 | } 53 | 54 | public override void ModifyTags( 55 | MonoDevelop.Projects.SolutionItem policyParent, 56 | MonoDevelop.Projects.Project project, 57 | string language, 58 | string identifier, 59 | string fileName, 60 | ref Dictionary tags) 61 | { 62 | base.ModifyTags(policyParent, project, language, identifier, fileName, ref tags); 63 | const string ModuleNameTag = "ModuleName"; 64 | if (tags != null) { 65 | var dprj = project as AbstractDProject; 66 | if (dprj != null) { 67 | if(fileName != null) 68 | foreach (var basePath in dprj.GetSourcePaths()) { 69 | var bp = System.IO.Path.GetFullPath (basePath); 70 | if (fileName.StartsWith (bp)) { 71 | tags [ModuleNameTag] = DModule.GetModuleName (bp, fileName); 72 | break; 73 | } 74 | } 75 | } 76 | 77 | if(!tags.ContainsKey(ModuleNameTag)) 78 | tags [ModuleNameTag] = DModule.GetModuleName (project == null ? string.Empty : project.BaseDirectory.ToString (), fileName ?? identifier ?? string.Empty).Replace (' ', '_'); 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/EmptyDClass.xft.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/EmptyDFile.xft.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/EmptyProject.xpt.xml: -------------------------------------------------------------------------------- 1 | 2 | 24 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/EmptyRCFile.xft.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/SharedLibrary.xpt.xml: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /MonoDevelop.DBinding/templates/StaticLibrary.xpt.xml: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /addin-project.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | MonoDevelop.DBinding/bin/Debug/MonoDevelop.D.dll 4 | MonoDevelop.DBinding.sln 5 | Debug 6 | 7 | 8 | -------------------------------------------------------------------------------- /build/BuildRepoFiles.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set P="C:\Program Files (x86)\Xamarin Studio\bin\mdtool.exe" 4 | 5 | %P% setup pack ..\MonoDevelop.DBinding\bin\Debug\MonoDevelop.D.dll -------------------------------------------------------------------------------- /build/buildrepofiles: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /opt/mono/bin/mdtool setup pack ../MonoDevelop.DBinding/bin/Debug/MonoDevelop.D.dll -------------------------------------------------------------------------------- /ext/ICSharpCode.NRefactory.CSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/ICSharpCode.NRefactory.CSharp.dll -------------------------------------------------------------------------------- /ext/ICSharpCode.NRefactory.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/ICSharpCode.NRefactory.dll -------------------------------------------------------------------------------- /ext/ICSharpCode.SharpZipLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/ICSharpCode.SharpZipLib.dll -------------------------------------------------------------------------------- /ext/Mono.Addins.Setup.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/Mono.Addins.Setup.dll -------------------------------------------------------------------------------- /ext/Mono.Addins.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/Mono.Addins.dll -------------------------------------------------------------------------------- /ext/Mono.Debugging.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/Mono.Debugging.dll -------------------------------------------------------------------------------- /ext/Mono.TextEditor.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/Mono.TextEditor.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.Core.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.Debugger.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.Debugger.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.DesignerSupport.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.DesignerSupport.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.GtkCore.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.GtkCore.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.Ide.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.Ide.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.Refactoring.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.Refactoring.dll -------------------------------------------------------------------------------- /ext/MonoDevelop.SourceEditor2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/MonoDevelop.SourceEditor2.dll -------------------------------------------------------------------------------- /ext/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /ext/Xwt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/Xwt.dll -------------------------------------------------------------------------------- /ext/libstetic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/libstetic.dll -------------------------------------------------------------------------------- /ext/libsteticui.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aBothe/Mono-D/0197a8aff1fd9c5f382fe39f2d5110d959368521/ext/libsteticui.dll -------------------------------------------------------------------------------- /ext/update deps.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set xsbin=C:\Program Files (x86)\Xamarin Studio\bin 4 | set xsaddin=C:\Program Files (x86)\Xamarin Studio\Addins 5 | 6 | echo \bin: 7 | copy "%xsbin%\Mono.Addins.dll" . 8 | copy "%xsbin%\Mono.Addins.Setup.dll" . 9 | copy "%xsbin%\Mono.Debugging.dll" . 10 | copy "%xsbin%\Mono.TextEditor.dll" . 11 | copy "%xsbin%\MonoDevelop.Core.dll" . 12 | copy "%xsbin%\MonoDevelop.Ide.dll" . 13 | copy "%xsbin%\Newtonsoft.Json.dll" . 14 | copy "%xsbin%\ICSharpCode.NRefactory.dll" . 15 | copy "%xsbin%\ICSharpCode.NRefactory.CSharp.dll" . 16 | copy "%xsbin%\ICSharpCode.SharpZipLib.dll" . 17 | copy "%xsbin%\Xwt.dll" . 18 | 19 | echo \Addins: 20 | copy "%xsaddin%\MonoDevelop.Debugger\MonoDevelop.Debugger.dll" . 21 | copy "%xsaddin%\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.dll" . 22 | copy "%xsaddin%\MonoDevelop.GtkCore\MonoDevelop.GtkCore.dll" . 23 | copy "%xsaddin%\MonoDevelop.GtkCore\libsteticui.dll" . 24 | copy "%xsaddin%\MonoDevelop.GtkCore\libstetic.dll" . 25 | copy "%xsaddin%\MonoDevelop.Refactoring\MonoDevelop.Refactoring.dll" . 26 | copy "%xsaddin%\DisplayBindings\SourceEditor\MonoDevelop.SourceEditor2.dll" . 27 | 28 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 |  2 | Copyright 2012 Alexander Bothe 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /make symlink.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Creates a symlink between the Mono-D output directory and the addins dictionary of MonoDevelop 4 | rem to save copying the lib files over and over again 5 | 6 | rem TODO: Fit to target path 7 | mklink /D /J "%APPDATA%\..\Local\XamarinStudio-5.0\LocalInstall\Addins\mono-d" MonoDevelop.DBinding\bin\Debug 8 | 9 | pause -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | Mono-D is a language binding for MonoDevelop for the [D Programming language](http://dlang.org). 3 | 4 | [Project site](http://wiki.dlang.org/Mono-D). 5 | 6 | Few (none?) GNU/Linux distros package a new enough MonoDevelop required by Mono-D. 7 | You can download pre-built binaries built with mono3 below. Unpack to `/opt/mono`. 8 | * [MonoDevelop GNU/Linux **x64**](http://simendsjo.me/files/abothe/MonoDevelop.x64.Master.tar.xz) 9 | 10 | # How to initialize Mono-D development under Linux 11 | 12 | [![Join the chat at https://gitter.im/aBothe/Mono-D](https://badges.gitter.im/aBothe/Mono-D.svg)](https://gitter.im/aBothe/Mono-D?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 13 | 14 | * Setup MonoDevelop to use /opt/mono instead of other runtimes 15 | - Open MonoDevelop 16 | - Go to Edit -> Options -> Projects tab -> .NET Runtimes 17 | - Enter /opt/mono as new runtime if it's not there already! 18 | - Select it as standard runtime 19 | - Now you can build Mono-D with its gtk-sharp dependencies and no Mono.Cairo conflicts 20 | * Clone Mono-D 21 | - Open a terminal in your projects folder 22 | - `git clone https://github.com/aBothe/Mono-D.git` 23 | - `cd Mono-D` 24 | - `git submodule init` 25 | - `git submodule update` 26 | * Build Mono-D 27 | - Open & build the main solution 28 | - Add symlinks from projectdir/Mono-D/bin/Debug/* to your MonoDevelop AddIns folder 29 | - `cd /opt/mono/lib/monodevelop/AddIns` 30 | - `ln -s -d %YourProjectDirectory%/Mono-D/bin/Debug D` 31 | - In the solution view, open the MonoDevelop.D options -> Properties -> Run -> Custom Commands 32 | - Choose Execute 33 | - Set `/opt/mono/bin/monodevelop` as executable 34 | - Working directory can be left empty 35 | - Confirm via OK 36 | - Press F5 to debug 37 | 38 | # How to initialize Mono-D development under Windows 39 | 40 | * Clone Mono-D 41 | - Open a git bash in your projects folder 42 | - `git clone https://github.com/aBothe/Mono-D.git` 43 | - `cd Mono-D` 44 | - `git submodule init` 45 | - `git submodule update` 46 | * Build Mono-D 47 | - Open & build the main solution inside Visual Studio or Xamarin Studio (the latter is required to do changes on Gtk#-based Option Panels etc.) 48 | - Add symlinks from projectdir/Mono-D/bin/Debug/* to your MonoDevelop AddIns folder 49 | - Run the `make symlink.bat` that is located inside the folder root 50 | - You might want to set a new default executable path to XamarinStudio.exe, but normally, this is not necessary if you've installed XS via the normal installer 51 | - Run & Debug Mono-D 52 | --------------------------------------------------------------------------------