Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs')
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs53
1 files changed, 33 insertions, 20 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
index 41fd96c87d..8f73a75308 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
@@ -29,17 +29,22 @@
using System;
using System.Collections.Generic;
-using Mono.TextEditor;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Debugger;
using MonoDevelop.Components;
using Mono.Debugging.Client;
-using TextEditor = Mono.TextEditor.TextEditor;
+
+using ICSharpCode.NRefactory.TypeSystem;
+using ICSharpCode.NRefactory.Semantics;
+using ICSharpCode.NRefactory.CSharp;
+using ICSharpCode.NRefactory.CSharp.TypeSystem;
+using ICSharpCode.NRefactory.CSharp.Resolver;
+using MonoDevelop.Ide.Editor;
namespace MonoDevelop.SourceEditor
{
- public class DebugValueTooltipProvider: TooltipProvider, IDisposable
+ class DebugValueTooltipProvider: TooltipProvider, IDisposable
{
Dictionary<string,ObjectValue> cachedValues = new Dictionary<string,ObjectValue> ();
DebugValueWindow tooltip;
@@ -74,9 +79,10 @@ namespace MonoDevelop.SourceEditor
#region ITooltipProvider implementation
- public override TooltipItem GetItem (TextEditor editor, int offset)
+
+ public override TooltipItem GetItem (TextEditor editor, DocumentContext ctx, int offset)
{
- if (offset >= editor.Document.TextLength)
+ if (offset >= editor.Length)
return null;
if (!DebuggingService.IsDebugging || DebuggingService.IsRunning)
@@ -86,7 +92,9 @@ namespace MonoDevelop.SourceEditor
if (frame == null)
return null;
- var ed = (ExtensibleTextEditor) editor;
+ var ed = CompileErrorTooltipProvider.GetExtensibleTextEditor (editor);
+ if (ed == null)
+ return null;
string expression = null;
int startOffset;
@@ -94,20 +102,22 @@ namespace MonoDevelop.SourceEditor
startOffset = ed.SelectionRange.Offset;
expression = ed.SelectedText;
} else {
- var doc = IdeApp.Workbench.ActiveDocument;
+ var doc = ctx;
if (doc == null || doc.ParsedDocument == null)
return null;
var resolver = doc.GetContent<IDebuggerExpressionResolver> ();
- var data = editor.GetTextEditorData ();
+ var data = doc.GetContent<SourceEditorView> ();
if (resolver != null) {
- expression = resolver.ResolveExpression (data, doc, offset, out startOffset);
+ var result = resolver.ResolveExpressionAsync (editor, doc, offset, default(System.Threading.CancellationToken)).Result;
+ expression = result.Text;
+ startOffset = result.Span.Start;
} else {
- int endOffset = data.FindCurrentWordEnd (offset);
- startOffset = data.FindCurrentWordStart (offset);
+ int endOffset = data.GetTextEditorData ().FindCurrentWordEnd (offset);
+ startOffset = data.GetTextEditorData ().FindCurrentWordStart (offset);
- expression = data.GetTextAt (startOffset, endOffset - startOffset);
+ expression = editor.GetTextAt (startOffset, endOffset - startOffset);
}
}
@@ -131,26 +141,29 @@ namespace MonoDevelop.SourceEditor
return new TooltipItem (val, startOffset, expression.Length);
}
-
- public override Gtk.Window ShowTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
+
+ public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
{
- var location = editor.OffsetToLocation (item.ItemSegment.Offset);
+ return new DebugValueWindow (editor, offset, DebuggingService.CurrentFrame, (ObjectValue) item.Item, null);
+ }
+
+ public override void ShowTooltipWindow (TextEditor editor, Control tipWindow, TooltipItem item, Gdk.ModifierType modifierState, int mouseX, int mouseY)
+ {
+ var location = editor.OffsetToLocation (item.Offset);
var point = editor.LocationToPoint (location);
int lineHeight = (int) editor.LineHeight;
- int y = point.Y;
+ int y = (int)point.Y;
// find the top of the line that the mouse is hovering over
while (y + lineHeight < mouseY)
y += lineHeight;
var caret = new Gdk.Rectangle (mouseX, y, 1, lineHeight);
- tooltip = new DebugValueWindow (editor, offset, DebuggingService.CurrentFrame, (ObjectValue) item.Item, null);
+ tooltip = (DebugValueWindow)tipWindow;
tooltip.ShowPopup (editor, caret, PopupPosition.TopLeft);
-
- return tooltip;
}
- public override bool IsInteractive (TextEditor editor, Gtk.Window tipWindow)
+ public override bool IsInteractive (TextEditor editor, Control tipWindow)
{
return DebuggingService.IsDebugging;
}