diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2639d98..a61da9051 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - 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. +- Fix issue with autocomplete then punned props are used in JSX. E.g. ``. - Add autocompletion for object access of the form foo["bar"]. ## 1.1.3 diff --git a/analysis/src/PartialParser.ml b/analysis/src/PartialParser.ml index c4c0174e2..0c4be6692 100644 --- a/analysis/src/PartialParser.ml +++ b/analysis/src/PartialParser.ml @@ -143,16 +143,16 @@ let findJsxContext text offset = match ident.[0] with | ('a' .. 'z' | 'A' .. 'Z') when i1 >= 1 && text.[i1 - 1] = '<' -> Some (ident, identsSeen) - | _ -> beforeIdent identsSeen (i1 - 1) + | _ -> beforeIdent ~ident identsSeen (i1 - 1) else None else None - and beforeIdent identsSeen i = + and beforeIdent ~ident identsSeen i = let i = skipWhite text i in if i > 0 then match text.[i] with | '?' -> fromEquals identsSeen (i - 1) | '=' -> fromEquals identsSeen i - | _ -> loop identsSeen (i - 1) + | _ -> (* punning *) loop (ident :: identsSeen) i else None and beforeParen identsSeen i = let i = skipWhite text i in diff --git a/analysis/tests/src/Jsx.res b/analysis/tests/src/Jsx.res index df09a09f9..f9438a22a 100644 --- a/analysis/tests/src/Jsx.res +++ b/analysis/tests/src/Jsx.res @@ -52,3 +52,5 @@ module Ext = { let _ = (Ext.make, Ext.makeProps) //^com ", + "documentation": null + }, { + "label": "fun", + "kind": 4, + "tags": [], + "detail": "option", + "documentation": null + }, { + "label": "key", + "kind": 4, + "tags": [], + "detail": "string", + "documentation": null + }] +