diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c35222f1..e54de7c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## master - +- Fix issue in JSX autocomplete when the component is declared external. - Fix jump-to-definition for uncurried calls. - Fix issue where values for autocomplete were pulled from implementations instead of interfaces. diff --git a/analysis/src/NewCompletions.ml b/analysis/src/NewCompletions.ml index a8f384750..cdfc9e542 100644 --- a/analysis/src/NewCompletions.ml +++ b/analysis/src/NewCompletions.ml @@ -914,6 +914,19 @@ let processCompletable ~findItems ~full ~package ~rawOpens _, _ ) -> getFields tObj + | Tconstr + ( path, + [ + { + desc = + ( Tconstr (* Js.t *) (_, [{desc = Tobject (tObj, _)}], _) + | Tobject (tObj, _) ); + }; + _; + ], + _ ) + when Path.name path = "React.componentLike" -> + getFields tObj | _ -> [] in typ |> getLabels diff --git a/analysis/tests/src/Jsx.res b/analysis/tests/src/Jsx.res index 849777079..4fbfd5a33 100644 --- a/analysis/tests/src/Jsx.res +++ b/analysis/tests/src/Jsx.res @@ -42,4 +42,13 @@ let y = 44 //^com -// ^def \ No newline at end of file +// ^def + +module Ext = { + @react.component @module("@material-ui/core") + external make: (~align: string=?) => React.element = "Typography" +} + +let _extMake = Ext.make + +//^com ", + "documentation": null + }, { + "label": "key", + "kind": 4, + "tags": [], + "detail": "string", + "documentation": null + }] +