Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed syntax tree validation" for raw string literals #1129

Closed
Rudomitori opened this issue Jan 16, 2024 · 0 comments · Fixed by #1132
Closed

"Failed syntax tree validation" for raw string literals #1129

Rudomitori opened this issue Jan 16, 2024 · 0 comments · Fixed by #1132
Milestone

Comments

@Rudomitori
Copy link
Contributor

Environments:

  • CSharpier Version: 0.27.0
  • Running CSharpier via: dotnet cli
  • Operating System: Windows 11
  • .csharpierrc Settings: No
  • .editorconfig Settings: No

Steps to reproduce:
Try to format the following code:

var expectedTypeProp = "otherTestComponent";
var expectedLabel = StableRandom.Shared.GetString();
var expectedText = StableRandom.Shared.GetString();
var expectedDisplayName = StableRandom.Shared.GetString();

var node = JsonSerializer.Deserialize<SerializedNode>(
    $$"""
      {
          "props": {
              "type": "{{expectedTypeProp}}",
              "label": "{{expectedLabel}}",
              "text": "{{expectedText}}"
          },
          "hidden": false,
          "nodes": [],
          "linkedNodes": {},
          "displayName": "{{expectedDisplayName}}",
          "type": {
              "resolvedName": "testComponent"
          }
      }
      """,
    _options
);

Expected behavior:
No error is outputed

Actual behavior:
CSharpier formats the code and outputs an error:

Failed syntax tree validation.
  ----------------------------- Original: Around Line 20 -----------------------------
                "resolvedName": "testComponent"
            }
        }
        """,
      _options
  );
  ----------------------------- Formatted: Around Line 20 -----------------------------
              "resolvedName": "testComponent"
          }
      }
      """,
      _options
  );
@belav belav added this to the 0.27.1 milestone Jan 17, 2024
belav added a commit that referenced this issue Jan 17, 2024
belav added a commit that referenced this issue Jan 18, 2024
#1132)

* Fixing false positive of SyntaxCompare running on InterpolatedRawString that changed indentation

closes #1129

* formatting files

---------

Co-authored-by: Lasath Fernando <devel@lasath.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants