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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -