Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly react on file change

I'm writing a Visual Studio editor plugin. I'd like the editor to behave similarly to other editors: if the edited file changes outside the IDE, I want the proper dialog window to be displayed and the document reloaded (if needed).

The IVsPersistDocData interface contains methods IsDocDataReloadable and ReloadDocData, but during debugging, they were never called in this scenario.

There is a combination of IVsFileChangeEx and IVsFileChangeEvents interfaces, but reaction to changing files outside the IDE seems to be so generic, that I guess I shouldn't need to manually monitor the edited file. Or should I?

like image 646
Spook Avatar asked Nov 10 '22 07:11

Spook


1 Answers

It seems, that there actually is no automatic mechanism for doing that and using IVsFileChangeEx and IVsFileChangeEvents seems to be the only solution.

http://blogs.msdn.com/b/dr._ex/archive/2005/11/01/487721.aspx

http://msdn.microsoft.com/en-us/library/Microsoft.VisualStudio.Shell.Interop.IVsFileChangeEx.aspx

like image 120
Spook Avatar answered Nov 14 '22 21:11

Spook