Skip to content

Commit 3fe374e

Browse files
committed
make document symbols provider more robust
1 parent e7c7a54 commit 3fe374e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

apps/language_server/lib/language_server/providers/document_symbols.ex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,15 @@ defmodule ElixirLS.LanguageServer.Providers.DocumentSymbols do
340340
do: Enum.map(info, &build_symbol_information_hierarchical(uri, text, &1))
341341

342342
defp build_symbol_information_hierarchical(uri, text, %Info{} = info) do
343+
selection_location =
344+
if info.selection_location && Keyword.has_key?(info.selection_location, :column) do
345+
info.selection_location
346+
else
347+
info.location
348+
end
349+
343350
selection_range =
344-
location_to_range(info.selection_location || info.location, text, info.symbol)
351+
location_to_range(selection_location, text, info.symbol)
345352

346353
# range must contain selection range
347354
range =

0 commit comments

Comments
 (0)