Cleanup Code does not trigger my plugin, why ?

Hello,

I'm working on a simple Cleanup Code plugin that basically formats the xml comments, I can see that the plugin is loaded and is showing up on the options just fine but when I try to debug it by running the Cleanup Code and set a BreakpointI don't get anything, like it's not even there, why ?

Here is the code.

namespace EyalShilony.ReSharper.XmlComments
{
     using System.Collections.Generic;
     using System.Linq;

     using JetBrains.Application.Progress;
     using JetBrains.DocumentModel;
     using JetBrains.ReSharper.Feature.Services.CSharp.CodeCleanup;
     using JetBrains.ReSharper.Feature.Services.CodeCleanup;
     using JetBrains.ReSharper.Psi;
     using JetBrains.ReSharper.Psi.CSharp;
     using JetBrains.ReSharper.Psi.CSharp.CodeStyle;
     using JetBrains.ReSharper.Psi.CSharp.Tree;
     using JetBrains.ReSharper.Psi.Tree;
     using JetBrains.Util;

     [CodeCleanupModule(ModulesBefore = new[] { typeof(UpdateFileHeader), typeof(ArrangeThisQualifier), typeof(ReplaceByVar), typeof(ReformatCode) })]
     public class XmlCommentsCodeCleanupModule : ICodeCleanupModule
     {
          /// <summary>
          ///   Spacing descriptor.
          /// </summary>
          private static readonly XmlCommentsDescriptor SpacingDescriptor = new XmlCommentsDescriptor();

          public ICollection<CodeCleanupOptionDescriptor> Descriptors
          {
               get
               {
                    return new CodeCleanupOptionDescriptor[] { SpacingDescriptor };
               }
          }

          public bool IsAvailableOnSelection
          {
               get
               {
                    return true;
               }
          }

          public PsiLanguageType LanguageType
          {
               get
               {
                    return CSharpLanguage.Instance;
               }
          }

          public bool IsAvailable(IPsiSourceFile sourceFile)
          {
               return sourceFile.GetPsiFile<CSharpLanguage>() != null;
          }

          public void Process(IPsiSourceFile sourceFile, IRangeMarker range, CodeCleanupProfile profile, IProgressIndicator progressIndicator)
          {
               if (sourceFile == null)
               {
                    return;
               }

               if (!IsAvailable(sourceFile))
               {
                    return;
               }

               var solution = sourceFile.GetSolution();
               
               var file = sourceFile.GetPsiFile<CSharpLanguage>() as ICSharpFile;

               ICSharpCodeFormatter formatter = LanguageType.LanguageService().CodeFormatter as ICSharpCodeFormatter;

               PsiManager.GetInstance(solution).DoTransaction(() => ProcessCore(profile, file, range, formatter), "Code cleanup");
          }

          public void SetDefaultSetting(CodeCleanupProfile profile, CodeCleanup.DefaultProfileType profileType)
          {
               profile.SetSetting(SpacingDescriptor, new XmlCommentsSpacingOptions());
          }

          private void ProcessCore(CodeCleanupProfile profile, ICSharpFile file, IRangeMarker range, ICSharpCodeFormatter formatter)
          {
               IList<IDocCommentBlockNode> comments = GetSelectedDocComments(file, range);

               if (!comments.Any())
               {
                    return;
               }

               foreach (IDocCommentBlockNode comment in comments.Where(node => node.IsValid()))
               {
                    
               }
          }

          private static IList<IDocCommentBlockNode> GetSelectedDocComments(ITreeNode file, IRangeMarker range)
          {
               return new RecursiveElementCollector<IDocCommentBlockNode>(range == null || !range.IsValid ? JetFunc<IDocCommentBlockNode>.True : (node => range.DocumentRange.Contains(node.GetDocumentRange()))).ProcessElement(file).GetResults();
          }
     }
}


What do I need to do to make it work during Cleanup Code ?

3 comments
Comment actions Permalink

Hello,

Can anyone please tell me what I'm doing wrong or what might be the problem ?

0
Comment actions Permalink

I'm not sure why but changing the project from .NET 3.5 to 4.0 worked! the debugger steps in. :)

0
Comment actions Permalink

Hi there! This is a known bug that we are currently working on fixing.

0

Please sign in to leave a comment.