Skip to content

Commit 41fbf07

Browse files
Use canonicalized URIs/paths for jump to definition
1 parent d402233 commit 41fbf07

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

analysis/src/Commands.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ let definition ~path ~pos ~debug =
110110
&& posIsZero loc.loc_end
111111
in
112112
if skipLoc then None
113-
else
113+
else
114114
Some
115-
{Protocol.uri = Uri.toString uri; range = Utils.cmtLocToRange loc}
115+
{Protocol.uri = Files.canonicalizeUri uri; range = Utils.cmtLocToRange loc}
116116
| Some _ -> None))
117117
in
118118
print_endline
@@ -132,7 +132,7 @@ let typeDefinition ~path ~pos ~debug =
132132
| None -> None
133133
| Some (uri, loc) ->
134134
Some
135-
{Protocol.uri = Uri.toString uri; range = Utils.cmtLocToRange loc}))
135+
{Protocol.uri = Files.canonicalizeUri uri; range = Utils.cmtLocToRange loc}))
136136
in
137137
print_endline
138138
(match maybeLocation with

analysis/src/Files.ml

+2
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,5 @@ let classifySourceFile path =
102102
if Filename.check_suffix path ".res" && exists path then Res
103103
else if Filename.check_suffix path ".resi" && exists path then Resi
104104
else Other
105+
106+
let canonicalizeUri uri = uri |> Uri.toPath |> Unix.realpath

0 commit comments

Comments
 (0)