コード例 #1
0
        public virtual bool CanHandle(FilePath fileName, string mimeType, Project ownerProject)
        {
            if (excludeThis)
            {
                return(false);
            }

            var dprj = ownerProject as AbstractDProject;

            if (dprj == null)
            {
                return(false);
            }

            var mod = GlobalParseCache.GetModule(fileName.ToString());

            if (GetGtkDMainClass(mod) == null)
            {
                return(false);
            }

            excludeThis = true;
            var db = DisplayBindingService.GetDefaultViewBinding(fileName, mimeType, ownerProject);

            excludeThis = false;
            return(db != null);
        }
コード例 #2
0
        public static DModule GetFileSyntaxTree(string file, out AbstractDProject OwnerProject)
        {
            var doc = IdeApp.Workbench.ActiveDocument;

            OwnerProject = doc.Project as AbstractDProject;
            var dparsedDoc = doc.ParsedDocument as MonoDevelop.D.Parser.ParsedDModule;

            return(dparsedDoc != null ? dparsedDoc.DDom : GlobalParseCache.GetModule(file));
        }
コード例 #3
0
        public DModule GetModule(string fileName)
        {
            DModule mod;

            if (!_modules.TryGetValue(fileName, out mod))
            {
                GlobalParseCache.GetModule(fileName);
            }
            return(mod);
        }
コード例 #4
0
        public DModule GetModule(string fileName)
        {
            DModule mod;

            mod = GlobalParseCache.GetModule(fileName);
            if (mod == null)
            {
                _modules.TryGetValue(fileName, out mod);
            }
            return(mod);
        }
コード例 #5
0
ファイル: VDServer.cs プロジェクト: bleskodev/visuald
        public DModule GetModule(string fileName)
        {
            if (!_sources.ContainsKey(fileName))
            {
                return(null);
            }
            DModule mod = GlobalParseCache.GetModule(fileName);

            if (mod == null)
            {
                _modules.TryGetValue(fileName, out mod);
            }
            return(mod);
        }
コード例 #6
0
ファイル: DLanguageBinding.cs プロジェクト: aBothe/D-IDE
        /// <summary>
        /// Searches in current solution and in the global cache for the given file and returns it.
        /// If not found, file will be parsed.
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public static DModule GetFileSyntaxTree(string file, out DProject OwnerProject)
        {
            OwnerProject = null;
            var mod = GlobalParseCache.GetModule(file);

            if (CoreManager.CurrentSolution != null)
            {
                foreach (var prj in CoreManager.CurrentSolution)
                {
                    var dprj = prj as DProject;

                    if (dprj != null && dprj.ContainsFile(file))
                    {
                        OwnerProject = dprj;
                    }
                }
            }

            return(mod ?? DParser.ParseFile(file));
        }
コード例 #7
0
 public static DModule GetAstModule(Uri uri)
 {
     return(GlobalParseCache.GetModule(uri.AbsolutePath) ?? OpenFiles[uri].Module);
 }
コード例 #8
0
        public void TryUpdateStackFrameInfo()
        {
            if (needsStackFrameInfoUpdate || ctxt == null)
            {
                string       file;
                ulong        eip;
                CodeLocation loc;

                BacktraceHelper.GetCurrentStackFrameInfo(out file, out eip, out loc);
                currentStackFrameSource = file;
                currentInstruction      = eip;
                currentSourceLocation   = loc;

                if (needsStackFrameInfoUpdate = string.IsNullOrWhiteSpace(file))
                {
                    return;
                }

                needsStackFrameInfoUpdate |= loc.IsEmpty;

                var mod = GlobalParseCache.GetModule(file);
                if (ctxt == null)
                {
                    var doc = Ide.IdeApp.Workbench.GetDocument(file);

                    if (doc != null)
                    {
                        ctxt = ResolutionContext.Create(MonoDevelop.D.Resolver.DResolverWrapper.CreateEditorData(doc), false);
                    }

                    SymbolProvider = new DebugSymbolValueProvider(this, ctxt);

                    if (doc == null)
                    {
                        return;
                    }
                }

                if (SymbolProvider.ResolutionContext == null)
                {
                    SymbolProvider = new DebugSymbolValueProvider(this, ctxt);
                }

                SymbolProvider.ResetCache();

                if (mod == null)
                {
                    if (ctxt.CurrentContext != null)
                    {
                        ctxt.CurrentContext.Set(loc);
                    }
                }
                else
                {
                    var bn = D_Parser.Resolver.TypeResolution.DResolver.SearchBlockAt(mod, loc);
                    if (ctxt.CurrentContext == null)
                    {
                        ctxt.Push(bn, loc);
                    }
                    else
                    {
                        ctxt.CurrentContext.Set(bn, loc);
                    }
                }
            }
        }