diff options
Diffstat (limited to 'main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks')
6 files changed, 71 insertions, 258 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/IQuickTaskProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/IQuickTaskProvider.cs deleted file mode 100644 index 0350a92b3b..0000000000 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/IQuickTaskProvider.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// IQuickTaskProvider.cs -// -// Author: -// Mike Krüger <mkrueger@xamarin.com> -// -// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; - -namespace MonoDevelop.SourceEditor.QuickTasks -{ - public interface IQuickTaskProvider - { - IEnumerable<QuickTask> QuickTasks { - get; - } - - event EventHandler TasksUpdated; - } -} diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/IUsageProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/IUsageProvider.cs deleted file mode 100644 index b3d38082fd..0000000000 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/IUsageProvider.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// IUsageProvider.cs -// -// Author: -// Mike Krüger <mkrueger@xamarin.com> -// -// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using System.Collections.Generic; -using Mono.TextEditor; -using MonoDevelop.Ide.FindInFiles; - -namespace MonoDevelop.SourceEditor.QuickTasks -{ - - public struct Usage - { - public DocumentLocation Location; - public ReferenceUsageType UsageType; - - public Usage (DocumentLocation location, ReferenceUsageType usageType) - { - this.Location = location; - this.UsageType = usageType; - } - } - - public interface IUsageProvider - { - IEnumerable<Usage> Usages { - get; - } - - event EventHandler UsagesUpdated; - } -} diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTask.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTask.cs deleted file mode 100644 index 15bd3982ad..0000000000 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTask.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// QuickTask.cs -// -// Author: -// Mike Krüger <mkrueger@xamarin.com> -// -// Copyright (c) 2012 Xamarin Inc. (http://xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -using System; -using Gtk; -using Mono.TextEditor; -using System.Collections.Generic; -using Gdk; -using MonoDevelop.Core; -using MonoDevelop.Ide; -using MonoDevelop.Components.Commands; -using ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Refactoring; - -namespace MonoDevelop.SourceEditor.QuickTasks -{ - - public class QuickTask - { - Lazy<string> description; - public string Description { - get { - return description.Value; - } - } - - public TextLocation Location { - get; - private set; - } - - public Severity Severity { - get; - private set; - } - - public QuickTask (Func<string> descriptionFunc, TextLocation location, Severity severity) - { - this.description = new Lazy<string> (descriptionFunc); - this.Location = location; - this.Severity = severity; - } - - public QuickTask (string description, TextLocation location, Severity severity) - { - this.description = new Lazy<string> (() => description); - this.Location = location; - this.Severity = severity; - } - - public override string ToString () - { - return string.Format ("[QuickTask: Description={0}, Location={1}, Severity={2}]", Description, Location, Severity); - } - } - -} diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskMiniMapMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskMiniMapMode.cs index c089b13afe..1d851cee49 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskMiniMapMode.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskMiniMapMode.cs @@ -33,10 +33,11 @@ using MonoDevelop.Core; using MonoDevelop.Ide; using MonoDevelop.Components.Commands; using ICSharpCode.NRefactory; +using MonoDevelop.Components; namespace MonoDevelop.SourceEditor.QuickTasks { - public class QuickTaskMiniMapMode : HBox + class QuickTaskMiniMapMode : HBox { QuickTaskOverviewMode rightMap; @@ -49,7 +50,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks PackStart (rightMap, true, true, 0); } - public class Minimpap : QuickTaskOverviewMode + class Minimpap : QuickTaskOverviewMode { const double lineHeight = 2; diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs index c423ff5fae..e206c5c6c3 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs @@ -26,21 +26,21 @@ using System; using Gtk; -using Mono.TextEditor; using System.Collections.Generic; using Gdk; using MonoDevelop.Core; -using ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Refactoring; using MonoDevelop.Ide; using System.Linq; using MonoDevelop.Components; using Mono.TextEditor.Theatrics; +using MonoDevelop.Ide.Editor; using Xwt.Drawing; +using MonoDevelop.Ide.Editor.Extension; +using Microsoft.CodeAnalysis; namespace MonoDevelop.SourceEditor.QuickTasks { - public class QuickTaskOverviewMode : DrawingArea + class QuickTaskOverviewMode : DrawingArea { static Xwt.Drawing.Image searchImage = Xwt.Drawing.Image.FromResource ("issues-busy-16.png"); static Xwt.Drawing.Image okImage = Xwt.Drawing.Image.FromResource ("issues-ok-16.png"); @@ -78,14 +78,14 @@ namespace MonoDevelop.SourceEditor.QuickTasks static readonly Cairo.Color win81SliderPrelight = new Cairo.Color (166/255d, 166/255d, 166/255d); static readonly Cairo.Color win81SliderActive = new Cairo.Color (96/255d, 96/255d, 96/255d); - readonly int barPadding = Platform.IsWindows? 1 : 3; + readonly int barPadding = MonoDevelop.Core.Platform.IsWindows? 1 : 3; readonly QuickTaskStrip parentStrip; protected readonly Adjustment vadjustment; int caretLine = -1; - public TextEditor TextEditor { + public Mono.TextEditor.MonoTextEditor TextEditor { get; private set; } @@ -141,7 +141,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks yPositionCache.Clear (); } - void HandleLineUpdateFrom (object sender, HeightTree.HeightChangedEventArgs e) + void HandleLineUpdateFrom (object sender, Mono.TextEditor.HeightTree.HeightChangedEventArgs e) { yPositionCache.Clear (); } @@ -191,7 +191,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks return y < IndicatorHeight; } - internal CodeSegmentPreviewWindow previewWindow; + internal Mono.TextEditor.CodeSegmentPreviewWindow previewWindow; protected override bool OnMotionNotifyEvent (EventMotion evnt) { @@ -217,7 +217,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks if (start == null || end == null) { return base.OnMotionNotifyEvent (evnt); } - var showSegment = new TextSegment (start.Offset, end.Offset + end.Length - start.Offset); + var showSegment = new Mono.TextEditor.TextSegment (start.Offset, end.Offset + end.Length - start.Offset); if (previewWindow != null) { previewWindow.SetSegment (showSegment, false); @@ -303,22 +303,22 @@ namespace MonoDevelop.SourceEditor.QuickTasks return false; } - void CountTasks (out int errors, out int warnings, out int hints, out int suggestions) + void CountTasks (out int errors, out int warnings, out int infos, out int hidden) { - errors = warnings = hints = suggestions = 0; + errors = warnings = infos = hidden = 0; foreach (var task in AllTasks) { switch (task.Severity) { - case Severity.Error: + case DiagnosticSeverity.Error: errors++; break; - case Severity.Warning: + case DiagnosticSeverity.Warning: warnings++; break; - case Severity.Hint: - hints++; + case DiagnosticSeverity.Info: + infos++; break; - case Severity.Suggestion: - suggestions++; + case DiagnosticSeverity.Hidden: + hidden++; break; } } @@ -328,7 +328,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks { QuickTask hoverTask = null; foreach (var task in AllTasks) { - double ty = GetYPosition (task.Location.Line); + double ty = GetYPosition (TextEditor.OffsetToLineNumber (task.Location)); if (Math.Abs (ty - y) < 3) { hoverTask = task; } @@ -347,10 +347,10 @@ namespace MonoDevelop.SourceEditor.QuickTasks class PreviewPopup { QuickTaskOverviewMode strip; - TextSegment segment; + Mono.TextEditor.TextSegment segment; int w, y; - public PreviewPopup (QuickTaskOverviewMode strip, TextSegment segment, int w, int y) + public PreviewPopup (QuickTaskOverviewMode strip, Mono.TextEditor.TextSegment segment, int w, int y) { this.strip = strip; this.segment = segment; @@ -360,7 +360,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks public bool Run () { - strip.previewWindow = new CodeSegmentPreviewWindow (strip.TextEditor, true, segment, w, -1, false); + strip.previewWindow = new Mono.TextEditor.CodeSegmentPreviewWindow (strip.TextEditor, true, segment, w, -1, false); strip.previewWindow.WidthRequest = w; strip.previewWindow.Show (); strip.PositionPreviewWindow (y); @@ -459,21 +459,19 @@ namespace MonoDevelop.SourceEditor.QuickTasks return base.OnLeaveNotifyEvent (evnt); } - Cairo.Color GetBarColor (Severity severity) + Cairo.Color GetBarColor (DiagnosticSeverity severity) { var style = this.TextEditor.ColorStyle; if (style == null) return new Cairo.Color (0, 0, 0); switch (severity) { - case Severity.Error: + case DiagnosticSeverity.Error: return style.UnderlineError.Color; - case Severity.Warning: + case DiagnosticSeverity.Warning: return style.UnderlineWarning.Color; - case Severity.Suggestion: + case DiagnosticSeverity.Info: return style.UnderlineSuggestion.Color; - case Severity.Hint: - return style.UnderlineHint.Color; - case Severity.None: + case DiagnosticSeverity.Hidden: return style.PlainText.Background; default: throw new ArgumentOutOfRangeException (); @@ -482,7 +480,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks protected virtual double IndicatorHeight { get { - return Platform.IsWindows ? Allocation.Width : 3 + 8 + 3; + return MonoDevelop.Core.Platform.IsWindows ? Allocation.Width : 3 + 8 + 3; } } @@ -551,14 +549,11 @@ namespace MonoDevelop.SourceEditor.QuickTasks void MoveToTask (QuickTask task) { - if (task.Location.IsEmpty) { - Console.WriteLine ("empty:" + task.Description); - } - var loc = new DocumentLocation ( - Math.Max (DocumentLocation.MinLine, task.Location.Line), - Math.Max (DocumentLocation.MinColumn, task.Location.Column) - ); - TextEditor.Caret.Location = loc; +// var loc = new DocumentLocation ( +// Math.Max (DocumentLocation.MinLine, task.Location.Line), +// Math.Max (DocumentLocation.MinColumn, task.Location.Column) +// ); + TextEditor.Caret.Offset = task.Location; TextEditor.CenterToCaret (); TextEditor.StartCaretPulseAnimation (); TextEditor.GrabFocus (); @@ -575,18 +570,17 @@ namespace MonoDevelop.SourceEditor.QuickTasks return QuickTaskStrip.HoverMode.NextMessage; } - protected void DrawIndicator (Cairo.Context cr, Severity severity) + protected void DrawIndicator (Cairo.Context cr, DiagnosticSeverity severity) { Xwt.Drawing.Image image; switch (severity) { - case Severity.Error: + case DiagnosticSeverity.Error: image = errorImage; break; - case Severity.Warning: + case DiagnosticSeverity.Warning: image = warningImage; break; - case Severity.Suggestion: - case Severity.Hint: + case DiagnosticSeverity.Info: image = suggestionImage; break; default: @@ -610,7 +604,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks protected override void OnSizeRequested (ref Requisition requisition) { base.OnSizeRequested (ref requisition); - requisition.Width = Platform.IsWindows? 17 : 15; + requisition.Width = MonoDevelop.Core.Platform.IsWindows? 17 : 15; } double LineToY (int logicalLine) @@ -653,16 +647,18 @@ namespace MonoDevelop.SourceEditor.QuickTasks return y; } - protected Severity DrawQuickTasks (Cairo.Context cr) + protected DiagnosticSeverity DrawQuickTasks (Cairo.Context cr) { - Severity severity = Severity.None; + DiagnosticSeverity severity = DiagnosticSeverity.Hidden; foreach (var usage in AllUsages) { - double y = GetYPosition (usage.Location.Line); + double y = GetYPosition (TextEditor.OffsetToLineNumber (usage.Offset)); var usageColor = TextEditor.ColorStyle.PlainText.Foreground; usageColor.A = 0.4; HslColor color; - if ((usage.UsageType & MonoDevelop.Ide.FindInFiles.ReferenceUsageType.Write) != 0) { + if ((usage.UsageType & MonoDevelop.Ide.FindInFiles.ReferenceUsageType.Declariton) != 0) { + color = TextEditor.ColorStyle.ChangingUsagesRectangle.Color; + } else if ((usage.UsageType & MonoDevelop.Ide.FindInFiles.ReferenceUsageType.Write) != 0) { color = TextEditor.ColorStyle.ChangingUsagesRectangle.Color; } else if ((usage.UsageType & MonoDevelop.Ide.FindInFiles.ReferenceUsageType.Read) != 0) { color = TextEditor.ColorStyle.UsagesRectangle.Color; @@ -680,21 +676,12 @@ namespace MonoDevelop.SourceEditor.QuickTasks } foreach (var task in AllTasks) { - double y = GetYPosition (task.Location.Line); + double y = GetYPosition (TextEditor.OffsetToLineNumber (task.Location)); cr.SetSourceColor (GetBarColor (task.Severity)); cr.Rectangle (0, Math.Round (y) - 1, Allocation.Width, 2); cr.Fill (); - - switch (task.Severity) { - case Severity.Error: - severity = Severity.Error; - break; - case Severity.Warning: - if (severity == Severity.None) - severity = Severity.Warning; - break; - } + severity = task.Severity; } return severity; } @@ -705,7 +692,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks cr.LineTo (0.5, Allocation.Height); if (TextEditor.ColorStyle != null) { var col = TextEditor.ColorStyle.PlainText.Background.ToXwtColor (); - if (!Platform.IsWindows) { + if (!MonoDevelop.Core.Platform.IsWindows) { col.Light *= 0.88; } cr.SetSourceColor (col.ToCairoColor ()); @@ -723,11 +710,11 @@ namespace MonoDevelop.SourceEditor.QuickTasks { var alloc = Allocation; - x = Platform.IsWindows ? 0 : 1 + barPadding; + x = MonoDevelop.Core.Platform.IsWindows ? 0 : 1 + barPadding; var adjUpper = vadjustment.Upper; var allocH = alloc.Height - (int) IndicatorHeight; y = IndicatorHeight + Math.Round (allocH * vadjustment.Value / adjUpper); - w = Platform.IsWindows ? alloc.Width : 8; + w = MonoDevelop.Core.Platform.IsWindows ? alloc.Width : 8; const int minBarHeight = 16; h = Math.Max (minBarHeight, Math.Round (allocH * (vadjustment.PageSize / adjUpper)) - barPadding - barPadding); } @@ -744,7 +731,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks double x, y, w, h; GetBarDimensions (out x, out y, out w, out h); - if (Platform.IsWindows) { + if (MonoDevelop.Core.Platform.IsWindows) { cr.Rectangle (x, y, w, h); } else { MonoDevelop.Components.CairoExtensions.RoundedRectangle (cr, x, y, w, h, 4); @@ -753,7 +740,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks bool prelight = State == StateType.Prelight; Cairo.Color c; - if (Platform.IsWindows) { + if (MonoDevelop.Core.Platform.IsWindows) { c = prelight ? win81SliderPrelight : win81Slider; //compute new color such that it will produce same color when blended with bg c = AddAlpha (win81Background, c, 0.5d); @@ -803,7 +790,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks cr.Rectangle (0, 0, Allocation.Width, Allocation.Height); if (TextEditor.ColorStyle != null) { - if (Platform.IsWindows) { + if (MonoDevelop.Core.Platform.IsWindows) { using (var pattern = new Cairo.SolidPattern (win81Background)) { cr.SetSource (pattern); } diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs index 052f69f046..9c5dfec002 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs @@ -35,14 +35,17 @@ using MonoDevelop.Components.Commands; using ICSharpCode.NRefactory; using System.Linq; using ICSharpCode.NRefactory.Refactoring; +using MonoDevelop.Ide.Editor; +using MonoDevelop.Ide.Editor.Extension; +using Microsoft.CodeAnalysis; namespace MonoDevelop.SourceEditor.QuickTasks { - public class QuickTaskStrip : VBox + class QuickTaskStrip : VBox { // move that one to AnalysisOptions when the new features are enabled by default. - public readonly static PropertyWrapper<bool> EnableFancyFeatures = new PropertyWrapper<bool> ("MonoDevelop.AnalysisCore.AnalysisEnabled", false); - public readonly static bool MergeScrollBarAndQuickTasks = !Platform.IsMac; + public readonly static PropertyWrapper<bool> EnableFancyFeatures = new PropertyWrapper<bool> ("MonoDevelop.AnalysisCore.AnalysisEnabled", true); + public readonly static bool MergeScrollBarAndQuickTasks = !MonoDevelop.Core.Platform.IsMac; static QuickTaskStrip () { @@ -61,8 +64,8 @@ namespace MonoDevelop.SourceEditor.QuickTasks } } - Mono.TextEditor.TextEditor textEditor; - public TextEditor TextEditor { + Mono.TextEditor.MonoTextEditor textEditor; + public Mono.TextEditor.MonoTextEditor TextEditor { get { return textEditor; } @@ -87,7 +90,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks } Dictionary<IQuickTaskProvider, List<QuickTask>> providerTasks = new Dictionary<IQuickTaskProvider, List<QuickTask>> (); - Dictionary<IUsageProvider, List<Usage>> providerUsages = new Dictionary<IUsageProvider, List<Usage>> (); + Dictionary<UsageProviderEditorExtension, List<Usage>> providerUsages = new Dictionary<UsageProviderEditorExtension, List<Usage>> (); public IEnumerable<QuickTask> AllTasks { get { @@ -176,7 +179,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks OnTaskProviderUpdated (EventArgs.Empty); } - public void Update (IUsageProvider provider) + public void Update (UsageProviderEditorExtension provider) { if (providerTasks == null) return; @@ -255,13 +258,13 @@ namespace MonoDevelop.SourceEditor.QuickTasks internal enum HoverMode { NextMessage, NextWarning, NextError } internal QuickTask SearchNextTask (HoverMode mode) { - var curLoc = (TextLocation)TextEditor.Caret.Location; + var curLoc = TextEditor.Caret.Offset; QuickTask firstTask = null; foreach (var task in AllTasks.OrderBy (t => t.Location) ) { bool isNextTask = task.Location > curLoc; if (mode == HoverMode.NextMessage || - mode == HoverMode.NextWarning && task.Severity == Severity.Warning || - mode == HoverMode.NextError && task.Severity == Severity.Error) { + mode == HoverMode.NextWarning && task.Severity == DiagnosticSeverity.Warning || + mode == HoverMode.NextError && task.Severity == DiagnosticSeverity.Error) { if (isNextTask) return task; if (firstTask == null) @@ -273,13 +276,13 @@ namespace MonoDevelop.SourceEditor.QuickTasks internal QuickTask SearchPrevTask (HoverMode mode) { - var curLoc = (TextLocation)TextEditor.Caret.Location; + var curLoc = TextEditor.Caret.Offset; QuickTask firstTask = null; foreach (var task in AllTasks.OrderByDescending (t => t.Location) ) { bool isNextTask = task.Location < curLoc; if (mode == HoverMode.NextMessage || - mode == HoverMode.NextWarning && task.Severity == Severity.Warning || - mode == HoverMode.NextError && task.Severity == Severity.Error) { + mode == HoverMode.NextWarning && task.Severity == DiagnosticSeverity.Warning || + mode == HoverMode.NextError && task.Severity == DiagnosticSeverity.Error) { if (isNextTask) return task; if (firstTask == null) @@ -293,10 +296,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks { if (quickTask == null) return; - var line = quickTask.Location.Line; - if (line < 1 || line >= TextEditor.LineCount) - return; - TextEditor.Caret.Location = new TextLocation (line, Math.Max (1, quickTask.Location.Column)); + TextEditor.Caret.Offset = quickTask.Location; TextEditor.CenterToCaret (); TextEditor.StartCaretPulseAnimation (); TextEditor.GrabFocus (); |