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

complete for functions creating React.element when in a JSX context #681

Merged
merged 8 commits into from
Jan 11, 2023

Conversation

zth
Copy link
Collaborator

@zth zth commented Jan 7, 2023

Something I've wanted for a while. This will add React.string, React.array etc to the completion items for relevant types in pipe when in a JSX context. Being in a JSX context is defined as a) being in the body of a make function annotated with @react.component, or b) being inside of JSX.

Example:
Doing pipe completion on an int in JSX context will return React.int in the completion items, in addition to the builtin completions for int.

This accomplishes two things:

  1. Convenience, since you otherwise have to first complete for React, and then the fn you're after.
  2. Helps beginners with understanding that you in ReScript need to use the respective React.element producing functions in JSX.

@zth zth requested a review from cristianoc January 7, 2023 16:58
@zth zth requested a review from cristianoc January 10, 2023 20:10
Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restoring context seems wrong.

Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead merge after fixing the code for restoring the context.

@zth zth force-pushed the complete-react-element-fns-in-jsx branch from 6ac3aef to 1f7ac44 Compare January 11, 2023 15:23
@zth zth merged commit 67f620e into master Jan 11, 2023
@zth zth deleted the complete-react-element-fns-in-jsx branch January 11, 2023 17:21
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 this pull request may close these issues.

None yet

2 participants