diff --git a/CHANGELOG.md b/CHANGELOG.md index 38785d6af9..194d8c9291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ - Dedicated error message for passing a braced ident to something expected to be a record. https://github.com/rescript-lang/rescript/pull/7806 - Hint about partial application when missing required argument in function call. https://github.com/rescript-lang/rescript/pull/7807 - More autocomplete improvements involving modules and module types. https://github.com/rescript-lang/rescript/pull/7795 +- Autocomplete `@react.componentWithProps` attribute. https://github.com/rescript-lang/rescript/pull/7812 #### :house: Internal diff --git a/analysis/src/CompletionDecorators.ml b/analysis/src/CompletionDecorators.ml index 5ed945c178..ffe18ed7d8 100644 --- a/analysis/src/CompletionDecorators.ml +++ b/analysis/src/CompletionDecorators.ml @@ -173,6 +173,24 @@ Note: The `@react.component` decorator requires the `jsx` config to be set in yo [ {|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). +You will need this decorator whenever you want to use a JSX component in ReScript JSX expressions.|}; + ] ); + ( "react.componentWithProps", + None, + [ + {|The `@react.componentWithProps` decorator is used to annotate functions that are RescriptReact components. + +You will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions. + +Note: The `@react.componentWithProps` decorator requires the `jsx` config to be set in your `rescript.json` to enable the required React transformations. + +[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-with-props-decorator).|}; + ] ); + ( "jsx.componentWithProps", + None, + [ + {|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). + You will need this decorator whenever you want to use a JSX component in ReScript JSX expressions.|}; ] ); ( "return", diff --git a/tests/analysis_tests/tests/src/expected/Completion.res.txt b/tests/analysis_tests/tests/src/expected/Completion.res.txt index a9cdb7bc6c..3edec6bd90 100644 --- a/tests/analysis_tests/tests/src/expected/Completion.res.txt +++ b/tests/analysis_tests/tests/src/expected/Completion.res.txt @@ -806,6 +806,13 @@ Resolved opens 1 Stdlib "detail": "", "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)."}, "insertTextFormat": 2 + }, { + "label": "react.componentWithProps", + "kind": 4, + "tags": [], + "detail": "", + "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)."}, + "insertTextFormat": 2 }] Complete src/Completion.res 68:10 @@ -822,6 +829,13 @@ Resolved opens 1 Stdlib "detail": "", "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)."}, "insertTextFormat": 2 + }, { + "label": "componentWithProps", + "kind": 4, + "tags": [], + "detail": "", + "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)."}, + "insertTextFormat": 2 }] Complete src/Completion.res 71:27