Skip to content

Commit 8b0b7bd

Browse files
authored
fix(commands,pipe): handle erlang modules (#380)
1 parent fb6ed2b commit 8b0b7bd

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/next_ls/commands/pipe.ex

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ defmodule NextLS.Commands.Pipe do
7777
defp parse(lines) do
7878
lines
7979
|> Enum.join("\n")
80-
|> Spitfire.parse()
80+
|> Spitfire.parse(literal_encoder: &{:ok, {:__block__, &2, [&1]}})
8181
|> case do
8282
{:error, ast, _errors} ->
8383
{:ok, ast}
@@ -87,12 +87,6 @@ defmodule NextLS.Commands.Pipe do
8787
end
8888
end
8989

90-
def decorate(code, range) do
91-
code
92-
|> Sourceror.patch_string([%{range: range, change: &#{&1}»"}])
93-
|> String.trim_trailing()
94-
end
95-
9690
defp make_range(original_ast) do
9791
range = Sourceror.get_range(original_ast)
9892

@@ -114,7 +108,7 @@ defmodule NextLS.Commands.Pipe do
114108

115109
if not is_nil(range) and
116110
(match?({{:., _, _}, _, [_ | _]}, node) or
117-
match?({t, _, [_ | _]} when t not in [:., :__aliases__], node)) do
111+
match?({t, _, [_ | _]} when t not in [:., :__aliases__, :__block__, :=], node)) do
118112
if Sourceror.compare_positions(range.start, pos) == :lt &&
119113
Sourceror.compare_positions(range.end, pos) == :gt do
120114
{tree, node}

0 commit comments

Comments
 (0)