diff --git a/lib/typeprof/lsp/server.rb b/lib/typeprof/lsp/server.rb index 0d0d11e2..3fd9419f 100644 --- a/lib/typeprof/lsp/server.rb +++ b/lib/typeprof/lsp/server.rb @@ -1,3 +1,5 @@ +require "cgi" + module TypeProf::LSP module ErrorCodes ParseError = -32700 @@ -65,11 +67,11 @@ def initialize(core_options, reader, writer, url_schema: nil, publish_all_diagno #: (String) -> String def path_to_uri(path) - @url_schema + File.expand_path(path) + @url_schema + File.expand_path(path).split("/").map {|s| CGI.escapeURIComponent(s) }.join("/") end - def uri_to_path(url) - url.delete_prefix(@url_schema) + def uri_to_path(uri) + uri.delete_prefix(@url_schema).split("/").map {|s| CGI.unescapeURIComponent(s) }.join("/") end #: (Array[String]) -> void