Skip to content

enable completions for handwritten JSX components #720

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

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

zth
Copy link
Collaborator

@zth zth commented Jan 31, 2023

Fixes #707

A bit unsure if this is the best approach. What do you think @cristianoc ?

@zth zth requested a review from cristianoc January 31, 2023 21:08
@@ -559,6 +559,19 @@ let getJsxLabels ~componentPath ~findTypeOfValue ~package =
&& Path.last path = "props" ->
(* JSX V4 external or interface *)
getFieldsV4 ~path ~typeArgs
| Tarrow (Nolabel, typ, _, _) -> (
(* Component without the JSX PPX, like a make fn taking a hand-written
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should one check anything about the return type? Or can it be anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could check the return type for sure but I'm unsure if it really matters that much. Strictly though it needs to be React.element, or whatever JSX element is configured (not sure if it can be configured now, but it'll be possible later). For this to error, you'd need to use a JSX component with a make function in a module that takes a type named props, and return something else then React.element (which will error in compilation anyway).

I say we go without it for this case, and then fix it if need be?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good

@zth zth merged commit 9c13e7a into master Feb 1, 2023
@zth zth deleted the fix-completion-for-handwritten-components branch February 1, 2023 12:46
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.

JSX v4 auto completion
2 participants