Skip to content

Commit

Permalink
fix: When tagName is not Empty do not show XML Comment and auto close…
Browse files Browse the repository at this point in the history
… tag
  • Loading branch information
workgroupengineering committed Oct 28, 2023
1 parent c3dabfe commit 58a5013
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,24 @@ private static Dictionary<string, string> 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 =>
Expand Down
6 changes: 3 additions & 3 deletions tests/CompletionEngineTests/BasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ public void Completions_Should_Be_Sorted()
{
var compl = GetCompletionsFor("<DataTemplate");

Assert.Equal(5, compl.Completions.Count);
Assert.Equal("DataTemplate", compl.Completions[3].DisplayText);
Assert.Equal("DataTemplates", compl.Completions[4].DisplayText);
Assert.Equal(2, compl.Completions.Count);
Assert.Equal("DataTemplate", compl.Completions[0].DisplayText);
Assert.Equal("DataTemplates", compl.Completions[1].DisplayText);
}

[Fact]
Expand Down

0 comments on commit 58a5013

Please sign in to comment.