c# - Prevent Syntax tree action from being performed on each file of opened solution -


i have code analyzer action registered syntax tree parsing:

public override void initialize(analysiscontext context) {     context.registersyntaxtreeaction(handlesyntaxtree); } 

problem when opening solution, performed each (*.cs) file of solution. since handlesyntaxtree() method calls command line process of git, large solution gets very slow.

is there way how have handlesyntaxtree() invoked file opened in editor?


edit: semi-pseudo-code of handlesyntaxtree() method

    private void handlesyntaxtree(syntaxtreeanalysiscontext context)     {         vart root = context.tree.getcompilationunitroot(context.cancellationtoken);         string filepath = context.tree.filepath;          getgitcurrentbranchname(filepath); //**** calls git ****          if (!availablehashbaseddescriptionofcurrentlyeditedfile)         {                             exportfilefromgitrepototemporarylocation(filepath); //**** calls git ****             createhashbaseddescriptionofcurrentlyeditedfile();         }          var declarationnodes = getspecifieddeclarationnodesfromsyntaxroot(root);          foreach (var node in declarationnodes )         {             if (!nodediffersfromgitrepo(node)) continue;             if (nodecontainsrequiredtagincomment(node)) continue;              findtokenandreportdiagnostics(context, node);         }     } 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -