diff --git a/CompletionEngine/Avalonia.Ide.CompletionEngine/Completion/CompletionEngine.cs b/CompletionEngine/Avalonia.Ide.CompletionEngine/Completion/CompletionEngine.cs index 0dadde4b..08ac8f5d 100644 --- a/CompletionEngine/Avalonia.Ide.CompletionEngine/Completion/CompletionEngine.cs +++ b/CompletionEngine/Avalonia.Ide.CompletionEngine/Completion/CompletionEngine.cs @@ -260,22 +260,24 @@ private static Dictionary GetNamespaceAliases(string xml) } else { - if (state.GetParentTagName(1) is string parentTag) + if (tagName.Length == 0) { - if (!state.IsInClosingTag) + if (state.GetParentTagName(1) is string parentTag) { - completions.Add(new Completion("/" + parentTag + ">", CompletionKind.Class, priority: 0)); - } - if (parentTag.IndexOf('.') == -1) - { - completions.Add(new Completion(parentTag, $"{parentTag}.", CompletionKind.Class, priority: 1) + if (!state.IsInClosingTag) + { + completions.Add(new Completion("/" + parentTag + ">", CompletionKind.Class, priority: 0)); + } + if (parentTag.IndexOf('.') == -1) { - TriggerCompletionAfterInsert = true, - }); + completions.Add(new Completion(parentTag, $"{parentTag}.", CompletionKind.Class, priority: 1) + { + TriggerCompletionAfterInsert = true, + }); + } } + completions.Add(new Completion("!--", "!---->", CompletionKind.Comment) { RecommendedCursorOffset = 3 }); } - completions.Add(new Completion("!--", "!---->", CompletionKind.Comment) { RecommendedCursorOffset = 3 }); - completions.AddRange(Helper.FilterTypes(tagName) .Where(kvp=>!kvp.Value.IsAbstract) .Select(kvp => diff --git a/tests/CompletionEngineTests/BasicTests.cs b/tests/CompletionEngineTests/BasicTests.cs index 5cc01b16..acbc9a9f 100644 --- a/tests/CompletionEngineTests/BasicTests.cs +++ b/tests/CompletionEngineTests/BasicTests.cs @@ -139,9 +139,9 @@ public void Completions_Should_Be_Sorted() { var compl = GetCompletionsFor("