File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
apps/language_server/lib/language_server/providers/plugins Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ defmodule ElixirLS.LanguageServer.Plugins.Ecto do
6
6
alias ElixirLS.LanguageServer.Plugins.Ecto.Query
7
7
alias ElixirLS.LanguageServer.Plugins.Ecto.Schema
8
8
alias ElixirLS.LanguageServer.Plugins.Ecto.Types
9
+ require Logger
9
10
10
11
@ behaviour ElixirLS.LanguageServer.Plugin
11
12
use ElixirLS.LanguageServer.Providers.Completion.GenericReducer
@@ -131,6 +132,19 @@ defmodule ElixirLS.LanguageServer.Plugins.Ecto do
131
132
end
132
133
133
134
defp after_in? ( hint , text_before ) do
134
- Regex . match? ( ~r/ \s +in\s +#{ Regex . escape ( hint ) } $/ u , text_before )
135
+ try do
136
+ Regex . match? ( ~r/ \s +in\s +#{ Regex . escape ( hint ) } $/ u , text_before )
137
+ rescue
138
+ e in ErlangError ->
139
+ # Generating regex from client code is generally unsafe. One way it can fail is
140
+ # (ErlangError) Erlang error: :internal_error
141
+ # unexpected response code from PCRE engine
142
+
143
+ Logger . warning (
144
+ "Unable to determine if cursor is after `in` in #{ inspect ( hint ) } : #{ Exception . format ( :error , e , __STACKTRACE__ ) } "
145
+ )
146
+
147
+ false
148
+ end
135
149
end
136
150
end
You can’t perform that action at this time.
0 commit comments