I am writing an IDE plugin that tracks specific lines - consider it similar to the IDE's inbuilt bookmark functionality. When a user edits source code, the position of a specific line changes - what might have been line 100 becomes line 101 when Enter is pressed somewhere above it, for example. Users can also delete lines, select and delete multiple chunks at once, paste in large chunks of text, etc, all of which shifts code around.
I would like to track line insertions and deletions in order to know that "line 100" becomes, say, "line 101", then "line 102", and so forth. How is this possible?
The closest solution I have found so far is using INTAEditServicesNotifier.EditorViewModified
which would give access to the entire buffer each time a modification was made. The entire buffer could then be diff-ed with a stored copy of the previous buffer to see what changes there are, and to see how many newlines were added or removed and where.
This is an enormous amount of overhead per editor modification, and there must be better way.