rescript-lang / rescript-lang/rescript-vscode
Suggestion: Code action to wrap in React.string
Nobody has claimed this yet.
- Dominant language
- ReScript
- Stars
- 354
- Forks
- 63
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 1
Description
So, I just pasted some JSX:
<thead>
<tr>
<th>Nummer</th>
<th>Voornaam</th>
<th>Familienaam</th>
<th>Geboortejaar</th>
</tr>
</thead>
And of course, Nummer is just text and not a thing so I get
#Start(1726858554888)
We've found a bug for you!
/home/nojaf/projects/tenmileselverdinge-tickets/app/src/components/LiveResults.res:40:15-20
38 ┆ <th>{React.string(`Positie`)}</th>
39 ┆ <th>{React.string(`Tijd`)}</th>
40 ┆ <th>Nummer</th>
41 ┆ <th>Voornaam</th>
42 ┆ <th>Familienaam</th>
The variant constructor Nummer can't be found.
- If it's defined in another module or file, bring it into scope by:
- Prefixing it with said module name: TheModule.Nummer
- Or specifying its type: let theValue: TheModule.theType = Nummer
- Constructors and modules are both capitalized. Did you want the latter?
Then instead of let foo = Bar, try module Foo = Bar.
#Done(1726858554916)
Would be great if I had a code fix to change Nummer to {React.string(``Nummer``)}.
@zth does this seem reasonable?
Could I detect I'm inside jsx (<th>) and just wrap everything until </th>?
Curious to hear your thoughts!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name a repository file or test. Start by tracing the existing JSX diagnostics and code-action entry points in the VSCode extension, then determine how JSX text is identified and transformed. Done means a code action wraps plain JSX text such as Nummer in React.string(...) without wrapping non-text expressions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100