How to detect unmerged document changes. #76236
-
We have refactorings that operate on multi-targeted projects. We'd like to detect if a series of syntax operations conducted on more than one TFM has produced unmerged document changes before calling Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Refactorings are given the entire solution snapshot to start with. And they produce the entire solution snapshot they end with. So you can just compare the start and end snapshot to get the changes. Then for any limited files see if the changes are not compatible and revert those from those documents. |
Beta Was this translation helpful? Give feedback.
-
Thanks @CyrusNajmabadi . I think the bit I'm not seeing is the last step whereby I check for compatibility of document changes. The Roslyn source I saw seemed to only manifest these overlapping edits by injecting comments, though I obviously could be overlooking something. Was hoping for some higher level API that lets me check for the compatibility of specific docs, or do I have to replicate the span-overlap-searching code in Roslyn? I've looping thru the diff's like so:
|
Beta Was this translation helpful? Give feedback.
I think you'll need to do that. When you have multiple related document changes, just get all the changes for each document in the related DOC group. Then see if any edit spans overlap but are not identical to what the other documents have.