|
|
@ -90,6 +90,12 @@ namespace ICSharpCode.XamlBinding |
|
|
|
if (Utils.IsInsideXmlComment(text, offset)) |
|
|
|
if (Utils.IsInsideXmlComment(text, offset)) |
|
|
|
description = XamlContextDescription.InComment; |
|
|
|
description = XamlContextDescription.InComment; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, string> xmlnsDefs = new Dictionary<string, string>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (XmlTextReader reader = CreateReaderAtTarget(editor.Document.Text, editor.Caret.Line, editor.Caret.Column)) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var context = new XamlContext() { |
|
|
|
var context = new XamlContext() { |
|
|
|
PressedKey = typedValue, |
|
|
|
PressedKey = typedValue, |
|
|
|
Description = description, |
|
|
|
Description = description, |
|
|
@ -98,7 +104,8 @@ namespace ICSharpCode.XamlBinding |
|
|
|
AttributeValue = value, |
|
|
|
AttributeValue = value, |
|
|
|
RawAttributeValue = attributeValue, |
|
|
|
RawAttributeValue = attributeValue, |
|
|
|
ValueStartOffset = offsetFromValueStart, |
|
|
|
ValueStartOffset = offsetFromValueStart, |
|
|
|
Path = (path == null || path.Elements.Count == 0) ? null : path |
|
|
|
Path = (path == null || path.Elements.Count == 0) ? null : path, |
|
|
|
|
|
|
|
XmlnsDefinitions = xmlnsDefs |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
LoggingService.Debug(context); |
|
|
|
LoggingService.Debug(context); |
|
|
@ -355,7 +362,7 @@ namespace ICSharpCode.XamlBinding |
|
|
|
{ |
|
|
|
{ |
|
|
|
var ctors = trr.ResolvedType.GetMethods().Where(m => m.IsConstructor && m.Parameters.Count >= markup.PositionalArguments.Count); |
|
|
|
var ctors = trr.ResolvedType.GetMethods().Where(m => m.IsConstructor && m.Parameters.Count >= markup.PositionalArguments.Count); |
|
|
|
if (ctors.Any(ctor => ctor.Parameters.Count >= markup.PositionalArguments.Count)) { |
|
|
|
if (ctors.Any(ctor => ctor.Parameters.Count >= markup.PositionalArguments.Count)) { |
|
|
|
list.Items.AddRange(trr.ResolvedType.GetProperties().Select(p => new XamlCodeCompletionItem(p, p.Name + "=")).Cast<ICompletionItem>()); |
|
|
|
list.Items.AddRange(trr.ResolvedType.GetProperties().Where(p => p.CanSet && p.IsPublic).Select(p => new XamlCodeCompletionItem(p, p.Name + "=")).Cast<ICompletionItem>()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -542,11 +549,10 @@ namespace ICSharpCode.XamlBinding |
|
|
|
|
|
|
|
|
|
|
|
public static MarkupExtensionInfo GetInnermostMarkup(MarkupExtensionInfo markup) |
|
|
|
public static MarkupExtensionInfo GetInnermostMarkup(MarkupExtensionInfo markup) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var lastPair = markup.NamedArguments.LastOrDefault(); |
|
|
|
|
|
|
|
var last = markup.PositionalArguments.LastOrDefault(); |
|
|
|
var last = markup.PositionalArguments.LastOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
if (markup.NamedArguments.Count > 0) |
|
|
|
if (markup.NamedArguments.Count > 0) |
|
|
|
last = lastPair.Value; |
|
|
|
last = markup.NamedArguments.LastOrDefault().Value; |
|
|
|
|
|
|
|
|
|
|
|
if (last != null) { |
|
|
|
if (last != null) { |
|
|
|
if (!last.IsString) { |
|
|
|
if (!last.IsString) { |
|
|
@ -557,7 +563,7 @@ namespace ICSharpCode.XamlBinding |
|
|
|
return markup; |
|
|
|
return markup; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static TypeResolveResult ResolveMarkupExtensionType(MarkupExtensionInfo markup, ParseInformation info, ITextEditor editor, XmlElementPath path) |
|
|
|
public static TypeResolveResult ResolveMarkupExtensionType(MarkupExtensionInfo markup, ParseInformation info, ITextEditor editor, XmlElementPath path) |
|
|
|
{ |
|
|
|
{ |
|
|
|
XamlResolver resolver = new XamlResolver(); |
|
|
|
XamlResolver resolver = new XamlResolver(); |
|
|
|
TypeResolveResult trr = resolver.Resolve(new ExpressionResult(markup.ExtensionType, new XamlExpressionContext(path, null, false)), info, editor.Document.Text) as TypeResolveResult; |
|
|
|
TypeResolveResult trr = resolver.Resolve(new ExpressionResult(markup.ExtensionType, new XamlExpressionContext(path, null, false)), info, editor.Document.Text) as TypeResolveResult; |
|
|
@ -566,6 +572,13 @@ namespace ICSharpCode.XamlBinding |
|
|
|
return trr; |
|
|
|
return trr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static TypeResolveResult ResolveType(string name, XamlContext context, ITextEditor editor) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return new XamlResolver() |
|
|
|
|
|
|
|
.Resolve(new ExpressionResult(name, new XamlExpressionContext(context.Path, null, false)), |
|
|
|
|
|
|
|
ParserService.GetParseInformation(editor.FileName), editor.Document.Text) as TypeResolveResult; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static IEnumerable<ICompletionItem> AddMatchingEventHandlers(ITextEditor editor, IMethod delegateInvoker) |
|
|
|
public static IEnumerable<ICompletionItem> AddMatchingEventHandlers(ITextEditor editor, IMethod delegateInvoker) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ParseInformation p = ParserService.GetParseInformation(editor.FileName); |
|
|
|
ParseInformation p = ParserService.GetParseInformation(editor.FileName); |
|
|
|