Skip to content

Commit 42dfb71

Browse files
authored
Complete react.componentWithProps (#7812)
* Complete react.componentWithProps * Add changelog
1 parent 9047078 commit 42dfb71

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- Dedicated error message for passing a braced ident to something expected to be a record. https://github.com/rescript-lang/rescript/pull/7806
3636
- Hint about partial application when missing required argument in function call. https://github.com/rescript-lang/rescript/pull/7807
3737
- More autocomplete improvements involving modules and module types. https://github.com/rescript-lang/rescript/pull/7795
38+
- Autocomplete `@react.componentWithProps` attribute. https://github.com/rescript-lang/rescript/pull/7812
3839

3940
#### :house: Internal
4041

analysis/src/CompletionDecorators.ml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,24 @@ Note: The `@react.component` decorator requires the `jsx` config to be set in yo
173173
[
174174
{|The `@jsx.component` decorator is used to annotate functions that are JSX components used with ReScript's [generic JSX transform](https://rescript-lang.org/docs/manual/latest/jsx#generic-jsx-transform-jsx-beyond-react-experimental).
175175

176+
You will need this decorator whenever you want to use a JSX component in ReScript JSX expressions.|};
177+
] );
178+
( "react.componentWithProps",
179+
None,
180+
[
181+
{|The `@react.componentWithProps` decorator is used to annotate functions that are RescriptReact components.
182+
183+
You will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.
184+
185+
Note: The `@react.componentWithProps` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.
186+
187+
[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-with-props-decorator).|};
188+
] );
189+
( "jsx.componentWithProps",
190+
None,
191+
[
192+
{|The `@jsx.componentWithProps` decorator is used to annotate functions that are JSX components used with ReScript's [generic JSX transform](https://rescript-lang.org/docs/manual/latest/jsx#generic-jsx-transform-jsx-beyond-react-experimental).
193+
176194
You will need this decorator whenever you want to use a JSX component in ReScript JSX expressions.|};
177195
] );
178196
( "return",

tests/analysis_tests/tests/src/expected/Completion.res.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,13 @@ Resolved opens 1 Stdlib
806806
"detail": "",
807807
"documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."},
808808
"insertTextFormat": 2
809+
}, {
810+
"label": "react.componentWithProps",
811+
"kind": 4,
812+
"tags": [],
813+
"detail": "",
814+
"documentation": {"kind": "markdown", "value": "The `@react.componentWithProps` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.componentWithProps` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-with-props-decorator)."},
815+
"insertTextFormat": 2
809816
}]
810817

811818
Complete src/Completion.res 68:10
@@ -822,6 +829,13 @@ Resolved opens 1 Stdlib
822829
"detail": "",
823830
"documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."},
824831
"insertTextFormat": 2
832+
}, {
833+
"label": "componentWithProps",
834+
"kind": 4,
835+
"tags": [],
836+
"detail": "",
837+
"documentation": {"kind": "markdown", "value": "The `@react.componentWithProps` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.componentWithProps` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-with-props-decorator)."},
838+
"insertTextFormat": 2
825839
}]
826840

827841
Complete src/Completion.res 71:27

0 commit comments

Comments
 (0)