Skip to content

Commit

Permalink
[lsp] generate proto only once
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored and andreypopp committed Oct 21, 2019
1 parent 3952841 commit 94306e0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lsp/src/lsp/uri.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ type t = string [@@deriving yojson { strict = false }]

let to_string uri = uri

let proto =
match Sys.win32 with
| true -> "file:///"
| false -> "file://"

let to_path (uri : t) =
let proto =
match Sys.win32 with
| true -> "file:///"
| false -> "file://"
in
let path =
match Std.String.chop_prefix ~prefix:proto uri with
| Some path -> path
Expand All @@ -18,10 +18,6 @@ let to_path (uri : t) =
|> Std.String.replace_all ~pattern:"%5C" ~with_:"/"

let of_path (path : string) =
let proto = match Sys.win32 with
| true -> "file:///"
| false -> "file://"
in
let path =
path
|> Std.String.replace_all ~pattern:"\\" ~with_:"/"
Expand Down

0 comments on commit 94306e0

Please sign in to comment.