コード例 #1
0
        void UpdateCommentTagsForProject(Solution solution, Project project, CancellationToken token)
        {
            if (token.IsCancellationRequested)
            {
                return;
            }
            ProjectCommentTags tags;

            if (!projectTags.TryGetValue(project, out tags))
            {
                tags = new ProjectCommentTags();
                projectTags [project] = tags;
            }
            var files = project.Files.ToArray();

            Task.Run(async() => {
                try {
                    await tags.UpdateAsync(project, files, token);
                } catch (TaskCanceledException) {
                } catch (AggregateException ae) {
                    ae.Flatten().Handle(x => x is TaskCanceledException);
                } catch (Exception e) {
                    LoggingService.LogError("Error while updating comment tags.", e);
                }
            });
        }
コード例 #2
0
 void LoadSolutionContents(Solution sln)
 {
     loadedSlns.Add(sln);
     System.Threading.ThreadPool.QueueUserWorkItem(delegate {
         // Load all tags that are stored in pidb files
         foreach (Project p in sln.GetAllProjects())
         {
             var pContext = TypeSystemService.GetProjectContentWrapper(p);
             if (pContext == null)
             {
                 continue;
             }
             var tags = pContext.GetExtensionObject <ProjectCommentTags> ();
             if (tags == null)
             {
                 tags = new ProjectCommentTags();
                 pContext.UpdateExtensionObject(tags);
                 tags.Update(pContext.Project);
             }
             else
             {
                 foreach (var kv in tags.Tags)
                 {
                     UpdateCommentTags(sln, kv.Key, kv.Value);
                 }
             }
         }
     });
 }
コード例 #3
0
            static void UpdateCommentTagsForProject(Project project, CancellationToken token)
            {
                if (token.IsCancellationRequested)
                {
                    return;
                }
                ProjectCommentTags tags;

                if (!projectTags.TryGetValue(project, out tags))
                {
                    tags = new ProjectCommentTags();
                    projectTags [project] = tags;
                }

                var files = project.Files.Where(x => {
                    var mt = DesktopService.GetMimeTypeForUri(x.FilePath);
                    // FIXME: Handle all language services.

                    // Discard files with known IToDoCommentService implementations
                    return(mt != "text/x-csharp");
                }).ToArray();

                Task.Run(async() => {
                    try {
                        await tags.UpdateAsync(project, files, token);
                    } catch (OperationCanceledException) {
                    } catch (Exception e) {
                        LoggingService.LogError("Error while updating comment tags.", e);
                    }
                });
            }
コード例 #4
0
            static void UpdateCommentTagsForProject(Project project, CancellationToken token)
            {
                if (token.IsCancellationRequested)
                {
                    return;
                }
                ProjectCommentTags tags;

                if (!projectTags.TryGetValue(project, out tags))
                {
                    tags = new ProjectCommentTags();
                    projectTags [project] = tags;
                }

                var files = project.Files.Where(x => {
                    var mt = IdeServices.DesktopService.GetMimeTypeForUri(x.FilePath);
                    if (!IdeServices.DesktopService.GetMimeTypeIsText(mt))
                    {
                        return(false);
                    }

                    // Don't process files which are handled by roslyn.
                    var useLegacy = IdeServices.DesktopService.GetRoslynLanguageForMimeType(mt) == null;
                    return(useLegacy);
                }).ToArray();

                Task.Run(async() => {
                    try {
                        await tags.UpdateAsync(project, files, token);
                    } catch (OperationCanceledException) {
                    } catch (Exception e) {
                        LoggingService.LogError("Error while updating comment tags.", e);
                    }
                }).Ignore();
            }
コード例 #5
0
        void UpdateCommentTagsForProject(Solution solution, Project project)
        {
            var ctx = TypeSystemService.GetProjectContentWrapper(project);

            if (ctx == null)
            {
                return;
            }
            var tags = ctx.GetExtensionObject <ProjectCommentTags> ();

            if (tags == null)
            {
                tags = new ProjectCommentTags();
                ctx.UpdateExtensionObject(tags);
                tags.Update(ctx.Project);
            }
            else
            {
                foreach (var kv in tags.Tags)
                {
                    UpdateCommentTags(solution, kv.Key, kv.Value);
                }
            }
        }