Skip to content

Commit

Permalink
fix crash in phoenix scopes when parse fails
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Jan 21, 2024
1 parent 95e6ce4 commit 430bb2e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/elixir_sense/plugins/phoenix/scope.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ defmodule ElixirSense.Plugins.Phoenix.Scope do
alias ElixirSense.Core.Binding

def within_scope(buffer, binding_env \\ %Binding{}) do
{:ok, ast} = Code.Fragment.container_cursor_to_quoted(buffer)

with {true, scopes_ast} <- get_scopes(ast),
with {:ok, ast} <- Code.Fragment.container_cursor_to_quoted(buffer),
{true, scopes_ast} <- get_scopes(ast),
scopes_ast = Enum.reverse(scopes_ast),
scope_alias <- get_scope_alias(scopes_ast, binding_env) do
{true, scope_alias}
else
_ -> {false, nil}
end
end

Expand Down

0 comments on commit 430bb2e

Please sign in to comment.