diff --git a/ICSharpCode.AvalonEdit/Editing/TextArea.cs b/ICSharpCode.AvalonEdit/Editing/TextArea.cs index 5ede9a16..52aab3ef 100644 --- a/ICSharpCode.AvalonEdit/Editing/TextArea.cs +++ b/ICSharpCode.AvalonEdit/Editing/TextArea.cs @@ -1085,6 +1085,15 @@ public bool OverstrikeMode { #endregion + #region AutomationPeer override for CodeCompletion + /// + /// Gets or sets AutomationPeer instance used by CodeCompletion. + /// CompletionWindow can use this property to inject AutomationPeer that reflects + /// the suggestion list and the value of the currently selected CompletionData item. + /// + public System.Windows.Automation.Peers.AutomationPeer CodeCompletionAutomationPeer { get; set; } + #endregion + /// protected override System.Windows.Automation.Peers.AutomationPeer OnCreateAutomationPeer() { diff --git a/ICSharpCode.AvalonEdit/Editing/TextRangeProvider.cs b/ICSharpCode.AvalonEdit/Editing/TextRangeProvider.cs index 96f01d7f..01327fe7 100644 --- a/ICSharpCode.AvalonEdit/Editing/TextRangeProvider.cs +++ b/ICSharpCode.AvalonEdit/Editing/TextRangeProvider.cs @@ -76,6 +76,11 @@ public ITextRangeProvider Clone() public bool Compare(ITextRangeProvider range) { TextRangeProvider other = (TextRangeProvider)range; + if (textArea.CodeCompletionAutomationPeer != null) { + Log("{0}.Compare({1}) [ActiveIntelliSenseAutomationPeer != null]= false", ID, other.ID); + return false; + } + bool result = doc == other.doc && segment.Offset == other.segment.Offset && segment.EndOffset == other.segment.EndOffset; @@ -194,6 +199,11 @@ public IRawElementProviderSimple GetEnclosingElement() public string GetText(int maxLength) { Log("{0}.GetText({1})", ID, maxLength); + if (textArea.CodeCompletionAutomationPeer != null) { + var result = textArea.CodeCompletionAutomationPeer.GetName(); + Log("{0}.GetText({1}) --> {2}", ID, maxLength, result); + return result; + } if (maxLength < 0) return doc.GetText(segment); else