Skip to content

Commit 4b22d7e

Browse files
committed
workaround a crash when elixir compiler emits diagnostic with invalid description
1 parent 5cc2290 commit 4b22d7e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/language_server/lib/language_server/diagnostics.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,13 @@ defmodule ElixirLS.LanguageServer.Diagnostics do
492492
]
493493

494494
{:error, %{description: description}} ->
495-
get_related_information_description(description, uri, source_file) ++
495+
if String.valid?(description) do
496+
get_related_information_description(description, uri, source_file)
497+
else
498+
# SyntaxError can contain invalid UTF8 binaries in `description`
499+
# noticed on elixir 1.15.7
500+
[]
501+
end ++
496502
get_related_information_message(diagnostic.message, uri, source_file)
497503

498504
_ ->

0 commit comments

Comments
 (0)