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:
authorVsevolod Kukol <sevoku@microsoft.com>2017-03-24 20:15:44 +0300
committerVsevolod Kukol <sevoku@microsoft.com>2017-03-24 21:30:01 +0300
commit9c6565cdbeb792b791748b42645ae1f47e467c73 (patch)
tree9bd08dd99cee04d743a6c13f96cf42dbdae6f56a /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor
parent7462d5bb8f640001bf0b9f8574ed7502b6039405 (diff)
parent4c5318b71fdaff36827e7ab0c9c33900149d5b2a (diff)
Merge remote-tracking branch 'origin/master' into native-popups
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Caret.cs83
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/CustomEditorOptions.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs29
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs22
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Selection.cs188
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs144
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextLinkModeOptions.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipWindowOptions.cs58
21 files changed, 542 insertions, 90 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs
index ebdda80162..ca8fba7763 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
+using System.Text;
using System.Collections.Generic;
using System.IO;
using System.Threading;
@@ -32,6 +33,7 @@ using MonoDevelop.Core;
using Gtk;
using MonoDevelop.Core.Text;
using System.Threading.Tasks;
+using System.Security.Cryptography;
namespace MonoDevelop.Ide.Editor
{
@@ -62,7 +64,17 @@ namespace MonoDevelop.Ide.Editor
{
if (fileName == null)
return null;
- return Path.Combine (autoSavePath, MonoDevelop.Ide.TypeSystem.PersistenceServiceFactory.GetMD5 (fileName) + ".sav");
+ return Path.Combine (autoSavePath, GetMD5 (fileName) + ".sav");
+ }
+
+ static MD5 md5 = MD5.Create ();
+ static string GetMD5 (string data)
+ {
+ var result = new StringBuilder();
+ foreach (var b in md5.ComputeHash (Encoding.ASCII.GetBytes (data))) {
+ result.Append(b.ToString("X2"));
+ }
+ return result.ToString();
}
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Caret.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Caret.cs
new file mode 100644
index 0000000000..db7e5009c5
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Caret.cs
@@ -0,0 +1,83 @@
+//
+// Caret.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2016 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;
+
+namespace MonoDevelop.Ide.Editor
+{
+ public abstract class Caret
+ {
+ public abstract DocumentLocation Location {
+ get;
+ set;
+ }
+
+ public virtual int Line {
+ get {
+ return Location.Line;
+ }
+ set {
+ Location = new DocumentLocation (value, Column);
+ }
+ }
+
+ public virtual int Column {
+ get {
+ return Location.Column;
+ }
+ set {
+ Location = new DocumentLocation (Line, value);
+ }
+ }
+
+ public abstract int Offset {
+ get;
+ set;
+ }
+
+ protected virtual void OnPositionChanged (CaretLocationEventArgs args)
+ {
+ if (PositionChanged != null)
+ PositionChanged (this, args);
+ }
+
+ public event EventHandler<CaretLocationEventArgs> PositionChanged;
+ }
+
+ public enum CaretChangeReason {
+ BufferChange,
+ Movement
+ }
+
+ public class CaretLocationEventArgs : DocumentLocationEventArgs
+ {
+ public CaretChangeReason CaretChangeReason { get; }
+
+ public CaretLocationEventArgs (DocumentLocation location, CaretChangeReason reason) : base (location)
+ {
+ CaretChangeReason = reason;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/CustomEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/CustomEditorOptions.cs
index 736f0f7810..415b7a3afd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/CustomEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/CustomEditorOptions.cs
@@ -115,7 +115,7 @@ namespace MonoDevelop.Ide.Editor
set;
}
- public string ColorScheme {
+ public string EditorTheme {
get;
set;
}
@@ -153,7 +153,7 @@ namespace MonoDevelop.Ide.Editor
public CustomEditorOptions ()
{
- this.ColorScheme = MonoDevelop.Ide.Editor.Highlighting.ColorScheme.DefaultColorStyle;
+ this.EditorTheme = MonoDevelop.Ide.Editor.Highlighting.EditorTheme.DefaultThemeName;
this.TabSize = this.IndentationSize = 4;
this.DefaultEolMarker = "\n";
}
@@ -179,7 +179,7 @@ namespace MonoDevelop.Ide.Editor
WrapLines = initializeFrom.WrapLines;
FontName = initializeFrom.FontName;
GutterFontName = initializeFrom.GutterFontName;
- ColorScheme = initializeFrom.ColorScheme;
+ EditorTheme = initializeFrom.EditorTheme;
DefaultEolMarker = initializeFrom.DefaultEolMarker;
GenerateFormattingUndoStep = initializeFrom.GenerateFormattingUndoStep;
EnableSelectionWrappingKeys = initializeFrom.EnableSelectionWrappingKeys;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
index deec2b802c..5f24903839 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
@@ -200,9 +200,9 @@ namespace MonoDevelop.Ide.Editor
}
}
- string ITextEditorOptions.ColorScheme {
+ string ITextEditorOptions.EditorTheme {
get {
- return DefaultSourceEditorOptions.Instance.ColorScheme;
+ return DefaultSourceEditorOptions.Instance.EditorTheme;
}
}
@@ -464,7 +464,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- bool tabsToSpaces = false;
+ bool tabsToSpaces = true;
public bool TabsToSpaces {
get {
return tabsToSpaces;
@@ -592,7 +592,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- int rulerColumn = 80;
+ int rulerColumn = 120;
public int RulerColumn {
get {
@@ -681,7 +681,7 @@ namespace MonoDevelop.Ide.Editor
}
ConfigurationProperty<string> colorScheme = IdeApp.Preferences.ColorScheme;
- public string ColorScheme {
+ public string EditorTheme {
get {
return colorScheme;
}
@@ -695,7 +695,7 @@ namespace MonoDevelop.Ide.Editor
OnChanged (EventArgs.Empty);
}
- ConfigurationProperty<bool> generateFormattingUndoStep = ConfigurationProperty.Create ("GenerateFormattingUndoStep", false);
+ ConfigurationProperty<bool> generateFormattingUndoStep = ConfigurationProperty.Create ("GenerateFormattingUndoStep", true);
public bool GenerateFormattingUndoStep {
get {
return generateFormattingUndoStep;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs
index 0cd3806f2c..d3208cdac0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs
@@ -86,7 +86,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// Returns the roslyn document for this document. This may return <c>null</c> if it's no compileable document.
- /// Even if it's a C# file.
+ /// Even if it's a C# file. Is always not <c>null</c> when the parser returns <c>true</c> on CanGenerateAnalysisDocument.
/// </summary>
public abstract Microsoft.CodeAnalysis.Document AnalysisDocument
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs
index 9e0cf1cdbf..f68cb7ddae 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs
@@ -233,5 +233,21 @@ namespace MonoDevelop.Ide.Editor
return base.ConvertTo(context, culture, value, destinationType);
}
}
+
+ public class DocumentLocationEventArgs : System.EventArgs
+ {
+ readonly DocumentLocation location;
+
+ public DocumentLocation Location {
+ get {
+ return location;
+ }
+ }
+
+ public DocumentLocationEventArgs (DocumentLocation location)
+ {
+ this.location = location;
+ }
+ }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs
index a72688c0e2..87082a2e55 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs
@@ -380,7 +380,7 @@ namespace MonoDevelop.Ide.Editor
public static void ExpandSelectionToLine (TextEditor textEditor)
{
- // from Mono.TextEditor.SelectionActions.ExpandSelectionToLine
+ // from MonoDevelop.Ide.Editor.SelectionActions.ExpandSelectionToLine
using (var undoGroup = textEditor.OpenUndoGroup ()) {
var curLineSegment = textEditor.GetLine (textEditor.CaretLine).SegmentIncludingDelimiter;
var range = textEditor.SelectionRange;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs
index 8bd9388f83..059599d9ed 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs
@@ -97,6 +97,10 @@ namespace MonoDevelop.Ide.Editor
/// </returns>
public static string GetIndentation (this IDocumentLine line, IReadonlyTextDocument doc)
{
+ if (line == null)
+ throw new ArgumentNullException (nameof (line));
+ if (doc == null)
+ throw new ArgumentNullException (nameof (doc));
var result = new StringBuilder ();
int offset = line.Offset;
int max = Math.Min (offset + line.LengthIncludingDelimiter, doc.Length);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs
index 17bc9f12ce..bcabd79f88 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs
@@ -91,7 +91,7 @@ namespace MonoDevelop.Ide.Editor
string GutterFontName { get; }
- string ColorScheme { get; }
+ string EditorTheme { get; }
string DefaultEolMarker { get; }
@@ -108,11 +108,11 @@ namespace MonoDevelop.Ide.Editor
public static class TextEditorOptionsExtension
{
- public static ColorScheme GetColorStyle (this ITextEditorOptions options)
+ public static EditorTheme GetEditorTheme (this ITextEditorOptions options)
{
if (options == null)
throw new ArgumentNullException ("options");
- return SyntaxModeService.GetColorStyle (options.ColorScheme);
+ return SyntaxHighlightingService.GetEditorTheme (options.EditorTheme);
}
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
index ff5526f4df..7dadb81a94 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextEditorImpl.cs
//
// Author:
@@ -32,6 +32,8 @@ using MonoDevelop.Ide.Editor.Highlighting;
using MonoDevelop.Components;
using Xwt;
using System.Collections.Immutable;
+using System.Threading;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Editor
{
@@ -56,14 +58,16 @@ namespace MonoDevelop.Ide.Editor
IReadonlyTextDocument Document { get; }
- DocumentLocation CaretLocation { get; set; }
-
SemanticHighlighting SemanticHighlighting { get; set; }
+ ISyntaxHighlighting SyntaxHighlighting { get; set; }
+
int CaretOffset { get; set; }
bool IsSomethingSelected { get; }
+ IEnumerable<Selection> Selections { get; }
+
SelectionMode SelectionMode { get; }
ISegment SelectionRange { get; set; }
@@ -168,16 +172,14 @@ namespace MonoDevelop.Ide.Editor
IEnumerable<IFoldSegment> GetFoldingsIn (int offset, int length);
- string GetMarkup (int offset, int length, MarkupOptions options);
+ string GetPangoMarkup (int offset, int length, bool fitIdeStyle = false);
- void SetIndentationTracker (IndentationTracker indentationTracker);
- void SetSelectionSurroundingProvider (SelectionSurroundingProvider surroundingProvider);
+ string GetMarkup (int offset, int length, MarkupOptions options);
+
+ IndentationTracker IndentationTracker { get; set; }
+ void SetSelectionSurroundingProvider (SelectionSurroundingProvider surroundingProvider);
void SetTextPasteHandler (TextPasteHandler textPasteHandler);
- event EventHandler<LineEventArgs> LineChanged;
- event EventHandler<LineEventArgs> LineInserted;
- event EventHandler<LineEventArgs> LineRemoved;
-
#region Internal use only API (do not mirror in TextEditor)
TextEditorExtension EditorExtension {
@@ -216,6 +218,7 @@ namespace MonoDevelop.Ide.Editor
void UpdateBraceMatchingResult (BraceMatchingResult? result);
IEnumerable<IDocumentLine> VisibleLines { get; }
+ IReadOnlyList<Caret> Carets { get; }
void GrabFocus ();
bool HasFocus { get; }
@@ -223,5 +226,9 @@ namespace MonoDevelop.Ide.Editor
event EventHandler<LineEventArgs> LineShown;
event EventHandler FocusLost;
+ void ShowTooltipWindow (Components.Window window, TooltipWindowOptions options);
+ Task<ScopeStack> GetScopeStackAsync (int offset, CancellationToken cancellationToken);
+
+ double GetLineHeight (int line);
+ }
}
-} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
index 741fabe3c2..66e8b84e4a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
@@ -250,14 +250,6 @@ namespace MonoDevelop.Ide.Editor.Projection
return projectedExtension.CanRunCompletionCommand ();
}
- public override Task<MonoDevelop.Ide.CodeCompletion.ICompletionDataList> CodeCompletionCommand (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext)
- {
- var projectedExtension = GetExtensionAt (completionContext.TriggerOffset);
- if (projectedExtension == null)
- return null;
- return projectedExtension.CodeCompletionCommand (ConvertContext (completionContext));
- }
-
public override bool CanRunParameterCompletionCommand ()
{
var projectedExtension = GetCurrentExtension ();
@@ -302,13 +294,13 @@ namespace MonoDevelop.Ide.Editor.Projection
return projectedExtension.GuessBestMethodOverload (provider, currentOverload, token);
}
- public override System.Threading.Tasks.Task<MonoDevelop.Ide.CodeCompletion.ICompletionDataList> HandleCodeCompletionAsync (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, char completionChar, System.Threading.CancellationToken token)
+ public override System.Threading.Tasks.Task<MonoDevelop.Ide.CodeCompletion.ICompletionDataList> HandleCodeCompletionAsync (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, CompletionTriggerInfo triggerInfo, System.Threading.CancellationToken token)
{
var projectedExtension = GetExtensionAt (completionContext.TriggerOffset);
if (projectedExtension == null)
return null;
- return projectedExtension.HandleCodeCompletionAsync (ConvertContext (completionContext), completionChar, token);
+ return projectedExtension.HandleCodeCompletionAsync (ConvertContext (completionContext), triggerInfo, token);
}
public override Task<ParameterHintingResult> HandleParameterCompletionAsync (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, char completionChar, System.Threading.CancellationToken token)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
index 8174b221ce..9ee715512b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
@@ -26,6 +26,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.Editor.Projection
@@ -44,10 +45,21 @@ namespace MonoDevelop.Ide.Editor.Projection
}
}
+ internal override CodeCompletion.ICompletionWidget CompletionWidget {
+ get {
+ return completionTextEditorExtension.CompletionWidget;
+ }
+ set {
+ completionTextEditorExtension.CompletionWidget = value;
+ completionTextEditorExtension.UnsubscribeCompletionContextChanged ();
+ }
+ }
+
public ProjectedFilterCompletionTextEditorExtension (CompletionTextEditorExtension completionTextEditorExtension, IReadOnlyList<Projection> projections)
{
this.completionTextEditorExtension = completionTextEditorExtension;
this.projections = projections;
+ completionTextEditorExtension.UnsubscribeCompletionContextChanged ();
}
internal protected override bool IsActiveExtension ()
@@ -129,9 +141,9 @@ namespace MonoDevelop.Ide.Editor.Projection
return completionTextEditorExtension.CanRunParameterCompletionCommand ();
}
- public override System.Threading.Tasks.Task<CodeCompletion.ICompletionDataList> HandleCodeCompletionAsync (CodeCompletion.CodeCompletionContext completionContext, char completionChar, System.Threading.CancellationToken token)
+ public override System.Threading.Tasks.Task<CodeCompletion.ICompletionDataList> HandleCodeCompletionAsync (CodeCompletion.CodeCompletionContext completionContext, CompletionTriggerInfo triggerInfo, System.Threading.CancellationToken token)
{
- return completionTextEditorExtension.HandleCodeCompletionAsync (completionContext, completionChar, token);
+ return completionTextEditorExtension.HandleCodeCompletionAsync (completionContext, triggerInfo, token);
}
public override System.Threading.Tasks.Task<CodeCompletion.ParameterHintingResult> HandleParameterCompletionAsync (CodeCompletion.CodeCompletionContext completionContext, char completionChar, System.Threading.CancellationToken token)
@@ -160,12 +172,6 @@ namespace MonoDevelop.Ide.Editor.Projection
return completionTextEditorExtension.ShowCodeTemplatesCommand (completionContext);
}
- public override Task<CodeCompletion.ICompletionDataList> CodeCompletionCommand (CodeCompletion.CodeCompletionContext completionContext)
- {
- if (!IsActiveExtension()) return null;
- return completionTextEditorExtension.CodeCompletionCommand (completionContext);
- }
-
public override Task<CodeCompletion.ParameterHintingResult> ParameterCompletionCommand (CodeCompletion.CodeCompletionContext completionContext)
{
if (!IsActiveExtension()) return null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
index 93da211780..20d6872813 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
@@ -90,7 +90,7 @@ namespace MonoDevelop.Ide.Editor.Projection
var originalEndOffset = seg.FromProjectedToOriginal (projectedEndOffset);
foreach (var cs in p.ProjectedEditor.SemanticHighlighting.GetColoredSegments (MonoDevelop.Core.Text.TextSegment.FromBounds (projectedStartOffset, projectedEndOffset))) {
- yield return new ColoredSegment (cs.Offset - projectedStartOffset + v, cs.Length, cs.ColorStyleKey);
+ yield return new ColoredSegment (cs.Offset - projectedStartOffset + v, cs.Length, cs.ScopeStack);
}
if (originalEndOffset < segment.EndOffset) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Selection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Selection.cs
new file mode 100644
index 0000000000..146b09e7ab
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Selection.cs
@@ -0,0 +1,188 @@
+//
+// Selection.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2016 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 MonoDevelop.Core.Text;
+
+namespace MonoDevelop.Ide.Editor
+{
+ public struct Selection : IEquatable<Selection>
+ {
+ public static readonly Selection Empty = new Selection (true);
+
+ public bool IsEmpty {
+ get {
+ return anchor.IsEmpty;
+ }
+ }
+
+ readonly DocumentLocation anchor;
+ public DocumentLocation Anchor {
+ get {
+ return anchor;
+ }
+ }
+
+ readonly DocumentLocation lead;
+ public DocumentLocation Lead {
+ get {
+ return lead;
+ }
+ }
+
+
+ public int MinLine {
+ get {
+ return System.Math.Min (Anchor.Line, Lead.Line);
+ }
+ }
+
+ public int MaxLine {
+ get {
+ return System.Math.Max (Anchor.Line, Lead.Line);
+ }
+ }
+
+ public DocumentLocation Start {
+ get {
+ return anchor < lead ? anchor : lead;
+ }
+ }
+
+ public DocumentLocation End {
+ get {
+ return anchor < lead ? lead : anchor;
+ }
+ }
+
+ readonly SelectionMode selectionMode;
+ public SelectionMode SelectionMode {
+ get {
+ return selectionMode;
+ }
+ }
+
+ public bool Contains (DocumentLocation loc)
+ {
+ return anchor <= loc && loc <= lead || lead < loc && loc < anchor;
+ }
+
+ public bool Contains (int line, int column)
+ {
+ return Contains (new DocumentLocation (line, column));
+ }
+
+ Selection (bool empty)
+ {
+ anchor = lead = DocumentLocation.Empty;
+ selectionMode = SelectionMode.Normal;
+ }
+
+ public Selection (int anchorLine, int anchorColumn, int leadLine, int leadColumn, SelectionMode mode = SelectionMode.Normal) : this (new DocumentLocation (anchorLine, anchorColumn), new DocumentLocation (leadLine, leadColumn), mode)
+ {
+ }
+
+ public Selection (DocumentLocation anchor, DocumentLocation lead, SelectionMode selectionMode = SelectionMode.Normal)
+ {
+ if (anchor.Line < DocumentLocation.MinLine || anchor.Column < DocumentLocation.MinColumn)
+ throw new ArgumentOutOfRangeException ("anchor", anchor + " is out of range.");
+ if (lead.Line < DocumentLocation.MinLine || lead.Column < DocumentLocation.MinColumn)
+ throw new ArgumentOutOfRangeException ("lead", lead + " is out of range.");
+ this.anchor = anchor;
+ this.lead = lead;
+ this.selectionMode = selectionMode;
+ }
+
+ public Selection WithLead (DocumentLocation newLead)
+ {
+ return new Selection (Anchor, newLead, SelectionMode);
+ }
+
+ public Selection WithAnchor (DocumentLocation newAnchor)
+ {
+ return new Selection (newAnchor, Lead, SelectionMode);
+ }
+
+ public Selection WithRange (DocumentLocation newAnchor, DocumentLocation newLead)
+ {
+ return new Selection (newAnchor, newLead, SelectionMode);
+ }
+
+ public Selection WithSelectionMode (SelectionMode newSelectionMode)
+ {
+ return new Selection (Anchor, Lead, newSelectionMode);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is Selection))
+ return false;
+ return Equals ((Selection)obj);
+ }
+
+ public bool Equals (Selection other)
+ {
+ return Anchor == other.Anchor && Lead == other.Lead && SelectionMode == other.SelectionMode;
+ }
+
+ public bool IsSelected (DocumentLocation loc)
+ {
+ return anchor <= loc && loc <= lead || lead <= loc && loc <= anchor;
+ }
+
+ public bool IsSelected (int line, int column)
+ {
+ return IsSelected (new DocumentLocation (line, column));
+ }
+
+ public bool IsSelected (DocumentLocation start, DocumentLocation end)
+ {
+ return IsSelected (start) && IsSelected (end);
+ }
+
+ public bool IsSelected (int startLine, int startColumn, int endLine, int endColumn)
+ {
+ return IsSelected (new DocumentLocation (startLine, startColumn), new DocumentLocation (endLine, endColumn));
+ }
+
+ public override int GetHashCode ()
+ {
+ unchecked {
+ return Anchor.GetHashCode () ^ Lead.GetHashCode ();
+ }
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("[Selection: Anchor={0}, Lead={1}, MinLine={2}, MaxLine={3}, SelectionMode={4}]", Anchor, Lead, MinLine, MaxLine, SelectionMode);
+ }
+
+ internal bool ContainsLine (int lineNr)
+ {
+ return anchor.Line <= lineNr && lineNr <= lead.Line || lead.Line <= lineNr && lineNr <= anchor.Line;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
index 1140d15980..c1dc85c09b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextEditor.cs
//
// Author:
@@ -43,6 +43,7 @@ using MonoDevelop.Ide.Editor.Projection;
using Xwt;
using System.Collections.Immutable;
using MonoDevelop.Components.Commands;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.Editor
{
@@ -50,6 +51,7 @@ namespace MonoDevelop.Ide.Editor
{
readonly ITextEditorImpl textEditorImpl;
IReadonlyTextDocument ReadOnlyTextDocument { get { return textEditorImpl.Document; } }
+
ITextDocument ReadWriteTextDocument { get { return (ITextDocument)textEditorImpl.Document; } }
public ITextSourceVersion Version {
@@ -102,6 +104,18 @@ namespace MonoDevelop.Ide.Editor
remove { textEditorImpl.VAdjustmentChanged -= value; }
}
+ public double GetLineHeight (int line)
+ {
+ return textEditorImpl.GetLineHeight (line);
+ }
+
+ public double GetLineHeight (IDocumentLine line)
+ {
+ if (line == null)
+ throw new ArgumentNullException (nameof (line));
+ return textEditorImpl.GetLineHeight (line.LineNumber);
+ }
+
internal event EventHandler HAdjustmentChanged {
add { textEditorImpl.HAdjustmentChanged += value; }
remove { textEditorImpl.HAdjustmentChanged -= value; }
@@ -158,53 +172,67 @@ namespace MonoDevelop.Ide.Editor
}
}
+ public SemanticHighlighting SemanticHighlighting {
+ get {
+ return textEditorImpl.SemanticHighlighting;
+ }
+ set {
+ textEditorImpl.SemanticHighlighting = value;
+ }
+ }
+
+ public IReadOnlyList<Caret> Carets {
+ get {
+ return textEditorImpl.Carets;
+ }
+ }
+
public DocumentLocation CaretLocation {
get {
- return textEditorImpl.CaretLocation;
+ return Carets [0].Location;
}
set {
Runtime.AssertMainThread ();
- textEditorImpl.CaretLocation = value;
+ Carets [0].Location = value;
}
}
- public SemanticHighlighting SemanticHighlighting {
+ public ISyntaxHighlighting SyntaxHighlighting {
get {
- return textEditorImpl.SemanticHighlighting;
+ return textEditorImpl.SyntaxHighlighting;
}
set {
- textEditorImpl.SemanticHighlighting = value;
+ textEditorImpl.SyntaxHighlighting = value;
}
}
public int CaretLine {
get {
- return CaretLocation.Line;
+ return Carets [0].Line;
}
set {
- CaretLocation = new DocumentLocation (value, CaretColumn);
+ Carets [0].Line = value;
}
}
public int CaretColumn {
get {
- return CaretLocation.Column;
+ return Carets [0].Column;
}
set {
- CaretLocation = new DocumentLocation (CaretLine, value);
+ Carets [0].Column = value;
}
}
public int CaretOffset {
get {
- return textEditorImpl.CaretOffset;
+ return Carets [0].Offset;
}
set {
Runtime.AssertMainThread ();
- textEditorImpl.CaretOffset = value;
+ Carets [0].Offset = value;
}
}
-
public bool IsReadOnly {
get {
return ReadOnlyTextDocument.IsReadOnly;
@@ -227,6 +255,12 @@ namespace MonoDevelop.Ide.Editor
}
}
+ public IEnumerable<Selection> Selections {
+ get {
+ return textEditorImpl.Selections;
+ }
+ }
+
public ISegment SelectionRange {
get {
return textEditorImpl.SelectionRange;
@@ -436,11 +470,11 @@ namespace MonoDevelop.Ide.Editor
public void SetCaretLocation (DocumentLocation location, bool usePulseAnimation = false, bool centerCaret = true)
{
Runtime.AssertMainThread ();
- CaretLocation = location;
+ Carets [0].Location = location;
if (centerCaret) {
- CenterTo (CaretLocation);
+ CenterTo (Carets [0].Location);
} else {
- ScrollTo (CaretLocation);
+ ScrollTo (Carets [0].Location);
}
if (usePulseAnimation)
StartCaretPulseAnimation ();
@@ -449,11 +483,11 @@ namespace MonoDevelop.Ide.Editor
public void SetCaretLocation (int line, int col, bool usePulseAnimation = false, bool centerCaret = true)
{
Runtime.AssertMainThread ();
- CaretLocation = new DocumentLocation (line, col);
+ Carets [0].Location = new DocumentLocation (line, col);
if (centerCaret) {
- CenterTo (CaretLocation);
+ CenterTo (Carets [0].Location);
} else {
- ScrollTo (CaretLocation);
+ ScrollTo (Carets [0].Location);
}
if (usePulseAnimation)
StartCaretPulseAnimation ();
@@ -521,18 +555,32 @@ namespace MonoDevelop.Ide.Editor
textEditorImpl.StartInsertionMode (insertionModeOptions);
}
+ TextLinkModeOptions textLinkModeOptions;
public void StartTextLinkMode (TextLinkModeOptions textLinkModeOptions)
{
if (textLinkModeOptions == null)
throw new ArgumentNullException (nameof (textLinkModeOptions));
Runtime.AssertMainThread ();
textEditorImpl.StartTextLinkMode (textLinkModeOptions);
+ this.textLinkModeOptions = textLinkModeOptions;
+ }
+
+ internal TextLinkPurpose TextLinkPurpose {
+ get {
+ if (EditMode != EditMode.TextLink || textLinkModeOptions == null)
+ return TextLinkPurpose.Unknown;
+ return textLinkModeOptions.TextLinkPurpose;
+ }
}
public void InsertAtCaret (string text)
{
Runtime.AssertMainThread ();
- InsertText (CaretOffset, text);
+ foreach (var caret in Carets.OrderBy (i => -i.Offset)) {
+ var caretOffset = caret.Offset;
+ InsertText (caretOffset, text);
+ caret.Offset = caretOffset + text.Length;
+ }
}
public DocumentLocation PointToLocation (double xp, double yp, bool endAtEol = false)
@@ -869,13 +917,6 @@ namespace MonoDevelop.Ide.Editor
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
- public void SetIndentationTracker (IndentationTracker indentationTracker)
- {
- Runtime.AssertMainThread ();
- textEditorImpl.SetIndentationTracker (indentationTracker);
- }
-
- [EditorBrowsable(EditorBrowsableState.Advanced)]
public void SetSelectionSurroundingProvider (SelectionSurroundingProvider surroundingProvider)
{
Runtime.AssertMainThread ();
@@ -1404,16 +1445,28 @@ namespace MonoDevelop.Ide.Editor
return;
if ((disabledFeatures & DisabledProjectionFeatures.Completion) != DisabledProjectionFeatures.Completion) {
- TextEditorExtension lastExtension = textEditorImpl.EditorExtension;
- while (lastExtension != null && lastExtension.Next != null) {
- var completionTextEditorExtension = lastExtension.Next as CompletionTextEditorExtension;
+ TextEditorExtension curExtension = textEditorImpl.EditorExtension;
+ TextEditorExtension lastExtension = null;
+ while (curExtension != null) {
+ var completionTextEditorExtension = curExtension as CompletionTextEditorExtension;
if (completionTextEditorExtension != null) {
var projectedFilterExtension = new ProjectedFilterCompletionTextEditorExtension (completionTextEditorExtension, projections) { Next = completionTextEditorExtension.Next };
+ var completionWidget = completionTextEditorExtension.CompletionWidget;
completionTextEditorExtension.Deinitialize ();
- lastExtension.Next = projectedFilterExtension;
+ projectedFilterExtension.Next = curExtension.Next;
+
+ if (lastExtension != null) {
+ lastExtension.Next = projectedFilterExtension;
+ } else {
+ textEditorImpl.EditorExtension = projectedFilterExtension;
+ curExtension = projectedFilterExtension;
+ }
projectedFilterExtension.Initialize (this, DocumentContext);
+ projectedFilterExtension.CompletionWidget = completionWidget;
+ break;
}
- lastExtension = lastExtension.Next;
+ lastExtension = curExtension;
+ curExtension = curExtension.Next;
}
@@ -1449,13 +1502,38 @@ namespace MonoDevelop.Ide.Editor
internal ITextEditorImpl Implementation { get { return this.textEditorImpl; } }
- public event EventHandler FocusLost { add { textEditorImpl.FocusLost += value; } remove { textEditorImpl.FocusLost -= value; } }
+ [EditorBrowsable(EditorBrowsableState.Advanced)]
+ public IndentationTracker IndentationTracker
+ {
+ get
+ {
+ Runtime.AssertMainThread();
+ return textEditorImpl.IndentationTracker;
+ }
+ set
+ {
+ Runtime.AssertMainThread();
+ textEditorImpl.IndentationTracker = value;
+ }
+ }
+
+ public event EventHandler FocusLost { add { textEditorImpl.FocusLost += value; } remove { textEditorImpl.FocusLost -= value; } }
public new void GrabFocus ()
{
this.textEditorImpl.GrabFocus ();
}
+ public void ShowTooltipWindow (Components.Window window, TooltipWindowOptions options = null)
+ {
+ textEditorImpl.ShowTooltipWindow (window, options);
+ }
+
+ public Task<ScopeStack> GetScopeStackAsync (int offset, CancellationToken cancellationToken)
+ {
+ return textEditorImpl.GetScopeStackAsync (offset, cancellationToken);
+ }
+
public new bool HasFocus {
get { return this.textEditorImpl.HasFocus; }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs
index 5c626bbdab..15d839752b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs
@@ -39,7 +39,7 @@ namespace MonoDevelop.Ide.Editor
public static FilePath SyntaxModePath {
get {
- return UserProfile.Current.UserDataRoot.Combine ("HighlightingSchemes");
+ return UserProfile.Current.UserDataRoot.Combine ("ColorThemes");
}
}
@@ -73,7 +73,7 @@ namespace MonoDevelop.Ide.Editor
}
}
if (success)
- SyntaxModeService.LoadStylesAndModes (SyntaxModePath);
+ SyntaxHighlightingService.LoadStylesAndModesInPath (SyntaxModePath);
}
public string Name {
@@ -96,6 +96,7 @@ namespace MonoDevelop.Ide.Editor
public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
{
var editor = TextEditorFactory.CreateNewEditor ();
+ editor.FileName = fileName;
editor.MimeType = mimeType;
editor.GetViewContent ().Project = ownerProject;
editor.GetViewContent ().ContentName = fileName;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
index 04c8a511d9..13b7d8c3f7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
@@ -111,14 +111,5 @@ namespace MonoDevelop.Ide.Editor
result.InitializeExtensionChain (ctx);
return result;
}
-
- public static string[] GetSyntaxProperties (string mimeType, string name)
- {
- if (mimeType == null)
- throw new System.ArgumentNullException ("mimeType");
- if (name == null)
- throw new System.ArgumentNullException ("name");
- return currentFactory.GetSyntaxProperties (mimeType, name);
- }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
index d1c25a63f0..2c8b188bba 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
@@ -77,6 +77,14 @@ namespace MonoDevelop.Ide.Editor
}
+ protected override void OnContentNameChanged ()
+ {
+ base.OnContentNameChanged ();
+ textEditorImpl.ContentName = this.ContentName;
+ if (this.WorkbenchWindow?.Document != null)
+ textEditor.InitializeExtensionChain (this.WorkbenchWindow.Document);
+ }
+
void ViewContent_ContentNameChanged (object sender, EventArgs e)
{
this.ContentName = textEditorImpl.ViewContent.ContentName;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextLinkModeOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextLinkModeOptions.cs
index ef20516cf9..5be3ff5e64 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextLinkModeOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextLinkModeOptions.cs
@@ -28,6 +28,12 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor
{
+ public enum TextLinkPurpose
+ {
+ Unknown,
+ Rename
+ }
+
/// <summary>
/// This class contains information the editor needs to initiate the text link mode.
/// </summary>
@@ -50,6 +56,8 @@ namespace MonoDevelop.Ide.Editor
private set;
}
+ public TextLinkPurpose TextLinkPurpose { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="MonoDevelop.Ide.Editor.TextLinkModeOptions"/> class.
/// </summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
index 408d92a33e..9a132818aa 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
@@ -128,7 +128,7 @@ namespace MonoDevelop.Ide.Editor
(int)p1.X,
(int)p1.Y,
(int)w,
- (int)editor.LineHeight
+ (int)editor.GetLineHeight (startLoc.Line)
);
tipWindow.ShowPopup (editorWidget, caret, PopupPosition.Top);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipWindowOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipWindowOptions.cs
new file mode 100644
index 0000000000..b4ff9c4174
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipWindowOptions.cs
@@ -0,0 +1,58 @@
+//
+// TooltipWindowOptions.cs
+//
+// Author:
+// Mike Krüger <mikkrg@microsoft.com>
+//
+// Copyright (c) 2016 Microsoft Corporation
+//
+// 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 MonoDevelop.Core.Text;
+using System.Collections.Generic;
+using System.Text;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Editor.Extension;
+using System.IO;
+using MonoDevelop.Ide.Editor.Highlighting;
+using Mono.Addins;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Extensions;
+using System.Linq;
+using MonoDevelop.Components;
+using System.ComponentModel;
+using MonoDevelop.Ide.TypeSystem;
+using System.Threading;
+using MonoDevelop.Ide.Editor.Projection;
+using Xwt;
+using System.Collections.Immutable;
+using MonoDevelop.Components.Commands;
+
+namespace MonoDevelop.Ide.Editor
+{
+ public class TooltipWindowOptions
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether this tooltip should close automatically on mouse hover.
+ /// </summary>
+ /// <value><c>true</c> if auto close; otherwise, <c>false</c>.</value>
+ public bool AutoClose { get; set; } = true;
+ }
+} \ No newline at end of file