@@ -24,37 +24,3 @@ let to_top_level_loc (uri : Lsp.Uri.t) =
2424let to_string t =
2525 if ! strip_path then Filename. basename (Lsp.Uri. to_path t)
2626 else Lsp.Uri. to_string t
27-
28- (* Light weight, hopefully-enough-for-the-purpose fn to encode URI components.
29- Built to handle the reserved characters listed in
30- https://en.wikipedia.org/wiki/Percent-encoding. Note that this function is not
31- general purpose, rather it's currently only for URL encoding the argument list
32- passed to command links in markdown. *)
33- let encode_uri_component text =
34- let ln = String. length text in
35- let buf = Buffer. create ln in
36- let rec loop i =
37- if i < ln then (
38- (match text.[i] with
39- | '"' -> Buffer. add_string buf " %22"
40- | '\' ' -> Buffer. add_string buf " %22"
41- | ':' -> Buffer. add_string buf " %3A"
42- | ';' -> Buffer. add_string buf " %3B"
43- | '/' -> Buffer. add_string buf " %2F"
44- | '\\' -> Buffer. add_string buf " %5C"
45- | ',' -> Buffer. add_string buf " %2C"
46- | '&' -> Buffer. add_string buf " %26"
47- | '[' -> Buffer. add_string buf " %5B"
48- | ']' -> Buffer. add_string buf " %5D"
49- | '#' -> Buffer. add_string buf " %23"
50- | '$' -> Buffer. add_string buf " %24"
51- | '+' -> Buffer. add_string buf " %2B"
52- | '=' -> Buffer. add_string buf " %3D"
53- | '?' -> Buffer. add_string buf " %3F"
54- | '@' -> Buffer. add_string buf " %40"
55- | '%' -> Buffer. add_string buf " %25"
56- | c -> Buffer. add_char buf c);
57- loop (i + 1 ))
58- in
59- loop 0 ;
60- Buffer. contents buf
0 commit comments