diff options
author | David Karlaš <david.karlas@microsoft.com> | 2019-02-07 19:53:57 +0300 |
---|---|---|
committer | David Karlaš <david.karlas@microsoft.com> | 2019-02-07 19:56:09 +0300 |
commit | 36ba54790edf3ade785cb4f56585099759390917 (patch) | |
tree | dc0528da7ce0abce8b762f5f7ac19f9a67c9634c /main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView | |
parent | c89bb6699238dfa381ba367e3ccfc3c5c055f45c (diff) |
Fix 786940: [New Editor] [Debugger] Add right-click commands
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView')
-rw-r--r-- | main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs index 8c436b8e9e..cf2f98b0e0 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs @@ -1,11 +1,13 @@ -using System;
+using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Tagging;
using MonoDevelop.Debugger;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide;
-
+using Mono.Debugging.Client; +using MonoDevelop.Core; + namespace MonoDevelop.Debugger
{
internal class AbstractCurrentStatementTagger<T> : ITagger<T>, IDisposable @@ -22,7 +24,8 @@ namespace MonoDevelop.Debugger this.filePath = textBuffer.GetFilePathOrNull (); this.tag = tag; this.isGreen = isGreen;
- DebuggingService.CurrentFrameChanged += OnDebuggerCurrentStatementChanged; + DebuggingService.CurrentFrameChanged += OnDebuggerCurrentStatementChanged;
+ DebuggingService.ExecutionLocationChanged += OnDebuggerCurrentStatementChanged; } private void OnDebuggerCurrentStatementChanged (object sender, EventArgs eventArgs) @@ -38,27 +41,37 @@ namespace MonoDevelop.Debugger public IEnumerable<ITagSpan<T>> GetTags (NormalizedSnapshotSpanCollection spans)
{
- if (DebuggingService.CurrentCallStack == null)
+ if (!DebuggingService.IsPaused)
yield break;
if (isGreen) {
if (DebuggingService.CurrentFrameIndex > 0) {
- var newTag = CreateTag (DebuggingService.CurrentFrameIndex);
+ var newTag = CreateTag ();
if (newTag != null && spans.IntersectsWith (newTag.Span))
yield return newTag;
}
} else {
if (DebuggingService.CurrentFrameIndex == 0) {
- var newTag = CreateTag (0);
+ var newTag = CreateTag ();
if (newTag != null && spans.IntersectsWith (newTag.Span))
yield return newTag;
}
}
+ } + + SourceLocation CheckLocationIsInFile (SourceLocation location)
+ {
+ if (!string.IsNullOrEmpty (filePath) && location != null && !string.IsNullOrEmpty (location.FileName)
+ && ((FilePath)location.FileName).FullPath == ((FilePath)filePath).FullPath)
+ return location;
+ return null;
}
- private TagSpan<T> CreateTag (int stackIndex)
- {
- var sourceLocation = DebuggingService.CurrentCallStack.GetFrame (stackIndex).SourceLocation;
- if (sourceLocation.FileName != filePath)
+ private TagSpan<T> CreateTag ()
+ { + var sourceLocation = CheckLocationIsInFile (DebuggingService.NextStatementLocation)
+ ?? CheckLocationIsInFile (DebuggingService.CurrentFrame?.SourceLocation)
+ ?? CheckLocationIsInFile (DebuggingService.GetCurrentVisibleFrame ()?.SourceLocation);
+ if (sourceLocation == null)
return null;
var span = textBuffer.CurrentSnapshot.SpanFromMDColumnAndLine (sourceLocation.Line, sourceLocation.Column, sourceLocation.EndLine, sourceLocation.EndColumn);
return new TagSpan<T> (span, tag);
@@ -67,6 +80,7 @@ namespace MonoDevelop.Debugger public void Dispose ()
{
DebuggingService.CurrentFrameChanged -= OnDebuggerCurrentStatementChanged;
+ DebuggingService.ExecutionLocationChanged -= OnDebuggerCurrentStatementChanged;
} public event System.EventHandler<SnapshotSpanEventArgs> TagsChanged; |