Re-Sharper - Document Saved Event For Inactive File.

Hello,

 

I’ve set up my own source control plug-in for Visual Studio.

It’s registered with visual studio and can be selected from the list of Source Control plug-ins.

 

I can't get a handle on an event when ReSharper saves documents when they are not active. 

 

I’ve got no issues with files that are modified from with in Visual Studio as I’m suing:

IVsRunningDocTableEvents3

 

If the file isn’t loaded as an active document in Visual Studio, I’m having problems detecting that it is about to be edited so I can check it out of Source Control.

I’ve tried using the ReSharper event – DocumentManagerOperations suggested here:

https://resharper-support.jetbrains.com/hc/en-us/community/posts/205991489-Document-Saved-Event

 

I’m having issues detecting if these types of files need checked out:

.DotSettings. – When saving the ReSharper options settings

.csproj – When adding Nuget Packages with ReSharper.

.cs when editing files that are not opened in VS with ReSharper, i.e. fix naming in project.

 

Is there an event that’s triggered when a file is edited but not loaded?

 

Thank you!

1 comment

I used the interface:
IVsQueryEditQuerySave2

More information here:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsqueryeditquerysave2?view=visualstudiosdk-2017

And made use of:

public int QueryEditFiles(uint rgfQueryEdit, int cFiles, string[] rgpszMkDocuments, uint[] rgrgf,
VSQEQS_FILE_ATTRIBUTE_DATA[] rgFileInfo, out uint pfEditVerdict, out uint prgfMoreInfo)

something like this:

if (rgfQueryEdit != (uint)tagVSQueryEditFlags.QEF_ReportOnly)
{
   if (rgpszMkDocuments != null)
   {
      foreach (var doc in rgpszMkDocuments)
      {
         //Do Something

Hope that helps you out.

0

Please sign in to leave a comment.