Skip to content

Commit c79a8f9

Browse files
committed
Add tests for code lenses.
1 parent d64ed9a commit c79a8f9

File tree

6 files changed

+31
-8
lines changed

6 files changed

+31
-8
lines changed

analysis/src/Commands.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ let test ~path =
395395
let line_end = 6 in
396396
print_endline ("Inlay Hint " ^ path ^ " " ^ string_of_int line_start ^ ":" ^ string_of_int line_end);
397397
inlayhint ~path ~pos:(line_start, line_end) ~maxLength:"25" ~debug:false)
398-
| "clens" ->
398+
| "cle" ->
399399
print_endline ("Code Lens " ^ path);
400400
codeLens ~path ~debug:false
401401
| _ -> ());

analysis/src/Protocol.ml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ let stringifyHint hint =
150150
(Json.escape hint.label) hint.kind hint.paddingLeft hint.paddingRight
151151

152152
let stringifyCommand (command : command) =
153-
Printf.sprintf
154-
{|{
155-
"title": "%s",
156-
"command": "%s"
157-
}|}
153+
Printf.sprintf {|{"title": "%s", "command": "%s"}|}
158154
(Json.escape command.title)
159155
(Json.escape command.command)
160156

analysis/tests/src/CodeLens.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
let add = (x, y) => x + y
2+
3+
let foo = (~age, ~name) => name ++ string_of_int(age)
4+
5+
let ff = (~opt1=0, ~a, ~b, (), ~opt2=0, (), ~c) => a + b + c + opt1 + opt2
6+
7+
let compFF = Completion.ff
8+
9+
@react.component
10+
let make = (~name) => React.string(name)
11+
//^cle
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Code Lens src/CodeLens.res
2+
[{
3+
"range": {"start": {"line": 9, "character": 4}, "end": {"line": 9, "character": 8}},
4+
"command": {"title": "{\"name\": string} => React.element", "command": ""}
5+
}, {
6+
"range": {"start": {"line": 4, "character": 4}, "end": {"line": 4, "character": 6}},
7+
"command": {"title": "(~opt1: int=?, ~a: int, ~b: int, unit, ~opt2: int=?, unit, ~c: int) => int", "command": ""}
8+
}, {
9+
"range": {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 7}},
10+
"command": {"title": "(~age: int, ~name: string) => string", "command": ""}
11+
}, {
12+
"range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 7}},
13+
"command": {"title": "(int, int) => int", "command": ""}
14+
}]
15+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
DCE src/Dce.res
2-
issues:243
2+
issues:249
33

analysis/tests/src/expected/Debug.res.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Dependencies: @rescript/react
44
Source directories: ./node_modules/@rescript/react/src ./node_modules/@rescript/react/src/legacy
55
Source files: ./node_modules/@rescript/react/src/React.res ./node_modules/@rescript/react/src/ReactDOM.res ./node_modules/@rescript/react/src/ReactDOMServer.res ./node_modules/@rescript/react/src/ReactDOMStyle.res ./node_modules/@rescript/react/src/ReactEvent.res ./node_modules/@rescript/react/src/ReactEvent.resi ./node_modules/@rescript/react/src/ReactTestUtils.res ./node_modules/@rescript/react/src/ReactTestUtils.resi ./node_modules/@rescript/react/src/RescriptReactErrorBoundary.res ./node_modules/@rescript/react/src/RescriptReactErrorBoundary.resi ./node_modules/@rescript/react/src/RescriptReactRouter.res ./node_modules/@rescript/react/src/RescriptReactRouter.resi ./node_modules/@rescript/react/src/legacy/ReactDOMRe.res ./node_modules/@rescript/react/src/legacy/ReasonReact.res
66
Source directories: ./src ./src/expected
7-
Source files: ./src/Auto.res ./src/CompletePrioritize1.res ./src/CompletePrioritize2.res ./src/Completion.res ./src/Component.res ./src/Component.resi ./src/CreateInterface.res ./src/Cross.res ./src/Dce.res ./src/Debug.res ./src/Definition.res ./src/DefinitionWithInterface.res ./src/DefinitionWithInterface.resi ./src/Div.res ./src/DocumentSymbol.res ./src/Fragment.res ./src/Highlight.res ./src/Hover.res ./src/InlayHint.res ./src/Jsx.res ./src/Jsx.resi ./src/LongIdentTest.res ./src/Object.res ./src/Patterns.res ./src/RecModules.res ./src/RecordCompletion.res ./src/RecoveryOnProp.res ./src/References.res ./src/ReferencesWithInterface.res ./src/ReferencesWithInterface.resi ./src/Rename.res ./src/RenameWithInterface.res ./src/RenameWithInterface.resi ./src/TableclothMap.ml ./src/TableclothMap.mli ./src/TypeDefinition.res ./src/Xform.res
7+
Source files: ./src/Auto.res ./src/CodeLens.res ./src/CompletePrioritize1.res ./src/CompletePrioritize2.res ./src/Completion.res ./src/Component.res ./src/Component.resi ./src/CreateInterface.res ./src/Cross.res ./src/Dce.res ./src/Debug.res ./src/Definition.res ./src/DefinitionWithInterface.res ./src/DefinitionWithInterface.resi ./src/Div.res ./src/DocumentSymbol.res ./src/Fragment.res ./src/Highlight.res ./src/Hover.res ./src/InlayHint.res ./src/Jsx.res ./src/Jsx.resi ./src/LongIdentTest.res ./src/Object.res ./src/Patterns.res ./src/RecModules.res ./src/RecordCompletion.res ./src/RecoveryOnProp.res ./src/References.res ./src/ReferencesWithInterface.res ./src/ReferencesWithInterface.resi ./src/Rename.res ./src/RenameWithInterface.res ./src/RenameWithInterface.resi ./src/TableclothMap.ml ./src/TableclothMap.mli ./src/TypeDefinition.res ./src/Xform.res
88
Impl cmt:./lib/bs/src/Auto.cmt res:./src/Auto.res
9+
Impl cmt:./lib/bs/src/CodeLens.cmt res:./src/CodeLens.res
910
Impl cmt:./lib/bs/src/CompletePrioritize1.cmt res:./src/CompletePrioritize1.res
1011
Impl cmt:./lib/bs/src/CompletePrioritize2.cmt res:./src/CompletePrioritize2.res
1112
Impl cmt:./lib/bs/src/Completion.cmt res:./src/Completion.res

0 commit comments

Comments
 (0)