Esempio n. 1
0
 public SequencePointRemapper(List<SequencePoint> origSeqPoints, List<SequencePoint> newSeqPoints, BodyChangeHistory history)
 {
     originalSequencePoints = origSeqPoints;
     diffSequencePoints = new int[origSeqPoints.Count];
     newSequencePoints = newSeqPoints;
     if(history != null)
         findChanges(history);
 }
Esempio n. 2
0
        /// <summary>
        /// Build array with sequence points movement using <c>BodyChangeHistory</c> instance,
        /// which is storing informations collected from editor events.
        /// </summary>
        /// <param name="history"><c>BodyChangeHistory</c> instance storing informations collected from editor events.</param>
        private void findChanges(BodyChangeHistory history)
        {
            for (int i = 0; i < history.TextChanges.Count; i++) {
                if(history.TextChanges[i].Semicolon != null){
                    int oldStartOff = oldOffset(history.TextChanges[i].Offset,i,history.TextChanges);
                    int line,column;

                    history.Converter.GetPositionFromOffset(oldStartOff, out line, out column);
                    if(history.TextChanges[i].Removed){
                        diffSequencePoints[findSeqPoint((uint)line, (uint)column)] -= history.TextChanges[i].Semicolon.Length;
                    } else {
                        diffSequencePoints[findSeqPoint((uint)line, (uint)column)] += history.TextChanges[i].Semicolon.Length;
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Event callback for change in documents text.
        /// </summary>
        /// <param name="src">Document, that is being changed.</param>
        /// <param name="arg">Additional info about changes in text.</param>
        private void changingEvent(object src, TextChangeEventArgs arg)
        {
            IDocument doc = (IDocument)src;

            ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;

            changingFilename = provider.TextEditor.FileName;

            if (DebuggerService.IsDebuggerStarted)
            {
                if (arg.InsertedText.Length > 0 || arg.RemovedText.Length > 0)
                {
                    if (!actualEvent.touched.Exists(changingFilename.Equals))
                    {
                        actualEvent.touched.Add(changingFilename);
                    }
                    changeMade = true;
                    uint       token;
                    BodyChange change = findBodyChanges(arg, doc);
                    if (change != null && lastProjectContent.Exist(change.NewEntity))
                    {
                        if (!actualEvent.changes.Exists(delegate(SourceChange sChange) { return(bodyChangeEquals(sChange, change.NewEntity)); }))
                        {
                            actualEvent.changes.Add(change);
                        }
                    }
                    else
                    {
                        return;
                    }
                    if (getMethodToken(change, out token))
                    {
                        BodyChangeHistory hist;
                        if (!actualEvent.sourceTextChanges.TryGetValue(token, out hist))
                        {
                            hist = new BodyChangeHistory(LineOffsetConverter.BuildConverter(change.NewEntity.BodyRegion, doc));
                            actualEvent.sourceTextChanges.Add(token, hist);
                        }
                        int bOffset = doc.PositionToOffset(change.NewEntity.BodyRegion.BeginLine, 0);

                        SourceTextChange sTchange;
                        sTchange.Offset = arg.Offset - bOffset;

                        if (arg.InsertionLength > 0)
                        {
                            sTchange.Length    = arg.InsertionLength;
                            sTchange.Removed   = false;
                            sTchange.Semicolon = semicolonFind(arg.InsertedText);
                            hist.TextChanges.Add(sTchange);
                        }
                        if (arg.RemovalLength > 0)
                        {
                            sTchange.Length    = arg.RemovalLength;
                            sTchange.Removed   = true;
                            sTchange.Semicolon = semicolonFind(arg.RemovedText);
                            hist.TextChanges.Add(sTchange);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Event callback for change in documents text.
        /// </summary>
        /// <param name="src">Document, that is being changed.</param>
        /// <param name="arg">Additional info about changes in text.</param>
        private void changingEvent(object src, TextChangeEventArgs arg)
        {
            IDocument doc = (IDocument) src;

            ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
            changingFilename = provider.TextEditor.FileName;

            if(DebuggerService.IsDebuggerStarted){
                if(arg.InsertedText.Length > 0 || arg.RemovedText.Length > 0){
                    if(!actualEvent.touched.Exists(changingFilename.Equals)){
                        actualEvent.touched.Add(changingFilename);
                    }
                    changeMade = true;
                    uint token;
                    BodyChange change = findBodyChanges(arg,doc);
                    if (change != null && lastProjectContent.Exist(change.NewEntity)) {
                        if (!actualEvent.changes.Exists(delegate(SourceChange sChange) { return bodyChangeEquals(sChange, change.NewEntity); })) {
                            actualEvent.changes.Add(change);
                        }
                    } else {
                        return;
                    }
                    if (getMethodToken(change, out token)) {
                        BodyChangeHistory hist;
                        if (!actualEvent.sourceTextChanges.TryGetValue(token, out hist)) {
                            hist = new BodyChangeHistory(LineOffsetConverter.BuildConverter(change.NewEntity.BodyRegion, doc));
                            actualEvent.sourceTextChanges.Add(token, hist);
                        }
                        int bOffset = doc.PositionToOffset(change.NewEntity.BodyRegion.BeginLine, 0);

                        SourceTextChange sTchange;
                        sTchange.Offset = arg.Offset - bOffset;

                        if (arg.InsertionLength > 0) {
                            sTchange.Length = arg.InsertionLength;
                            sTchange.Removed = false;
                            sTchange.Semicolon = semicolonFind(arg.InsertedText);
                            hist.TextChanges.Add(sTchange);
                        }
                        if (arg.RemovalLength > 0) {
                            sTchange.Length = arg.RemovalLength;
                            sTchange.Removed = true;
                            sTchange.Semicolon = semicolonFind(arg.RemovedText);
                            hist.TextChanges.Add(sTchange);
                        }
                    }
                }
            }
        }