Skip to content

Commit 2e28933

Browse files
authored
Vendor Jason library (#258)
* Vendor Jason library Vendor the Jason library so that the version of Jason used by ElixirLS does not conflict with the version used by the end-users code. Right now one will win out over the other which can lead to issues. Luckily since Jason has been pretty stable there haven't been too many issues up to this point. Fixes #253 * remove jason from mix.lock
1 parent d61256b commit 2e28933

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

apps/elixir_ls_utils/lib/packet_stream.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ defmodule ElixirLS.Utils.PacketStream do
5252
if body == :eof do
5353
:eof
5454
else
55-
Jason.decode!(body)
55+
JasonVendored.decode!(body)
5656
end
5757
end
5858
end

apps/elixir_ls_utils/lib/wire_protocol.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule ElixirLS.Utils.WireProtocol do
66

77
def send(packet) do
88
pid = Process.whereis(:raw_user) || Process.group_leader()
9-
body = Jason.encode!(packet) <> "\r\n\r\n"
9+
body = JasonVendored.encode!(packet) <> "\r\n\r\n"
1010
IO.binwrite(pid, "Content-Length: #{byte_size(body)}\r\n\r\n" <> body)
1111
end
1212

apps/elixir_ls_utils/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule ElixirLS.Utils.Mixfile do
2626

2727
defp deps do
2828
[
29-
{:jason, "~> 1.2"},
29+
{:jason_vendored, github: "elixir-lsp/jason", branch: "vendored"},
3030
{:mix_task_archive_deps, github: "JakeBecker/mix_task_archive_deps"}
3131
]
3232
end

apps/elixir_ls_utils/test/support/packet_capture.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ defmodule ElixirLS.Utils.PacketCapture do
4949

5050
defp extract_packet(str) do
5151
with [_header, body] <- String.split(str, "\r\n\r\n", parts: 2),
52-
{:ok, packet} <- Jason.decode(body) do
52+
{:ok, packet} <- JasonVendored.decode(body) do
5353
packet
5454
else
5555
_ -> nil

apps/language_server/lib/language_server/protocol/document_symbol.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ defmodule ElixirLS.LanguageServer.Protocol.DocumentSymbol do
44
55
For details see https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol
66
"""
7-
@derive Jason.Encoder
7+
@derive JasonVendored.Encoder
88
defstruct [:name, :kind, :range, :selectionRange, :children]
99
end

apps/language_server/lib/language_server/protocol/location.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ defmodule ElixirLS.LanguageServer.Protocol.Location do
44
55
For details see https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#location
66
"""
7-
@derive Jason.Encoder
7+
@derive JasonVendored.Encoder
88
defstruct [:uri, :range]
99
end

apps/language_server/lib/language_server/protocol/symbol_information.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ defmodule ElixirLS.LanguageServer.Protocol.SymbolInformation do
44
55
For details see https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol
66
"""
7-
@derive Jason.Encoder
7+
@derive JasonVendored.Encoder
88
defstruct [:name, :kind, :location, :containerName]
99
end

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
77
"forms": {:hex, :forms, "0.0.1", "45f3b10b6f859f95f2c2c1a1de244d63855296d55ed8e93eb0dd116b3e86c4a6", [:rebar3], [], "hexpm", "530f63ed8ed5a171f744fc75bd69cb2e36496899d19dbef48101b4636b795868"},
88
"getopt": {:hex, :getopt, "1.0.1", "c73a9fa687b217f2ff79f68a3b637711bb1936e712b521d8ce466b29cbf7808a", [:rebar3], [], "hexpm", "53e1ab83b9ceb65c9672d3e7a35b8092e9bdc9b3ee80721471a161c10c59959c"},
9-
"jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"},
9+
"jason_vendored": {:git, "https://github.com/elixir-lsp/jason.git", "ee95ca80cd67b3a499a14f469536140935eb4483", [branch: "vendored"]},
1010
"mix_task_archive_deps": {:git, "https://github.com/JakeBecker/mix_task_archive_deps.git", "50301a4314e3cc1104f77a8208d5b66ee382970b", []},
1111
"providers": {:hex, :providers, "1.8.1", "70b4197869514344a8a60e2b2a4ef41ca03def43cfb1712ecf076a0f3c62f083", [:rebar3], [{:getopt, "1.0.1", [hex: :getopt, repo: "hexpm", optional: false]}], "hexpm", "e45745ade9c476a9a469ea0840e418ab19360dc44f01a233304e118a44486ba0"},
1212
}

0 commit comments

Comments
 (0)