I am creating an extension in Visual Studio but there is an error using IElisionBuffer and IDifferenceBuffer. Below is my code
Public ViewportAdornment1 (for viewing IWpfTextView, IProjectionBufferFactoryService proxingbufferFactory, IDifferenceBufferFactoryService differenceBufferFactory) {_projectionBufferFactory = projectionBufferFactory _differenceBufferFactory = Difference BufferFactory; _view = view; Generalized snapshot span clonal span = new generalized snapshot transparency scan (_view.TextSnapshot, new span (5, 10)); _buffer = _projectBufferFactory.CreateElisionBuffer (empty, period, ElisionBufferOptions.FillInMappingMode); IPOsation snapshot snapshot = _buffer.ElideSpans (span); IDifferenceBuffer differenceBuffer = _differenceBufferFactory.CreateDifferenceBuffer (_view.VisualSnapshot.TextBuffer, snapshot.TextBuffer); Interbuffler Changed snapshot defaults + = applied snapshot directions; } Private Zero ApplySnapshotDifference (Object Sender, SnapshotDifferenceChangeEventArgs e) {ISnapshotDifference snapshotDifference = e.After.DifferenceBuffer.CurrentSnapshotDifference; Var diffs = snapshotDifference.LineDifferences; Edit ITextEdit = _buffer.CreateEdit (EditOptions.DefaultMinimalChange, blank, "myedit"); Forkaries (diff in different diff) {edit.Replace (diff.Left, diff.After.ToString ()); } Edit.Apply (); }
Below seems to create internal exceptions, but I do not know what's wrong.
IDifferenceBuffer differenceBuffer = _differenceBufferFactory.CreateDifferenceBuffer (_view.VisualSnapshot.TextBuffer, snapshot .TextBuffer); MSDN commented: "The differences on background threads are calculated in response to various changes (text changes, options change, etc.), although all of the events surrounding differencing, like SnapshotDifferenceChanged, the thread that has LeftBuffer and RightBuffer (usually , UI thread) is bossed on. " (I can not upload images) Error popup:
Type An exception to 'system.Reflection.TargetInvocationException' is an exception to mscor Lib.dll
Additional information came in: The exception is given by the goal of one.
PS My goal is creating an ornament box which is linked to some text, such as error popup (but instead of text). Is there any easier way to use IElisionBuffer?
No comments:
Post a Comment