Skip to content

Commit 7b08d87

Browse files
author
EduardoRFS
authored
Fix: URI from LSP is decoded properly (#392)
1 parent e20ff8e commit 7b08d87

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@opam/ppxlib": "*",
3030
"@opam/reason": ">= 3.5.0",
3131
"@opam/stdlib-shims": "*",
32+
"@opam/uri": "3.1.0",
3233
"@reason-native/pastel": "^0.2.2",
3334
"@reason-native/rely": "^3.1.0",
3435
"ocaml": "~4.8.1000",

util/Utils.re

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ let parseWindowsUri = withoutScheme => {
130130
|> String.concat({|\|})
131131
};
132132

133-
let parseUri = (uri) =>
134-
if (startsWith(uri, "file://")) {
135-
let withoutScheme = sliceToEnd(uri, String.length("file://"));
133+
let parseUri = (uri) => {
134+
let withoutPct = Uri.pct_decode(uri);
135+
if (startsWith(withoutPct, "file://")) {
136+
let withoutScheme = sliceToEnd(withoutPct, String.length("file://"));
137+
136138
if (Sys.os_type == "Unix") {
137139
Some(withoutScheme)
138140
} else {
@@ -141,6 +143,7 @@ let parseUri = (uri) =>
141143
} else {
142144
None
143145
};
146+
}
144147

145148
let locationOffset = (loc, start, length) =>
146149
Location.{

util/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(library
22
(name Util)
33
(public_name reason-language-server.Util)
4-
(libraries Belt Vendor str)
4+
(libraries Belt Vendor str uri)
55
(flags :standard -open Vendor -w -9)
66
(preprocess (pps Belt_ppx Ppx_monads))
77
)

0 commit comments

Comments
 (0)