Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't replace string interpolation #152

Merged
merged 2 commits into from Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir_sense/core/source.ex
Expand Up @@ -170,7 +170,7 @@ defmodule ElixirSense.Core.Source do
|> split_lines
|> Enum.map_join("\n", fn line ->
# this is a naive comment strip - it will not honour # in strings, chars etc
Regex.replace(~r/[^<]\#.*$/, line, "")
Regex.replace(~r/[^<]\#(?!\{).*$/, line, "")
end)

case walk_text(code, acc, &find_subject/5) do
Expand Down
3 changes: 3 additions & 0 deletions test/elixir_sense/core/source_test.exs
Expand Up @@ -917,12 +917,15 @@ defmodule ElixirSense.Core.SourceTest do

:ets. # for performance.
match(:ac_tab, {{:loaded, :"$1"}, :_})

"String \#{inspect("Interpolation")}"
end
end
"""

assert subject(code, 4, 10) == ":ets.match"
assert subject(code, 7, 7) == ":ets.match"
assert subject(code, 9, 18) == "inspect"
end
end

Expand Down