Open
Description
Elixir and Erlang/OTP versions
❯ elixir --version
Erlang/OTP 27 [erts-15.1.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Elixir 1.17.3 (compiled with Erlang/OTP 27)
Operating system
Arch Linux x86_64 6.12.1-arch1-1
Current behavior
%{context: {:sigil, ~c"D"}, begin: {1, 1}, end: {1, 3}}
iex [ :: 24] > Code.Fragment.surround_context("~D[2025-01-01]", {1, 2})
%{context: {:sigil, ~c"D"}, begin: {1, 1}, end: {1, 3}}
iex [ :: 25] > Code.Fragment.surround_context("~D[2025-01-01]", {1, 3})
:none
iex [ :: 26] > Code.Fragment.surround_context("~D[2025-01-01]", {1, 4})
:none
Expected behavior
%{context: {:sigil, ~c"D"}, begin: {1, 1}, end: {1, 12}}
iex [ :: 24] > Code.Fragment.surround_context("~D[2025-01-01]", {1, 2})
%{context: {:sigil, ~c"D"}, begin: {1, 1}, end: {1, 12}}
iex [ :: 25] > Code.Fragment.surround_context("~D[2025-01-01]", {1, 3})
%{context: {:sigil, ~c"D"}, begin: {1, 1}, end: {1, 12}}
iex [ :: 26] > Code.Fragment.surround_context("~D[2025-01-01]", {1, 4})
%{context: {:sigil, ~c"D"}, begin: {1, 1}, end: {1, 12}}
I would expect the surround_context
for a sigil to span the entire body of the sigil. My use case is that I'd like to be able to determine when I'm in a ~H
sigil in elixir-ls
. Should surround_context
return information about the "container" that I am in (this was my take from the docs), or am I mistaking this for another API?