Skip to content

Add test cases for completion of react.component #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2021
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
9 changes: 9 additions & 0 deletions analysis/src/NewCompletions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,15 @@ let processCompletable ~findItems ~package ~rawOpens
"variadic";
]
|> List.filter (fun decorator -> Utils.startsWith decorator prefix)
|> List.map (fun decorator ->
let parts = String.split_on_char '.' prefix in
let len = String.length prefix in
let dec2 =
if List.length parts > 1 then
String.sub decorator len (String.length decorator - len)
else decorator
in
dec2)
|> List.map mkDecorator
| Clabel (funPath, prefix) ->
let labels =
Expand Down
5 changes: 4 additions & 1 deletion analysis/tests/src/Complete.res
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@ let zzz = 11

//^com let comp = <O.Comp z

//^doc

//^doc
//^com @reac

//^com @react.
18 changes: 18 additions & 0 deletions analysis/tests/src/expected/Complete.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,21 @@ DocumentSymbol tests/src/Complete.res
}
]

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

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