From 532bf88bcc4f83366c43baa40125ea3cffb25cea Mon Sep 17 00:00:00 2001 From: Tim Gent Date: Tue, 15 Nov 2022 21:07:36 +0000 Subject: [PATCH] Simplify get_char_ident fn in rename provider --- .../lib/language_server/providers/rename.ex | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/language_server/lib/language_server/providers/rename.ex b/apps/language_server/lib/language_server/providers/rename.ex index d4588009b..24f815b3a 100644 --- a/apps/language_server/lib/language_server/providers/rename.ex +++ b/apps/language_server/lib/language_server/providers/rename.ex @@ -144,10 +144,9 @@ defmodule ElixirLS.LanguageServer.Providers.Rename do end defp get_char_ident(text, line, character) do - case Code.Fragment.surround_context(text, {line, character}) do - %{context: {context, char_ident}} when context in [:local_or_var, :local_call] -> char_ident - %{context: {:dot, _, char_ident}} -> char_ident - _ -> nil + case get_begin_end_and_char_ident(text, line, character) do + nil -> nil + %{char_ident: char_ident} -> char_ident end end