Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fix issue where values for autocomplete were pulled from implementations instead of interfaces.
- Add autocompletion for object access of the form foo["bar"].
- Fix issue with autocomplete then punned props are used in JSX. E.g. `<M foo ...>`.
- Fix issue with JSX autocompletion not working after `foo=#variant`.

## 1.1.3

Expand Down
7 changes: 5 additions & 2 deletions analysis/src/PartialParser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ let skipOptVariantExtension text i =
Find JSX context ctx for component M to autocomplete id (already parsed) as a prop.
ctx ::= <M args id
arg ::= id | id = [?] atomicExpr
atomicExpr ::= id | "abc" | 'a' | 42 | `...` | optVariant {...} | optVariant (...) | <...> | [...]
atomicExpr ::= id | #id | "abc" | 'a' | 42 | `...` | optVariant {...} | optVariant (...) | <...> | [...]
optVariant ::= id | #id | %id | _nothing_
*)
let findJsxContext text offset =
Expand Down Expand Up @@ -143,7 +143,10 @@ let findJsxContext text offset =
match ident.[0] with
| ('a' .. 'z' | 'A' .. 'Z') when i1 >= 1 && text.[i1 - 1] = '<' ->
Some (ident, identsSeen)
| _ -> beforeIdent ~ident identsSeen (i1 - 1)
| _ ->
if i1 >= 1 && text.[i1 - 1] = '#' then
beforeValue identsSeen (i1 - 2)
else beforeIdent ~ident identsSeen (i1 - 1)
else None
else None
and beforeIdent ~ident identsSeen i =
Expand Down
4 changes: 4 additions & 0 deletions analysis/tests/src/Jsx.res
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ let _ = (Ext.make, Ext.makeProps)
//^com <Ext al

//^com <M first

//^com <M first=#a k

//^com <M first = ? #a k
18 changes: 18 additions & 0 deletions analysis/tests/src/expected/Jsx.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,21 @@ Complete tests/src/Jsx.res 54:2
"documentation": null
}]

Complete tests/src/Jsx.res 56:2
[{
"label": "key",
"kind": 4,
"tags": [],
"detail": "string",
"documentation": null
}]

Complete tests/src/Jsx.res 58:2
[{
"label": "key",
"kind": 4,
"tags": [],
"detail": "string",
"documentation": null
}]