Skip to content

Commit

Permalink
Fixes indentation issue caused by regex in onEnterRules (#8996)
Browse files Browse the repository at this point in the history
  • Loading branch information
maryamariyan authored Jul 24, 2023
1 parent 3b87525 commit 07ec313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
},
"onEnterRules": [
{
"beforeText": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!\\/)>)[^<]*$",
"beforeText": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))([_:\\w][_:\\w-.\\d]*)([^/>]*(=>)*[^/>]*(?<!=)(?!\\/)>)[^<]*$",
"afterText": "^<\\/([_:\\w][_:\\w-.\\d]*)\\s*>",
"action": {
"indent": "indentOutdent"
}
},
{
"beforeText": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))(\\w[\\w\\d]*)([^/>]*(?!\\/)>)[^<]*$",
"beforeText": "<(?!(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr))(\\w[\\w\\d]*)([^/>]*(=>)*[^/>]*(?<!=)(?!\\/)>)[^<]*$",
"action": {
"indent": "indent"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public LanguageConfigurationTest(ITestOutputHelper output)
[InlineData("""<div class="hello">$$</div>""")]
[InlineData("""<div class="@(() => true)">$$""")]
[InlineData("""<div class="@(() => true)">$$</div>""")]
[InlineData("""<PropertyColumn Value="() => true" >$$""")]
[InlineData("""<PropertyColumn Value="() => true" >$$</PropertyColumn>""")]
public void OnEnter_WillIndent(string input)
{
TestFileMarkupParser.GetPosition(input, out input, out var position);
Expand All @@ -38,7 +40,8 @@ public void OnEnter_WillIndent(string input)
[Theory]
[InlineData("""<input>$$""")]
[InlineData("""<input />$$""")]
[InlineData("""<PropertyColumn Value="() => true" />$$""", Skip = "https://github.com/dotnet/razor/issues/8916")]
[InlineData("""<PropertyColumn Value="() => true" />$$""")]
[InlineData("""<PropertyColumn />$$""")]
public void OnEnter_WontIndent(string input)
{
TestFileMarkupParser.GetPosition(input, out input, out var position);
Expand Down

0 comments on commit 07ec313

Please sign in to comment.