Skip to content

Commit

Permalink
move to context and using Code.Fragment.cursor_context/1
Browse files Browse the repository at this point in the history
  • Loading branch information
oo6 committed Jun 24, 2023
1 parent 050dd67 commit d2af014
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
text_before_cursor: text_before_cursor,
text_after_cursor: text_after_cursor,
prefix: prefix,
remote_calls?: match?({:dot, _, _}, Code.Fragment.cursor_context(prefix)),
def_before: def_before,
pipe_before?: Regex.match?(Regex.recompile!(~r/\|>\s*#{prefix}$/), text_before_cursor),
capture_before?: Regex.match?(Regex.recompile!(~r/&#{prefix}$/), text_before_cursor),
Expand Down Expand Up @@ -1030,7 +1031,7 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
} = info

%{
prefix: prefix,
remote_calls?: remote_calls?,
pipe_before?: pipe_before?,
capture_before?: capture_before?,
text_after_cursor: text_after_cursor
Expand All @@ -1039,8 +1040,6 @@ defmodule ElixirLS.LanguageServer.Providers.Completion do
locals_without_parens = Keyword.get(options, :locals_without_parens)
signature_help_supported? = Keyword.get(options, :signature_help_supported, false)
signature_after_complete? = Keyword.get(options, :signature_after_complete, true)

remote_calls? = String.contains?(prefix, ".")
with_parens? = remote_calls? || function_name_with_parens?(name, arity, locals_without_parens)

trigger_signature? = signature_help_supported? && ((arity == 1 && !pipe_before?) || arity > 1)
Expand Down

0 comments on commit d2af014

Please sign in to comment.