rescript-lang / rescript-lang/rescript-vscode

jsx.componentWithProps - Goto Definition Issue

Open
#1,138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ReScript
Stars
354
Forks
63
Avg merge
11h 29m
Merged PRs (30d)
1

Description

Hey,

I'm a fan of defining my (react) components with jsx.componentWithProps instead of using labeled arguments.
Unfortunately I had to figure out, that the goto definition command doesn't work for these components.

Example:

// App.res

@jsx.component
let make = () => {
  <div>
    <SomeComponent test="" />
    <SomeComponent2 test="" />
  </div>
}
// SomeComponent.res

type props = {
  test: string
}

@jsx.componentWithProps
let make = props => {
  <div className=props.test></div>
}
// SomeComponent2.res

@jsx.component
let make = (~test: string) => {
  <div className=test></div>
}

While I can hover over <SomeComponent2... /> and use a short cut to go to the implementation / definition ("SomeComponent2.res"), it doesn't work on <SomeComponent .../>.

Hints for props will be shown in both cases.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using App.res, SomeComponent.res, and SomeComponent2.res, comparing goto definition for jsx.componentWithProps and jsx.component. Start by tracing the language-server definition lookup for these JSX components; done means the command opens SomeComponent.res as it already does for SomeComponent2.res.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.