File tree 7 files changed +40
-18
lines changed
7 files changed +40
-18
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,9 @@ let hover ~file ~line ~col ~extra ~package =
70
70
match uriLocOpt with
71
71
| None -> false
72
72
| Some (_ , loc ) ->
73
+ let isInterface = file.uri |> Uri2. isInterface in
73
74
let posIsZero {Lexing. pos_lnum; pos_bol; pos_cnum} =
74
- pos_lnum = 1 && pos_cnum - pos_bol = 0
75
+ ( not isInterface) && pos_lnum = 1 && pos_cnum - pos_bol = 0
75
76
in
76
77
(* Skip if range is all zero, unless it's a module *)
77
78
(not locIsModule) && posIsZero loc.loc_start && posIsZero loc.loc_end
@@ -111,8 +112,9 @@ let definition ~file ~line ~col ~extra ~package =
111
112
match uriLocOpt with
112
113
| None -> Protocol. null
113
114
| Some (uri2 , loc ) ->
115
+ let isInterface = file.uri |> Uri2. isInterface in
114
116
let posIsZero {Lexing. pos_lnum; pos_bol; pos_cnum} =
115
- pos_lnum = 1 && pos_cnum - pos_bol = 0
117
+ ( not isInterface) && pos_lnum = 1 && pos_cnum - pos_bol = 0
116
118
in
117
119
(* Skip if range is all zero, unless it's a module *)
118
120
let skipZero =
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ module Uri : sig
5
5
6
6
val fromPath : string -> t
7
7
8
+ val isInterface : t -> bool
9
+
8
10
val stripPath : bool ref
9
11
10
12
val toPath : t -> string
@@ -30,6 +32,8 @@ end = struct
30
32
let path = Files. maybeConcat (Unix. getcwd () ) localPath in
31
33
fromPath path
32
34
35
+ let isInterface {path} = Filename. check_suffix path " i"
36
+
33
37
let toPath {path} = path
34
38
35
39
let toString {uri} = if ! stripPath then Filename. basename uri else uri
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ function exp {
2
2
echo " $( dirname $1 ) /expected/$( basename $1 ) .txt"
3
3
}
4
4
5
- for file in tests/src/* .res; do
5
+ for file in tests/src/* .res[i] ; do
6
6
./run.exe test $file & > $( exp $file )
7
7
done
8
8
Original file line number Diff line number Diff line change 1
1
module M = {
2
2
@react.component
3
- let make = (~first , ~fun = "" , ~second = "" ) => React .string (first ++ fun ++ second )
3
+ let make = (~first , ~fun = "" , ~second = "" ) => React .string (first ++ fun ++ second )
4
4
}
5
5
6
- let d = <M first = "abc" />
6
+ let _ = <M first = "abc" />
7
7
// ^def
8
8
9
9
//^com <M second=fi
10
10
11
-
12
11
//^com <M second="abc" f
13
12
14
13
//^com let e = <M
14
+
15
+ @react.component
16
+ let make = (~first ) => React .string (first )
17
+
18
+ let y = 44
Original file line number Diff line number Diff line change
1
+ @react.component
2
+ let make: (~first: string) => React.element
3
+ // ^hov
4
+
5
+ let y : int
6
+ // ^hov
Original file line number Diff line number Diff line change @@ -9,26 +9,26 @@ Complete tests/src/Jsx.res 7:2
9
9
"detail": "string",
10
10
"documentation": null
11
11
}, {
12
- "label": "first ",
12
+ "label": "second ",
13
13
"kind": 4,
14
14
"tags": [],
15
- "detail": "string",
15
+ "detail": "option< string> ",
16
16
"documentation": null
17
17
}, {
18
- "label": "fun ",
18
+ "label": "first ",
19
19
"kind": 4,
20
20
"tags": [],
21
- "detail": "option< string> ",
21
+ "detail": "string",
22
22
"documentation": null
23
23
}, {
24
- "label": "second ",
24
+ "label": "fun ",
25
25
"kind": 4,
26
26
"tags": [],
27
27
"detail": "option<string>",
28
28
"documentation": null
29
29
}]
30
30
31
- Complete tests/src/Jsx.res 10 :2
31
+ Complete tests/src/Jsx.res 9 :2
32
32
[{
33
33
"label": "key",
34
34
"kind": 4,
@@ -49,27 +49,27 @@ Complete tests/src/Jsx.res 10:2
49
49
"documentation": null
50
50
}]
51
51
52
- Complete tests/src/Jsx.res 12 :2
52
+ Complete tests/src/Jsx.res 11 :2
53
53
[{
54
54
"label": "key",
55
55
"kind": 4,
56
56
"tags": [],
57
57
"detail": "string",
58
58
"documentation": null
59
59
}, {
60
- "label": "first ",
60
+ "label": "second ",
61
61
"kind": 4,
62
62
"tags": [],
63
- "detail": "string",
63
+ "detail": "option< string> ",
64
64
"documentation": null
65
65
}, {
66
- "label": "fun ",
66
+ "label": "first ",
67
67
"kind": 4,
68
68
"tags": [],
69
- "detail": "option< string> ",
69
+ "detail": "string",
70
70
"documentation": null
71
71
}, {
72
- "label": "second ",
72
+ "label": "fun ",
73
73
"kind": 4,
74
74
"tags": [],
75
75
"detail": "option<string>",
Original file line number Diff line number Diff line change
1
+ Hover tests/src/Jsx.resi 1:4
2
+ {"contents": "```rescript\n(~first: string, ~?key: string, unit) => {\"first\": string}\n```"}
3
+
4
+ Hover tests/src/Jsx.resi 4:4
5
+ {"contents": "```rescript\nint\n```"}
6
+
You can’t perform that action at this time.
0 commit comments