diff --git a/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj b/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj
index 0930422e4d..4003939b2f 100644
--- a/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj
+++ b/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj
@@ -293,10 +293,6 @@
ICSharpCode.SharpDevelop.Dom.dll
Always
-
- XmlEditor.dll
- Always
-
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionDataProvider.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionDataProvider.cs
index cf2455101e..80f9c2c2e6 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionDataProvider.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionDataProvider.cs
@@ -7,6 +7,7 @@
using ICSharpCode.XmlEditor;
using System;
+using System.Linq;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Editor;
@@ -34,20 +35,22 @@ namespace ICSharpCode.XmlEditor
{
string text = String.Concat(fileContent, charTyped);
+ DefaultCompletionItemList list = null;
+
switch (charTyped) {
case '=':
// Namespace intellisense.
if (XmlParser.IsNamespaceDeclaration(text, text.Length)) {
- return schemaCompletionDataItems.GetNamespaceCompletionData();
+ list = schemaCompletionDataItems.GetNamespaceCompletionData();
}
break;
case '<':
// Child element intellisense.
XmlElementPath parentPath = XmlParser.GetParentElementPath(text);
if (parentPath.Elements.Count > 0) {
- return GetChildElementCompletionData(parentPath);
+ list = GetChildElementCompletionData(parentPath);
} else if (defaultSchemaCompletionData != null) {
- return defaultSchemaCompletionData.GetElementCompletionData(defaultNamespacePrefix);
+ list = defaultSchemaCompletionData.GetElementCompletionData(defaultNamespacePrefix);
}
break;
@@ -56,7 +59,7 @@ namespace ICSharpCode.XmlEditor
if (!XmlParser.IsInsideAttributeValue(text, text.Length)) {
XmlElementPath path = XmlParser.GetActiveElementStartPath(text, text.Length);
if (path.Elements.Count > 0) {
- return GetAttributeCompletionData(path);
+ list = GetAttributeCompletionData(path);
}
}
break;
@@ -67,14 +70,19 @@ namespace ICSharpCode.XmlEditor
if (attributeName.Length > 0) {
XmlElementPath elementPath = XmlParser.GetActiveElementStartPath(text, text.Length);
if (elementPath.Elements.Count > 0) {
- return GetAttributeValueCompletionData(elementPath, attributeName);
+ list = GetAttributeValueCompletionData(elementPath, attributeName);
}
}
}
break;
}
- return null;
+ if (list != null) {
+ list.SortItems();
+ list.SuggestedItem = list.Items.FirstOrDefault();
+ }
+
+ return list;
}
///
@@ -120,7 +128,7 @@ namespace ICSharpCode.XmlEditor
return schemaCompletionDataItems.GetSchemaFromFileName(fileName);
}
- public ICompletionItemList GetChildElementCompletionData(XmlElementPath path)
+ public DefaultCompletionItemList GetChildElementCompletionData(XmlElementPath path)
{
XmlCompletionItemList list = new XmlCompletionItemList();
@@ -130,11 +138,11 @@ namespace ICSharpCode.XmlEditor
}
list.SortItems();
-
+ list.SuggestedItem = list.Items.FirstOrDefault();
return list;
}
- public ICompletionItemList GetAttributeCompletionData(XmlElementPath path)
+ public DefaultCompletionItemList GetAttributeCompletionData(XmlElementPath path)
{
var list = new XmlCompletionItemList();
@@ -144,11 +152,11 @@ namespace ICSharpCode.XmlEditor
}
list.SortItems();
-
+ list.SuggestedItem = list.Items.FirstOrDefault();
return list;
}
- public ICompletionItemList GetAttributeValueCompletionData(XmlElementPath path, string name)
+ public DefaultCompletionItemList GetAttributeValueCompletionData(XmlElementPath path, string name)
{
var list = new XmlCompletionItemList();
@@ -158,7 +166,7 @@ namespace ICSharpCode.XmlEditor
}
list.SortItems();
-
+ list.SuggestedItem = list.Items.FirstOrDefault();
return list;
}
}
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionItemList.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionItemList.cs
index 8a0837b9bf..02663d63b0 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionItemList.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlCompletionItemList.cs
@@ -21,7 +21,7 @@ namespace ICSharpCode.XmlEditor
public override CompletionItemListKeyResult ProcessInput(char key)
{
- if (key == ':' || key == '.')
+ if (key == ':' || key == '.' || key == ' ')
return CompletionItemListKeyResult.NormalKey;
return base.ProcessInput(key);
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
index 7fbec8a65d..6f22b79e1a 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionData.cs
@@ -141,7 +141,7 @@ namespace ICSharpCode.XmlEditor
///
/// Gets the possible root elements for an xml document using this schema.
///
- public ICompletionItemList GetElementCompletionData()
+ public DefaultCompletionItemList GetElementCompletionData()
{
return GetElementCompletionData(string.Empty);
}
@@ -149,7 +149,7 @@ namespace ICSharpCode.XmlEditor
///
/// Gets the possible root elements for an xml document using this schema.
///
- public ICompletionItemList GetElementCompletionData(string namespacePrefix)
+ public DefaultCompletionItemList GetElementCompletionData(string namespacePrefix)
{
XmlCompletionItemCollection data = new XmlCompletionItemCollection();
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs
index 184d9821fb..96c9eba6d0 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs
@@ -6,6 +6,7 @@
//
using System;
+using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -49,7 +50,7 @@ namespace ICSharpCode.XmlEditor
this.AddRange(val);
}
- public ICompletionItemList GetNamespaceCompletionData()
+ public DefaultCompletionItemList GetNamespaceCompletionData()
{
XmlCompletionItemList list = new XmlCompletionItemList();
@@ -59,7 +60,7 @@ namespace ICSharpCode.XmlEditor
}
list.SortItems();
-
+ list.SuggestedItem = list.Items.FirstOrDefault();
return list;
}
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/FirstCompletionListItemSelectedTestFixture.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/FirstCompletionListItemSelectedTestFixture.cs
index 36af7a9dca..15202db153 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/FirstCompletionListItemSelectedTestFixture.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/FirstCompletionListItemSelectedTestFixture.cs
@@ -38,7 +38,7 @@ namespace XmlEditor.Tests.Completion
XmlSchemaCompletionData schema = new XmlSchemaCompletionData(ResourceManager.GetXhtmlStrictSchema());
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(schema);
- provider = new XmlCompletionDataProvider(schemas, schema, String.Empty);
+ provider = new XmlCompletionDataProvider(schemas, schema, string.Empty);
TextEditorControl textEditor = new TextEditorControl();
completionDataItems = provider.GenerateCompletionData("", '<');
selectedCompletionData = completionDataItems.SuggestedItem;
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/ProcessKeyTests.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/ProcessKeyTests.cs
index 1a83b829a5..da4074ed18 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/ProcessKeyTests.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Completion/ProcessKeyTests.cs
@@ -5,12 +5,13 @@
// $Revision: 2760 $
//
-using ICSharpCode.SharpDevelop.Editor;
using System;
using System.Windows.Forms;
+using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
+using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.Completion
{
@@ -25,8 +26,10 @@ namespace XmlEditor.Tests.Completion
[SetUp]
public void Init()
{
+ XmlSchemaCompletionData schema = new XmlSchemaCompletionData(ResourceManager.GetXhtmlStrictSchema());
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
- list = new XmlCompletionDataProvider(schemas, null, null).GenerateCompletionData("", '<');
+ schemas.Add(schema);
+ list = new XmlCompletionDataProvider(schemas, schema, "").GenerateCompletionData("", '<');
}
///
@@ -35,19 +38,19 @@ namespace XmlEditor.Tests.Completion
[Test]
public void SpaceChar()
{
- Assert.AreEqual(CompletionDataProviderKeyResult.NormalKey, list.ProcessInput(' '));
+ Assert.AreEqual(CompletionItemListKeyResult.NormalKey, list.ProcessInput(' '));
}
[Test]
public void TabChar()
{
- Assert.AreEqual(CompletionDataProviderKeyResult.InsertionKey, list.ProcessInput('\t'));
+ Assert.AreEqual(CompletionItemListKeyResult.InsertionKey, list.ProcessInput('\t'));
}
[Test]
public void ReturnChar()
{
- Assert.AreEqual(CompletionDataProviderKeyResult.InsertionKey, list.ProcessInput((char)Keys.Return));
+ Assert.AreEqual(CompletionItemListKeyResult.InsertionKey, list.ProcessInput((char)Keys.Return));
}
}
}
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.cs
index 7ab94d0c16..6f4efa0a48 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.cs
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.cs
@@ -5,9 +5,10 @@
// $Revision: 1683 $
//
-using ICSharpCode.SharpDevelop.Editor;
+using ICSharpCode.Core;
using System;
using System.IO;
+using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj b/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
index b3f0931b05..c9012f5f44 100644
--- a/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
+++ b/src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
@@ -14,7 +14,7 @@
Full
False
Auto
- AnyCPU
+ x86
..\..\..\..\..\bin\UnitTests\
False
False
@@ -212,7 +212,7 @@
{6B717BD1-CD5E-498C-A42E-9E6A4584DC48}
XmlEditor
- True
+ False