Skip to content

Commit

Permalink
workaround elixir errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Jan 21, 2024
1 parent 06ed2cc commit 95e6ce4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/elixir_sense/core/normalized/code/fragment.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ defmodule ElixirSense.Core.Normalized.Code.Fragment do
opts
])
end
rescue
e in CaseClauseError ->
if Version.match?(System.version(), ">= 1.16.0-dev") do
reraise e, __STACKTRACE__
else
:none
end
end

def surround_context(fragment, position, options \\ []) do
Expand All @@ -30,6 +37,13 @@ defmodule ElixirSense.Core.Normalized.Code.Fragment do
options
])
end
rescue
e in CaseClauseError ->
if Version.match?(System.version(), ">= 1.16.0-dev") do
reraise e, __STACKTRACE__
else
:none
end
end

def container_cursor_to_quoted(fragment, opts \\ []) do
Expand All @@ -46,5 +60,12 @@ defmodule ElixirSense.Core.Normalized.Code.Fragment do
[fragment, opts]
)
end
rescue
e in MatchError ->
if Version.match?(System.version(), ">= 1.16.0-dev") do
reraise e, __STACKTRACE__
else
{:error, {[line: 1, column: 1], "", ""}}
end
end
end
7 changes: 7 additions & 0 deletions lib/elixir_sense/core/normalized/tokenizer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@ defmodule ElixirSense.Core.Normalized.Tokenizer do
{:error, _, _, _, sofar} ->
sofar
end
rescue
e in CaseClauseError ->
if Version.match?(System.version(), ">= 1.16.0-dev") do
reraise e, __STACKTRACE__
else
[]
end
end
end

0 comments on commit 95e6ce4

Please sign in to comment.