Browse Source

XamlBinding: fixed some FxCop warnings

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4519 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
0a3eb290fa
  1. 65
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs
  2. 70
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs
  3. 32
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/LookupInfo.cs
  4. 2
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/EditGridColumnsAndRowsCommand.cs
  5. 2
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/ExtractPropertiesAsStyleCommand.cs
  6. 2
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/GroupIntoRefactorings.cs
  7. 57
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/EditGridColumnsAndRowsDialog.xaml.cs
  8. 6
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/XamlMenuCommand.cs
  9. 8
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/QualifiedNameWithLocation.cs
  10. 26
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs
  11. 1
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.csproj
  12. 8
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs
  13. 8
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlColorizer.cs
  14. 2
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompilationUnit.cs
  15. 47
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItem.cs
  16. 5
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItemList.cs
  17. 6
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlContext.cs

65
src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs

@ -5,26 +5,21 @@ @@ -5,26 +5,21 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.AvalonEdit.Document;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Collections.ObjectModel;
using System.Linq;
using System.Xml;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.XmlEditor;
using LoggingService = ICSharpCode.Core.LoggingService;
namespace ICSharpCode.XamlBinding
{
public static class CompletionDataHelper
{
#region Pre-defined lists
static readonly List<ICompletionItem> standardElements = new List<ICompletionItem> {
new SpecialCompletionItem("!--"),
new SpecialCompletionItem("![CDATA["),
@ -43,16 +38,15 @@ namespace ICSharpCode.XamlBinding @@ -43,16 +38,15 @@ namespace ICSharpCode.XamlBinding
new SpecialCompletionItem("xmlns:")
};
public static readonly List<string> XamlNamespaceAttributes = new List<string> {
public static readonly ReadOnlyCollection<string> XamlNamespaceAttributes = new List<string> {
"Class", "ClassModifier", "FieldModifier", "Name", "Subclass", "TypeArguments", "Uid", "Key"
};
}.AsReadOnly(); // TODO : .AsReadOnly() cannot be resolved, report to Daniel
public static readonly List<string> RootOnlyElements = new List<string> {
public static readonly ReadOnlyCollection<string> RootOnlyElements = new List<string> {
"Class", "ClassModifier", "Subclass"
};
}.AsReadOnly();
static readonly List<ICompletionItem> emptyList = new List<ICompletionItem>();
#endregion
public const string XamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml";
public const string WpfXamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
@ -73,22 +67,16 @@ namespace ICSharpCode.XamlBinding @@ -73,22 +67,16 @@ namespace ICSharpCode.XamlBinding
AttributeValue value = MarkupExtensionParser.ParseValue(attributeValue);
XamlContextDescription description = XamlContextDescription.None;
Dictionary<string, string> xmlnsDefs;
List<string> ignoredXmlns;
QualifiedNameWithLocation active, parent;
int elementStartIndex;
bool isRoot;
Utils.LookUpInfoAtTarget(text, line, col, offset, out xmlnsDefs, out ignoredXmlns, out active, out parent, out elementStartIndex, out isRoot);
var lookUpInfo = Utils.LookupInfoAtTarget(text, line, col, offset);
string wordBeforeIndex = text.GetWordBeforeOffset(offset);
if (active != null && parent != active)
if (lookUpInfo.Active != null && lookUpInfo.Parent != lookUpInfo.Active)
description = XamlContextDescription.AtTag;
if (elementStartIndex > -1 &&
if (lookUpInfo.ActiveElementStartIndex > -1 &&
(char.IsWhiteSpace(text[offset]) || !string.IsNullOrEmpty(attribute) ||
Extensions.Is(text[offset], '"', '\'') || !wordBeforeIndex.StartsWith("<")))
Extensions.Is(text[offset], '"', '\'') || !wordBeforeIndex.StartsWith("<", StringComparison.OrdinalIgnoreCase)))
description = XamlContextDescription.InTag;
if (inAttributeValue) {
@ -115,22 +103,22 @@ namespace ICSharpCode.XamlBinding @@ -115,22 +103,22 @@ namespace ICSharpCode.XamlBinding
localName = attribute.Substring(prefixEnd + 1, attribute.Length - prefix.Length - 1);
}
xmlnsDefs.TryGetValue(prefix, out xmlNamespace);
lookUpInfo.XmlnsDefinitions.TryGetValue(prefix, out xmlNamespace);
var qAttribute = new QualifiedNameWithLocation(localName, xmlNamespace, prefix, -1, -1);
var context = new XamlContext() {
Description = description,
ActiveElement = active,
ParentElement = parent,
ActiveElement = lookUpInfo.Active,
ParentElement = lookUpInfo.Parent,
AttributeName = string.IsNullOrEmpty(attribute) ? null : qAttribute,
InRoot = isRoot,
InRoot = lookUpInfo.IsRoot,
AttributeValue = value,
RawAttributeValue = attributeValue,
ValueStartOffset = offsetFromValueStart,
XmlnsDefinitions = xmlnsDefs,
XmlnsDefinitions = lookUpInfo.XmlnsDefinitions,
ParseInformation = info,
IgnoredXmlns = ignoredXmlns
IgnoredXmlns = lookUpInfo.IgnoredXmlns.AsReadOnly()
};
return context;
@ -164,8 +152,8 @@ namespace ICSharpCode.XamlBinding @@ -164,8 +152,8 @@ namespace ICSharpCode.XamlBinding
if (xamlBuiltInTypes.Concat(XamlNamespaceAttributes).Select(s => xKey + s).Contains(lastElement.FullXmlName))
return emptyList;
if (lastElement.Name.EndsWith(".") || context.PressedKey == '.') {
if (context.ParentElement.Name.StartsWith(lastElement.Name.TrimEnd('.')))
if (lastElement.Name.EndsWith(".", StringComparison.OrdinalIgnoreCase) || context.PressedKey == '.') {
if (context.ParentElement.Name.StartsWith(lastElement.Name.TrimEnd('.'), StringComparison.OrdinalIgnoreCase))
AddAttributes(rt, list, includeEvents);
else if (rt != null && rt.GetUnderlyingClass() != null) {
string key = string.IsNullOrEmpty(lastElement.Prefix) ? "" : lastElement.Prefix + ":";
@ -308,7 +296,7 @@ namespace ICSharpCode.XamlBinding @@ -308,7 +296,7 @@ namespace ICSharpCode.XamlBinding
bool inContentRoot = false;
if (last != null && cu != null) {
if (!last.Name.Contains(".") || last.Name.EndsWith(".")) {
if (!last.Name.Contains(".") || last.Name.EndsWith(".", StringComparison.OrdinalIgnoreCase)) {
elementReturnType = rt = cu.CreateType(last.Namespace, last.Name.Trim('.'));
string contentPropertyName = GetContentPropertyName(rt);
if (!string.IsNullOrEmpty(contentPropertyName)) {
@ -434,7 +422,6 @@ namespace ICSharpCode.XamlBinding @@ -434,7 +422,6 @@ namespace ICSharpCode.XamlBinding
}
break;
case XamlContextDescription.InTag:
var existingAttribs = Utils.GetListOfExistingAttributeNames(editor.Document.Text, editor.Caret.Line, editor.Caret.Column);
string word = context.Editor.GetWordBeforeCaretExtended();
if (context.PressedKey == '.') {
@ -471,14 +458,14 @@ namespace ICSharpCode.XamlBinding @@ -471,14 +458,14 @@ namespace ICSharpCode.XamlBinding
{
if (context.ParentElement != null && !context.InRoot) {
ResolveResult rr = XamlResolver.Resolve(context.ParentElement.FullXmlName, context);
TypeResolveResult trr = rr as TypeResolveResult;
MemberResolveResult mrr = rr as MemberResolveResult;
if (rr is TypeResolveResult) {
TypeResolveResult trr = rr as TypeResolveResult;
if (trr != null) {
if (trr.ResolvedClass == null)
return;
list.Items.Add(new XamlCodeCompletionItem("/" + context.ParentElement.FullXmlName, trr.ResolvedClass));
} else if (rr is MemberResolveResult) {
MemberResolveResult mrr = rr as MemberResolveResult;
} else if (mrr != null) {
if (mrr.ResolvedMember == null)
return;
list.Items.Add(new XamlCodeCompletionItem("/" + context.ParentElement.FullXmlName, mrr.ResolvedMember));
@ -530,12 +517,12 @@ namespace ICSharpCode.XamlBinding @@ -530,12 +517,12 @@ namespace ICSharpCode.XamlBinding
static void DoNamedArgsCompletion(XamlCompletionItemList list, XamlCompletionContext context, IReturnType type, MarkupExtensionInfo markup)
{
if (markup.NamedArguments.Count > 0 && !context.Editor.GetWordBeforeCaret().StartsWith(",")) {
if (markup.NamedArguments.Count > 0 && !context.Editor.GetWordBeforeCaret().StartsWith(",", StringComparison.OrdinalIgnoreCase)) {
int lastStart = markup.NamedArguments.Max(i => i.Value.StartOffset);
var item = markup.NamedArguments.First(p => p.Value.StartOffset == lastStart);
if (context.RawAttributeValue.EndsWith("=") ||
(item.Value.IsString && item.Value.StringValue.EndsWith(context.Editor.GetWordBeforeCaretExtended()))) {
if (context.RawAttributeValue.EndsWith("=", StringComparison.OrdinalIgnoreCase) ||
(item.Value.IsString && item.Value.StringValue.EndsWith(context.Editor.GetWordBeforeCaretExtended(), StringComparison.Ordinal))) {
MemberResolveResult mrr = XamlResolver.ResolveMember(item.Key, context) as MemberResolveResult;
if (mrr != null && mrr.ResolvedMember != null && mrr.ResolvedMember.ReturnType != null) {
IReturnType memberType = mrr.ResolvedMember.ReturnType;

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

@ -33,7 +33,7 @@ namespace ICSharpCode.XamlBinding @@ -33,7 +33,7 @@ namespace ICSharpCode.XamlBinding
return element;
}
public static XElement MoveBefore(this XElement element, XElement target)
public static XElement MoveBefore(this XElement element, XNode target)
{
if (element == null)
throw new ArgumentNullException("element");
@ -47,7 +47,7 @@ namespace ICSharpCode.XamlBinding @@ -47,7 +47,7 @@ namespace ICSharpCode.XamlBinding
return element;
}
public static XElement MoveAfter(this XElement element, XElement target)
public static XElement MoveAfter(this XElement element, XNode target)
{
if (element == null)
throw new ArgumentNullException("element");
@ -61,10 +61,10 @@ namespace ICSharpCode.XamlBinding @@ -61,10 +61,10 @@ namespace ICSharpCode.XamlBinding
return element;
}
public static void AddRange(this UIElementCollection coll, IEnumerable<UIElement> items)
public static void AddRange(this UIElementCollection collection, IEnumerable<UIElement> items)
{
foreach (var item in items)
coll.Add(item);
collection.Add(item);
}
public static string[] Split(this string thisValue, StringSplitOptions options, params char[] delimiters)
@ -88,24 +88,24 @@ namespace ICSharpCode.XamlBinding @@ -88,24 +88,24 @@ namespace ICSharpCode.XamlBinding
return false;
}
public static string Replace(this string str, int index, int length, string text)
public static string Replace(this string thisValue, int index, int length, string text)
{
if (str == null)
throw new ArgumentNullException("str");
if (index < 0 || index > str.Length)
throw new ArgumentOutOfRangeException("index", index, "Value must be between 0 and " + str.Length);
if (length < 0 || length > str.Length)
throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + str.Length);
if ((index + length) > str.Length)
throw new ArgumentOutOfRangeException("index + length", index + length, "Value must be between 0 and " + str.Length);
if (thisValue == null)
throw new ArgumentNullException("thisValue");
if (index < 0 || index > thisValue.Length)
throw new ArgumentOutOfRangeException("index", index, "Value must be between 0 and " + thisValue.Length);
if (length < 0 || length > thisValue.Length)
throw new ArgumentOutOfRangeException("length", length, "Value must be between 0 and " + thisValue.Length);
if ((index + length) > thisValue.Length)
throw new ArgumentOutOfRangeException("index + length", index + length, "Value must be between 0 and " + thisValue.Length);
return str.Substring(0, index) + text + str.Substring(index + length);
return thisValue.Substring(0, index) + text + thisValue.Substring(index + length);
}
public static bool Is(char value, params char[] chars)
public static bool Is(char value, params char[] choice)
{
foreach (var c in chars) {
if (c == value)
foreach (var ch in choice) {
if (ch == value)
return true;
}
@ -175,9 +175,9 @@ namespace ICSharpCode.XamlBinding @@ -175,9 +175,9 @@ namespace ICSharpCode.XamlBinding
return text.Substring(startIndex, offset - startIndex + 1).Trim();
}
public static TKey GetKeyByValue<TKey, TValue>(this Dictionary<TKey, TValue> dict, TValue value)
public static TKey GetKeyByValue<TKey, TValue>(this Dictionary<TKey, TValue> thisValue, TValue value)
{
foreach (var pair in dict) {
foreach (var pair in thisValue) {
if (pair.Value.Equals(value))
return pair.Key;
}
@ -185,22 +185,22 @@ namespace ICSharpCode.XamlBinding @@ -185,22 +185,22 @@ namespace ICSharpCode.XamlBinding
return default(TKey);
}
public static int GetLineNumber(this XObject item)
public static int GetLineNumber(this IXmlLineInfo thisValue)
{
return (item as IXmlLineInfo).LineNumber;
return thisValue.LineNumber;
}
public static int GetLinePosition(this XObject item)
public static int GetLinePosition(this IXmlLineInfo thisValue)
{
return (item as IXmlLineInfo).LinePosition;
return thisValue.LinePosition;
}
public static bool IsInRange(this XObject item, Location begin, Location end)
public static bool IsInRange(this IXmlLineInfo item, Location begin, Location end)
{
return IsInRange(item, begin.Line, begin.Column, end.Line, end.Column);
}
public static bool IsInRange(this XObject item, int beginLine, int beginColumn, int endLine, int endColumn)
public static bool IsInRange(this IXmlLineInfo item, int beginLine, int beginColumn, int endLine, int endColumn)
{
if (item.GetLineNumber() >= beginLine && item.GetLineNumber() <= endLine) {
if (item.GetLineNumber() == beginLine) {
@ -215,11 +215,11 @@ namespace ICSharpCode.XamlBinding @@ -215,11 +215,11 @@ namespace ICSharpCode.XamlBinding
return false;
}
public static bool IsCollectionType(this IClass c)
public static bool IsCollectionType(this IClass thisValue)
{
if (c == null)
throw new ArgumentNullException("c");
return c.ClassInheritanceTree.Any(cla => cla.FullyQualifiedName == "System.Collections.ICollection");
if (thisValue == null)
throw new ArgumentNullException("thisValue");
return thisValue.ClassInheritanceTree.Any(cla => cla.FullyQualifiedName == "System.Collections.ICollection");
}
public static bool IsCollectionReturnType(this IReturnType type)
@ -232,11 +232,11 @@ namespace ICSharpCode.XamlBinding @@ -232,11 +232,11 @@ namespace ICSharpCode.XamlBinding
return false;
}
public static bool IsListType(this IClass c)
public static bool IsListType(this IClass thisValue)
{
if (c == null)
throw new ArgumentNullException("c");
return c.ClassInheritanceTree.Any(cla => cla.FullyQualifiedName == "System.Collections.IList");
if (thisValue == null)
throw new ArgumentNullException("thisValue");
return thisValue.ClassInheritanceTree.Any(cla => cla.FullyQualifiedName == "System.Collections.IList");
}
public static bool IsListReturnType(this IReturnType type)
@ -250,9 +250,9 @@ namespace ICSharpCode.XamlBinding @@ -250,9 +250,9 @@ namespace ICSharpCode.XamlBinding
}
/// <remarks>Works only if fullyQualyfiedClassName is the name of a class!</remarks>
public static bool DerivesFrom(this IClass myClass, string fullyQualyfiedClassName)
public static bool DerivesFrom(this IClass myClass, string fullyQualifiedClassName)
{
return myClass.ClassInheritanceTreeClassesOnly.Any(c => c.FullyQualifiedName == fullyQualyfiedClassName);
return myClass.ClassInheritanceTreeClassesOnly.Any(c => c.FullyQualifiedName == fullyQualifiedClassName);
}
public static T PopOrDefault<T>(this Stack<T> stack)

32
src/AddIns/BackendBindings/XamlBinding/XamlBinding/LookupInfo.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.NRefactory;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
{
public class LookupInfo {
public LookupInfo() { }
public Dictionary<string, string> XmlnsDefinitions { get; set; }
public List<string> IgnoredXmlns { get; set; }
public QualifiedNameWithLocation Active { get; set; }
public QualifiedNameWithLocation Parent { get; set; }
public int ActiveElementStartIndex { get; set; }
public bool IsRoot { get; set; }
}
}

2
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/EditGridColumnsAndRowsCommand.cs

@ -42,7 +42,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands @@ -42,7 +42,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
EditGridColumnsAndRowsDialog dialog = new EditGridColumnsAndRowsDialog(selectedItem);
if (dialog.ShowDialog() ?? false) {
selectedItem.ReplaceWith(dialog.GetConstructedTree());
selectedItem.ReplaceWith(dialog.ConstructedTree);
return true;
}

2
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/ExtractPropertiesAsStyleCommand.cs

@ -100,7 +100,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands @@ -100,7 +100,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
// TODO : make the methods xmlns independent
XElement CreateStyle(string name, string targetType, IEnumerable<PropertyEntry> entries)
static XElement CreateStyle(string name, string targetType, IEnumerable<PropertyEntry> entries)
{
XElement style = new XElement(XName.Get("Style", CompletionDataHelper.WpfXamlNamespace));
if (!string.IsNullOrEmpty(name))

2
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/GroupIntoRefactorings.cs

@ -102,7 +102,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands @@ -102,7 +102,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
public abstract ICollection BuildItems(Codon codon, object owner);
protected MenuItem CreateItem(string header, Action clickAction)
protected static MenuItem CreateItem(string header, Action clickAction)
{
MenuItem item = new MenuItem() { Header = header };
item.Click += new RoutedEventHandler(delegate { clickAction(); });

57
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/EditGridColumnsAndRowsDialog.xaml.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows;
@ -62,11 +63,6 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -62,11 +63,6 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
AdditionalProperties = propertiesCopy
};
}
public static UndoStep Copy(UndoStep original)
{
return CreateStep(original.Tree, original.RowDefinitions, original.ColumnDefinitions, original.AdditionalProperties);
}
}
Stack<UndoStep> undoStack;
@ -138,7 +134,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -138,7 +134,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var rowAttrib = item.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) + 1);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
@ -176,7 +172,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -176,7 +172,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var rowAttrib = item.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) + 1);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
@ -229,14 +225,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -229,14 +225,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var rowAttrib = item.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) - 1);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) - 1);
}
);
controlsDown.ForEach(
item2 => {
var rowAttrib = item2.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item2.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) + 1);
item2.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
@ -290,14 +286,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -290,14 +286,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var rowAttrib = item.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) + 1);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
controlsUp.ForEach(
item2 => {
var rowAttrib = item2.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item2.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) - 1);
item2.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) - 1);
}
);
@ -331,7 +327,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -331,7 +327,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var rowAttrib = item.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value) - 1);
item.SetAttributeValue(XName.Get("Grid.Row"), int.Parse(rowAttrib.Value, CultureInfo.InvariantCulture) - 1);
}
);
@ -368,7 +364,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -368,7 +364,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var colAttrib = item.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) + 1);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
@ -405,7 +401,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -405,7 +401,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var colAttrib = item.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) + 1);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
@ -459,14 +455,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -459,14 +455,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var colAttrib = item.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) - 1);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) - 1);
}
);
controlsLeft.ForEach(
item2 => {
var colAttrib = item2.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item2.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) + 1);
item2.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
@ -521,14 +517,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -521,14 +517,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var colAttrib = item.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) + 1);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) + 1);
}
);
controlsRight.ForEach(
item2 => {
var colAttrib = item2.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item2.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) - 1);
item2.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) - 1);
}
);
@ -562,7 +558,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -562,7 +558,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
controls.ForEach(
item => {
var colAttrib = item.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value) - 1);
item.SetAttributeValue(XName.Get("Grid.Column"), int.Parse(colAttrib.Value, CultureInfo.InvariantCulture) - 1);
}
);
@ -702,7 +698,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -702,7 +698,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
Point p = e.GetPosition(target);
TextBlock block = target.InputHitTest(p) as TextBlock;
if (block != null) {
Debug.Assert(block.Tag != null && block.Tag is XElement);
XElement element = block.Tag as XElement;
@ -756,7 +752,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -756,7 +752,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
label.MouseLeftButtonDown += new MouseButtonEventHandler(LabelMouseLeftButtonDown);
Debug.Assert(label.Tag != null);
Debug.Assert(label.Tag != null);
yield return label;
}
@ -765,7 +761,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -765,7 +761,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
void LabelMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragDropEffects allowedEffects = DragDropEffects.Move;
DragDrop.DoDragDrop(sender as Label, (sender as Label).Tag, allowedEffects);
Label label = sender as Label;
DragDrop.DoDragDrop(label, label.Tag, allowedEffects);
}
void UpdateUndoRedoState()
@ -774,13 +771,15 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -774,13 +771,15 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
this.redoStack.Clear();
}
public XElement GetConstructedTree()
public XElement ConstructedTree
{
gridTree.AddFirst(additionalProperties);
gridTree.AddFirst(colDefitions);
gridTree.AddFirst(rowDefitions);
return gridTree;
get {
gridTree.AddFirst(additionalProperties);
gridTree.AddFirst(colDefitions);
gridTree.AddFirst(rowDefitions);
return gridTree;
}
}
void DisplayRectContextMenuOpening(object sender, ContextMenuEventArgs e)
@ -859,7 +858,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs @@ -859,7 +858,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
}
void BtnDeleteItemClick(object sender, RoutedEventArgs e)
{
{
Button source = sender as Button;
XElement item = source.Tag as XElement;
if (item != null) {

6
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/XamlMenuCommand.cs

@ -5,17 +5,19 @@ @@ -5,17 +5,19 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using System;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using System.Xaml;
using System.Xml;
using System.Xml.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding.PowerToys
{
@ -38,7 +40,7 @@ namespace ICSharpCode.XamlBinding.PowerToys @@ -38,7 +40,7 @@ namespace ICSharpCode.XamlBinding.PowerToys
document.Declaration = null;
if (Refactor(provider.TextEditor, document)) {
using (provider.TextEditor.Document.OpenUndoGroup()) {
StringWriter sWriter = new StringWriter();
StringWriter sWriter = new StringWriter(CultureInfo.InvariantCulture);
XmlWriter writer = XmlWriter.Create(sWriter, CreateSettings());
document.WriteTo(writer);
writer.Flush();

8
src/AddIns/BackendBindings/XamlBinding/XamlBinding/QualifiedNameWithLocation.cs

@ -68,13 +68,13 @@ namespace ICSharpCode.XamlBinding @@ -68,13 +68,13 @@ namespace ICSharpCode.XamlBinding
return Name.GetHashCode() ^ Location.GetHashCode();
}
public bool Equals(QualifiedNameWithLocation obj)
public bool Equals(QualifiedNameWithLocation other)
{
if (obj == null)
if (other == null)
return false;
return obj.QualifiedName == QualifiedName &&
obj.Location == Location;
return other.QualifiedName == QualifiedName &&
other.Location == Location;
}
public static bool operator ==(QualifiedNameWithLocation lhs, QualifiedNameWithLocation rhs)

26
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs

@ -250,14 +250,12 @@ namespace ICSharpCode.XamlBinding @@ -250,14 +250,12 @@ namespace ICSharpCode.XamlBinding
public QualifiedNameWithLocation Item { get; set; }
}
public static void LookUpInfoAtTarget(string fileContent, int caretLine, int caretColumn, int offset,
out Dictionary<string, string> xmlns, out List<string> ignoredXmlns, out QualifiedNameWithLocation active,
out QualifiedNameWithLocation parent, out int activeElementStartIndex, out bool isRoot)
public static LookupInfo LookupInfoAtTarget(string fileContent, int caretLine, int caretColumn, int offset)
{
Stack<QualifiedNameWithLocation> stack = new Stack<QualifiedNameWithLocation>();
Stack<IgnoredXmlnsWrapper> ignoredXmlnsStack = new Stack<IgnoredXmlnsWrapper>();
isRoot = false;
var isRoot = false;
XmlTextReader r = new XmlTextReader(new StringReader(fileContent));
r.XmlResolver = null;
@ -266,8 +264,9 @@ namespace ICSharpCode.XamlBinding @@ -266,8 +264,9 @@ namespace ICSharpCode.XamlBinding
' ', '\t', '\n', '\r'
};
ignoredXmlns = new List<string>();
var ignoredXmlns = new List<string>();
Dictionary<string, string> xmlns;
try {
r.WhitespaceHandling = WhitespaceHandling.Significant;
// move reader to correct position
@ -306,10 +305,10 @@ namespace ICSharpCode.XamlBinding @@ -306,10 +305,10 @@ namespace ICSharpCode.XamlBinding
xmlns = new Dictionary<string, string>(r.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml));
}
activeElementStartIndex = XmlParser.GetActiveElementStartIndex(fileContent, Math.Min(offset + 1, fileContent.Length - 1));
var activeElementStartIndex = XmlParser.GetActiveElementStartIndex(fileContent, Math.Min(offset + 1, fileContent.Length - 1));
active = ResolveCurrentElement(fileContent, activeElementStartIndex, xmlns);
parent = stack.PopOrDefault();
var active = ResolveCurrentElement(fileContent, activeElementStartIndex, xmlns);
var parent = stack.PopOrDefault();
if (active == parent)
parent = stack.PopOrDefault();
@ -319,6 +318,15 @@ namespace ICSharpCode.XamlBinding @@ -319,6 +318,15 @@ namespace ICSharpCode.XamlBinding
if (active == null)
active = parent;
return new LookupInfo() {
Active = active,
ActiveElementStartIndex = activeElementStartIndex,
IgnoredXmlns = ignoredXmlns,
IsRoot = isRoot,
Parent = parent,
XmlnsDefinitions = xmlns
};
}
public static XmlTextReader CreateReaderAtTarget(string fileContent, int caretLine, int caretColumn)

1
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.csproj

@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="LookupInfo.cs" />
<Compile Include="MarkupExtensionInfo.cs" />
<Compile Include="MarkupExtensionParser.cs">
<DependentUpon>MarkupExtensionTokenizer.cs</DependentUpon>

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

@ -73,7 +73,7 @@ namespace ICSharpCode.XamlBinding @@ -73,7 +73,7 @@ namespace ICSharpCode.XamlBinding
case '{': // starting point for Markup Extension Completion
if (context.AttributeName != null
&& XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset)
&& !(context.RawAttributeValue.StartsWith("{}") && context.RawAttributeValue.Length != 2)) {
&& !(context.RawAttributeValue.StartsWith("{}", StringComparison.OrdinalIgnoreCase) && context.RawAttributeValue.Length != 2)) {
if (editor.SelectionLength != 0)
editor.Document.Remove(editor.SelectionStart, editor.SelectionLength);
@ -97,7 +97,7 @@ namespace ICSharpCode.XamlBinding @@ -97,7 +97,7 @@ namespace ICSharpCode.XamlBinding
break;
case ':':
if (context.ActiveElement != null && XmlParser.GetQualifiedAttributeNameAtIndex(editor.Document.Text, editor.Caret.Offset) == null) {
if (context.AttributeName != null && !context.AttributeName.Name.StartsWith("xmlns")) {
if (context.AttributeName != null && !context.AttributeName.Name.StartsWith("xmlns", StringComparison.OrdinalIgnoreCase)) {
list = CompletionDataHelper.CreateListForContext(context);
list.PreselectionLength = editor.GetWordBeforeCaretExtended().Length;
editor.ShowCompletionWindow(list);
@ -143,7 +143,7 @@ namespace ICSharpCode.XamlBinding @@ -143,7 +143,7 @@ namespace ICSharpCode.XamlBinding
string attributeName = (context.AttributeName != null) ? context.AttributeName.Name : string.Empty;
if (!attributeName.StartsWith("xmlns"))
if (!attributeName.StartsWith("xmlns", StringComparison.OrdinalIgnoreCase))
this.CtrlSpace(editor);
trackForced = true;
return CodeCompletionKeyPressResult.CompletedIncludeKeyInCompletion;
@ -174,8 +174,6 @@ namespace ICSharpCode.XamlBinding @@ -174,8 +174,6 @@ namespace ICSharpCode.XamlBinding
var mrr = XamlResolver.Resolve(context.AttributeName.FullXmlName, context) as MemberResolveResult;
if (mrr != null && mrr.ResolvedType != null) {
var c = mrr.ResolvedType.GetUnderlyingClass();
completionList.Items.AddRange(CompletionDataHelper.MemberCompletion(context, mrr.ResolvedType, string.Empty));
editor.ShowInsightWindow(CompletionDataHelper.MemberInsight(mrr));
}

8
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlColorizer.cs

@ -103,7 +103,7 @@ namespace ICSharpCode.XamlBinding @@ -103,7 +103,7 @@ namespace ICSharpCode.XamlBinding
if (task.IsCancellationRequested)
return;
if (!info.Token.StartsWith("xmlns")) {
if (!info.Token.StartsWith("xmlns", StringComparison.OrdinalIgnoreCase)) {
MemberResolveResult rr = new XamlResolver().Resolve(info.GetExpressionResult(), info.Context.ParseInformation, FileContent) as MemberResolveResult;
member = (rr != null) ? rr.ResolvedMember : null;
}
@ -148,7 +148,7 @@ namespace ICSharpCode.XamlBinding @@ -148,7 +148,7 @@ namespace ICSharpCode.XamlBinding
index += attribute.Substring(propertyNameIndex).Length;
}
if (context.Description != XamlContextDescription.InComment && !string.IsNullOrEmpty(attribute)) {
int startIndex = LineText.Substring(0, Math.Min(index, LineText.Length)).LastIndexOf(attribute);
int startIndex = LineText.Substring(0, Math.Min(index, LineText.Length)).LastIndexOf(attribute, StringComparison.Ordinal);
if (startIndex >= 0) {
if (propertyNameIndex > -1)
infos.Add(new HighlightingInfo(attribute.Trim('/'), startIndex + propertyNameIndex + 1, startIndex + attribute.TrimEnd('/').Length, Offset, context));
@ -226,7 +226,7 @@ namespace ICSharpCode.XamlBinding @@ -226,7 +226,7 @@ namespace ICSharpCode.XamlBinding
void ColorizeMember(HighlightingInfo info, DocumentLine line, IMember member)
{
if (info.Context.IgnoredXmlns.Any(item => info.Token.StartsWith(item + ":"))) {
if (info.Context.IgnoredXmlns.Any(item => info.Token.StartsWith(item + ":", StringComparison.OrdinalIgnoreCase))) {
ChangeLinePart(line.Offset + info.StartOffset, line.Offset + info.EndOffset, HighlightIgnored);
} else {
if (member != null) {
@ -235,7 +235,7 @@ namespace ICSharpCode.XamlBinding @@ -235,7 +235,7 @@ namespace ICSharpCode.XamlBinding
else
ChangeLinePart(line.Offset + info.StartOffset, line.Offset + info.EndOffset, HighlightProperty);
} else {
if (info.Token.StartsWith("xmlns") || info.Token.StartsWith(Utils.GetNamespacePrefix(CompletionDataHelper.MarkupCompatibilityNamespace, info.Context) + ":"))
if (info.Token.StartsWith("xmlns", StringComparison.OrdinalIgnoreCase) || info.Token.StartsWith(Utils.GetNamespacePrefix(CompletionDataHelper.MarkupCompatibilityNamespace, info.Context) + ":", StringComparison.OrdinalIgnoreCase))
ChangeLinePart(line.Offset + info.StartOffset, line.Offset + info.EndOffset, HighlightNamespaceDeclaration);
else
Core.LoggingService.Debug(info.Token + " not highlighted; line " + line.LineNumber);

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

@ -34,7 +34,7 @@ namespace ICSharpCode.XamlBinding @@ -34,7 +34,7 @@ namespace ICSharpCode.XamlBinding
if (string.IsNullOrEmpty(className) || className.Contains("."))
return null;
if (xmlNamespace.StartsWith("clr-namespace:")) {
if (xmlNamespace.StartsWith("clr-namespace:", StringComparison.OrdinalIgnoreCase)) {
return CreateClrNamespaceType(this.ProjectContent, xmlNamespace, className);
} else {
return new XamlClassReturnType(this, xmlNamespace, className);

47
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItem.cs

@ -5,10 +5,12 @@ @@ -5,10 +5,12 @@
// <version>$Revision: 3731 $</version>
// </file>
using ICSharpCode.Core;
using System;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
@ -66,27 +68,6 @@ namespace ICSharpCode.XamlBinding @@ -66,27 +68,6 @@ namespace ICSharpCode.XamlBinding
this.name = name;
this.Image = ClassBrowserIconService.Namespace;
}
public XamlCompletionItem(string @namespace, string name)
: base(name)
{
this.prefix = "";
this.@namespace = @namespace;
this.name = name;
this.Image = ClassBrowserIconService.Namespace;
}
public string Prefix {
get { return prefix; }
}
public string Namespace {
get { return @namespace; }
}
public string Name {
get { return name; }
}
}
class SpecialCompletionItem : DefaultCompletionItem
@ -196,19 +177,19 @@ namespace ICSharpCode.XamlBinding @@ -196,19 +177,19 @@ namespace ICSharpCode.XamlBinding
while (namePatternRegex.IsMatch(name)) {
Match match = namePatternRegex.Match(name);
switch (match.Value.ToLowerInvariant()) {
case "%object%":
switch (match.Value.ToUpperInvariant()) {
case "%OBJECT%":
if (char.IsUpper(match.Value[1]))
objectName = objectName.ToUpper()[0] + objectName.Substring(1, objectName.Length - 1);
objectName = objectName.ToUpperInvariant()[0] + objectName.Substring(1, objectName.Length - 1);
else
objectName = objectName.ToLower()[0] + objectName.Substring(1, objectName.Length - 1);
objectName = objectName.ToLowerInvariant()[0] + objectName.Substring(1, objectName.Length - 1);
name = name.Replace(match.Index, match.Length, objectName);
break;
case "%event%":
case "%EVENT%":
if (char.IsUpper(match.Value[1]))
eventName = eventName.ToUpper()[0] + eventName.Substring(1, eventName.Length - 1);
eventName = eventName.ToUpperInvariant()[0] + eventName.Substring(1, eventName.Length - 1);
else
eventName = eventName.ToLower()[0] + eventName.Substring(1, eventName.Length - 1);
eventName = eventName.ToLowerInvariant()[0] + eventName.Substring(1, eventName.Length - 1);
name = name.Replace(match.Index, match.Length, eventName);
break;
case "%%":
@ -234,10 +215,6 @@ namespace ICSharpCode.XamlBinding @@ -234,10 +215,6 @@ namespace ICSharpCode.XamlBinding
this.ctor = entity;
}
public IMethod Ctor {
get { return ctor; }
}
string headerText;
bool descriptionCreated;
string description;
@ -276,10 +253,6 @@ namespace ICSharpCode.XamlBinding @@ -276,10 +253,6 @@ namespace ICSharpCode.XamlBinding
bool descriptionCreated;
IMember member;
public IMember Member {
get { return member; }
}
public MemberInsightItem(IMember member, string insightText)
{
this.member = member;

5
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCompletionItemList.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.XamlBinding @@ -79,7 +79,7 @@ namespace ICSharpCode.XamlBinding
int spaces = CountWhiteSpacesAtEnd(context.Editor.GetWordBeforeCaret());
int typeNameStart = markup.ExtensionType.IndexOf(':') + 1;
if (!word.EndsWith(",") && markup.ExtensionType.Substring(typeNameStart, markup.ExtensionType.Length - typeNameStart) != word) {
if (!word.EndsWith(",", StringComparison.OrdinalIgnoreCase) && markup.ExtensionType.Substring(typeNameStart, markup.ExtensionType.Length - typeNameStart) != word) {
context.Editor.Document.Replace(context.Editor.Caret.Offset - spaces, spaces, ", ");
oldOffset += (2 - spaces);
}
@ -88,7 +88,7 @@ namespace ICSharpCode.XamlBinding @@ -88,7 +88,7 @@ namespace ICSharpCode.XamlBinding
}
}
if (cItem.Text.EndsWith("="))
if (cItem.Text.EndsWith("=", StringComparison.OrdinalIgnoreCase))
XamlCodeCompletionBinding.Instance.CtrlSpace(context.Editor);
}
}
@ -104,7 +104,6 @@ namespace ICSharpCode.XamlBinding @@ -104,7 +104,6 @@ namespace ICSharpCode.XamlBinding
}
if (item is XamlCompletionItem && xamlContext.Description == XamlContextDescription.InTag) {
XamlCompletionItem xamlItem = item as XamlCompletionItem;
context.Editor.Document.Insert(context.EndOffset, "=\"\"");
context.Editor.Caret.Offset--;
}

6
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlContext.cs

@ -5,15 +5,17 @@ @@ -5,15 +5,17 @@
// <version>$Revision: 3731 $</version>
// </file>
using ICSharpCode.SharpDevelop.Editor;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Xml;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.XmlEditor;
namespace ICSharpCode.XamlBinding
@ -29,7 +31,7 @@ namespace ICSharpCode.XamlBinding @@ -29,7 +31,7 @@ namespace ICSharpCode.XamlBinding
public Dictionary<string, string> XmlnsDefinitions { get; set; }
public ParseInformation ParseInformation { get; set; }
public bool InRoot { get; set; }
public List<string> IgnoredXmlns { get; set; }
public ReadOnlyCollection<string> IgnoredXmlns { get; set; }
public XamlContext() {}

Loading…
Cancel
Save