Exemple #1
0
        internal static DesignerErrorList GetSingleDocErrorList(Uri uri)
        {
            DesignerErrorList errorList = null;

            var currentProject = VSHelpers.GetProjectForDocument(uri.LocalPath, PackageManager.Package);

            if (currentProject != null)
            {
                var hierarchy = VsUtils.GetVsHierarchy(currentProject, Services.ServiceProvider);
                if (hierarchy != null)
                {
                    var fileFinder = new VSFileFinder(uri.LocalPath);
                    fileFinder.FindInProject(hierarchy);

                    Debug.Assert(fileFinder.MatchingFiles.Count <= 1, "Unexpected count of matching files in project");

                    foreach (var vsFileInfo in fileFinder.MatchingFiles)
                    {
                        if (vsFileInfo.Hierarchy == VsUtils.GetVsHierarchy(currentProject, Services.ServiceProvider))
                        {
                            errorList = GetSingleDocErrorList(vsFileInfo.Hierarchy, vsFileInfo.ItemId);
                            break;
                        }
                    }
                }
            }

            return(errorList);
        }
Exemple #2
0
        internal static void ClearErrorsForDocAcrossLists(Uri uri)
        {
            var currentProject = VSHelpers.GetProjectForDocument(uri.LocalPath, PackageManager.Package);

            if (currentProject != null)
            {
                var hierarchy = VsUtils.GetVsHierarchy(currentProject, Services.ServiceProvider);
                if (hierarchy != null)
                {
                    var fileFinder = new VSFileFinder(uri.LocalPath);
                    fileFinder.FindInProject(hierarchy);

                    Debug.Assert(fileFinder.MatchingFiles.Count <= 1, "Unexpected count of matching files in project");
                    foreach (var vsFileInfo in fileFinder.MatchingFiles)
                    {
                        if (vsFileInfo.Hierarchy == hierarchy)
                        {
                            ClearErrorsForDocAcrossLists(vsFileInfo.Hierarchy, vsFileInfo.ItemId);
                            break;
                        }
                    }
                }
            }
        }