Browse Source

XamlBinding: preselection improvements

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4458 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
99a98a9ca9
  1. 2
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs
  2. 9
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs

2
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs

@ -80,7 +80,7 @@ namespace ICSharpCode.XamlBinding @@ -80,7 +80,7 @@ namespace ICSharpCode.XamlBinding
IDocumentLine line = editor.Document.GetLine(editor.Caret.Line);
int index = Math.Min(editor.Caret.Column - 1, line.Text.Length);
string text = line.Text.Substring(0, index);
int startIndex = text.LastIndexOfAny(' ', '\t', '"', '<', '\'', '>');
int startIndex = text.LastIndexOfAny(' ', '\t', '"', '<', '\'', '>', '{', '}');
if (startIndex > -1)
return text.Substring(startIndex + 1);

9
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs

@ -149,11 +149,9 @@ namespace ICSharpCode.XamlBinding @@ -149,11 +149,9 @@ namespace ICSharpCode.XamlBinding
// DO NOT USE CompletionDataHelper.CreateListForContext here!!! results in endless recursion!!!!
if (!string.IsNullOrEmpty(context.AttributeName)) {
if (!DoMarkupExtensionCompletion(context)) {
XamlResolver resolver = new XamlResolver();
var completionList = new XamlCompletionItemList();
var mrr = resolver.Resolve(new ExpressionResult(context.AttributeName, context),
context.ParseInformation, context.Editor.Document.Text) as MemberResolveResult;
var mrr = XamlResolver.Resolve(context.AttributeName, context) as MemberResolveResult;
if (mrr != null && mrr.ResolvedType != null) {
var c = mrr.ResolvedType.GetUnderlyingClass();
@ -164,6 +162,8 @@ namespace ICSharpCode.XamlBinding @@ -164,6 +162,8 @@ namespace ICSharpCode.XamlBinding
if (context.ActiveElement.Name == "Setter" || context.ActiveElement.Name == "EventSetter")
DoSetterAndEventSetterCompletion(context, completionList);
completionList.PreselectionLength = editor.GetWordBeforeCaretExtended().Length;
completionList.SortItems();
if (context.AttributeName.StartsWith("xmlns"))
@ -293,7 +293,8 @@ namespace ICSharpCode.XamlBinding @@ -293,7 +293,8 @@ namespace ICSharpCode.XamlBinding
if (context.Description == XamlContextDescription.InMarkupExtension && context.AttributeValue != null && !context.AttributeValue.IsString) {
if (!XamlBindingOptions.UseExtensionCompletion)
return false;
var completionList = CompletionDataHelper.CreateMarkupExtensionCompletion(context);
XamlCompletionItemList completionList = CompletionDataHelper.CreateMarkupExtensionCompletion(context) as XamlCompletionItemList;
completionList.PreselectionLength = context.Editor.GetWordBeforeCaretExtended().Length;
context.Editor.ShowCompletionWindow(completionList);
var insightList = CompletionDataHelper.CreateMarkupExtensionInsight(context);
context.Editor.ShowInsightWindow(insightList);

Loading…
Cancel
Save