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

Parser should recover better from broken JSX prop code #6559

Open
zth opened this issue Jan 11, 2024 · 0 comments
Open

Parser should recover better from broken JSX prop code #6559

zth opened this issue Jan 11, 2024 · 0 comments
Labels
Milestone

Comments

@zth
Copy link
Collaborator

zth commented Jan 11, 2024

<CompletionSupport.TestComponent on= someOtherProp=true

This is parsed as:

[
  structure_item 
    Pstr_eval
    expression 
      Pexp_apply
      expression 
        Pexp_ident "React.createElement" 
      [
        <arg>
        Nolabel
          expression 
            Pexp_ident "CompletionSupport.TestComponent.make" 
        <arg>
        Nolabel
          expression 
            Pexp_record
            [
              "on" 
                expression 
                  attribute  "res.namedArgLoc"
                    []
                  Pexp_ident "someOtherProp" 
            ]
            None
      ]
  structure_item 
    Pstr_eval
    expression 
      Pexp_construct "true" 
      None
]

...which effectively means:

<CompletionSupport.TestComponent on=someOtherProp
true

But, preferably it should be parsed as:

<CompletionSupport.TestComponent on=%rescript.exprHole someOtherProp=true

The current state prevents us from doing proper completions in this case, which is quite common, so it's a bit annoying.

@zth zth added the syntax label Feb 2, 2024
@cknitt cknitt added this to the v12 milestone Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants