Skip to content

Commit

Permalink
Partially-unescape URI text
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewfraser committed Jan 28, 2019
1 parent a1c5db1 commit a5dc1ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/LSP/Ser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ let rec private deserializer<'T> (options: JsonReadOptions, t: Type): JsonValue
// It seems that the Uri(_) constructor assumes the string has already been unescaped
let escaped = j.AsString()
let unescaped = Uri.UnescapeDataString(escaped)
box(Uri(unescaped))
// This is pretty hacky but I couldn't figure out a better way
// VSCode escapes # only once, but Uri(_) expects an unescaped string
// It seems like either VSCode should be escaping # twice, or Uri(_) should be accepting escaped input
let partlyEscaped = unescaped.Replace("?", "%3F").Replace("#", "%23")
box(Uri(partlyEscaped))
elif t = typeof<JsonValue> then
fun j -> box(j)
elif isList t then
Expand Down

0 comments on commit a5dc1ba

Please sign in to comment.