File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
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 1
1
Hover tests/src/Jsx.resi 1:4
2
- null
2
+ {"contents": "```rescript\n(~first: string, ~?key: string, unit) => {\"first\": string}\n```"}
3
3
4
4
Hover tests/src/Jsx.resi 4:4
5
5
{"contents": "```rescript\nint\n```"}
You can’t perform that action at this time.
0 commit comments