[PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk
Beren Minor via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 14 07:39:30 PST 2015
berenm added inline comments.
================
Comment at: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs:195
@@ -179,1 +194,3 @@
+ runningDocumentTable = new RunningDocumentTable(this);
+ adviseCookie = runningDocumentTable.Advise(this);
----------------
In this blog post, they go through another interface to modify the file contents.
I wanted to re-use the FormatTextBuffer method, that was operating on an ITextBuffer, and getting this ITextBuffer from a IDontKnowWhatDocument requires to go through this ComponentModel thing.
I did some small changes and some new quick testing and I think everything now works on VS2012 and later. I haven't tested the plugin on VS2010 though.
================
Comment at: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs:441
@@ +440,3 @@
+ var documentInfo = runningDocumentTable.GetDocumentInfo(docCookie);
+ if (documentInfo.DocData == null)
+ return VSConstants.S_OK;
----------------
Sorry I dropped this part :'(
http://reviews.llvm.org/D12407
More information about the cfe-commits
mailing list