File tree Expand file tree Collapse file tree 5 files changed +9
-28
lines changed Expand file tree Collapse file tree 5 files changed +9
-28
lines changed Original file line number Diff line number Diff line change 5
5
- Add autocompletion for object access of the form ` foo["x"] ` and ` foo["x"]["y"]["z"] ` .
6
6
- Fix issue with autocomplete then punned props are used in JSX. E.g. ` <M foo ...> ` .
7
7
- Fix issue with JSX autocompletion not working after ` foo=#variant ` .
8
+ - Fix issue in JSX autocompletion where the ` key ` label would always appear.
8
9
9
10
## 1.1.3
10
11
Original file line number Diff line number Diff line change @@ -879,14 +879,16 @@ let processCompletable ~findItems ~full ~package ~rawOpens
879
879
mkItem ~name ~kind: 4 ~deprecated: None ~detail: typString ~docstring: []
880
880
in
881
881
let mkLabel (name , typ ) = mkLabel_ name typ in
882
- let keyLabel = mkLabel_ " key" " string" in
882
+ let keyLabels =
883
+ if Utils. startsWith " key" prefix then [mkLabel_ " key" " string" ] else []
884
+ in
883
885
if domLabels = [] then []
884
886
else
885
887
(domLabels
886
888
|> List. filter (fun (name , _t ) ->
887
889
Utils. startsWith name prefix && not (List. mem name identsSeen))
888
890
|> List. map mkLabel)
889
- @ [keyLabel]
891
+ @ keyLabels
890
892
| Cjsx (componentPath , prefix , identsSeen ) ->
891
893
let items = findItems ~exact: true (componentPath @ [" make" ]) in
892
894
let labels =
@@ -936,14 +938,16 @@ let processCompletable ~findItems ~full ~package ~rawOpens
936
938
mkItem ~name ~kind: 4 ~deprecated: None ~detail: typString ~docstring: []
937
939
in
938
940
let mkLabel (name , typ ) = mkLabel_ name (typ |> Shared. typeToString) in
939
- let keyLabel = mkLabel_ " key" " string" in
941
+ let keyLabels =
942
+ if Utils. startsWith " key" prefix then [mkLabel_ " key" " string" ] else []
943
+ in
940
944
if labels = [] then []
941
945
else
942
946
(labels
943
947
|> List. filter (fun (name , _t ) ->
944
948
Utils. startsWith name prefix && not (List. mem name identsSeen))
945
949
|> List. map mkLabel)
946
- @ [keyLabel]
950
+ @ keyLabels
947
951
| Cpath parts ->
948
952
let items = parts |> findItems ~exact: false in
949
953
(* TODO(#107): figure out why we're getting duplicates. *)
Original file line number Diff line number Diff line change @@ -446,12 +446,6 @@ Complete tests/src/Completion.res 52:2
446
446
"tags": [],
447
447
"detail": "option<int>",
448
448
"documentation": null
449
- }, {
450
- "label": "key",
451
- "kind": 4,
452
- "tags": [],
453
- "detail": "string",
454
- "documentation": null
455
449
}]
456
450
457
451
DocumentSymbol tests/src/Completion.res
Original file line number Diff line number Diff line change @@ -8,11 +8,5 @@ Complete tests/src/Div.res 3:3
8
8
"tags": [],
9
9
"detail": "{\"__html\": string}",
10
10
"documentation": null
11
- }, {
12
- "label": "key",
13
- "kind": 4,
14
- "tags": [],
15
- "detail": "string",
16
- "documentation": null
17
11
}]
18
12
Original file line number Diff line number Diff line change @@ -35,12 +35,6 @@ Complete tests/src/Jsx.res 9:2
35
35
"tags": [],
36
36
"detail": "option<string>",
37
37
"documentation": null
38
- }, {
39
- "label": "key",
40
- "kind": 4,
41
- "tags": [],
42
- "detail": "string",
43
- "documentation": null
44
38
}]
45
39
46
40
Complete tests/src/Jsx.res 11:2
@@ -182,12 +176,6 @@ Complete tests/src/Jsx.res 52:2
182
176
"tags": [],
183
177
"detail": "option<string>",
184
178
"documentation": null
185
- }, {
186
- "label": "key",
187
- "kind": 4,
188
- "tags": [],
189
- "detail": "string",
190
- "documentation": null
191
179
}]
192
180
193
181
Complete tests/src/Jsx.res 54:2
You can’t perform that action at this time.
0 commit comments