Skip to content

Commit 67a1955

Browse files
committed
run formatter
1 parent 568ca11 commit 67a1955

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

apps/language_server/lib/language_server/server.ex

+1
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ defmodule ElixirLS.LanguageServer.Server do
939939

940940
defp trigger_build(state = %__MODULE__{project_dir: project_dir}) do
941941
build_automatically = Map.get(state.settings || %{}, "autoBuild", true)
942+
942943
cond do
943944
not build_enabled?(state) ->
944945
state

apps/language_server/lib/language_server/source_file.ex

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ defmodule ElixirLS.LanguageServer.SourceFile do
247247
rescue
248248
e ->
249249
message = Exception.message(e)
250+
250251
IO.warn(
251252
"Unable to get formatter options for #{path}: #{inspect(e.__struct__)} #{message}"
252253
)
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
defmodule ElixirLS.LanguageServer.SourceFile.InvalidProjectTest do
2-
32
use ExUnit.Case, async: false
43

54
use Patch
65
alias ElixirLS.LanguageServer.SourceFile
76
import ExUnit.CaptureIO
87

98
describe "formatter_for " do
10-
119
test "should handle syntax errors" do
12-
patch(Mix.Tasks.Format, :formatter_for_file, fn _ -> raise %SyntaxError{file: ".formatter.exs", line: 1} end)
13-
14-
output = capture_io(:stderr, fn ->
15-
assert :error = SourceFile.formatter_for("file:///root.ex")
10+
patch(Mix.Tasks.Format, :formatter_for_file, fn _ ->
11+
raise %SyntaxError{file: ".formatter.exs", line: 1}
1612
end)
1713

14+
output =
15+
capture_io(:stderr, fn ->
16+
assert :error = SourceFile.formatter_for("file:///root.ex")
17+
end)
18+
1819
assert String.contains?(output, "Unable to get formatter options")
1920
end
2021

2122
test "should handle compile errors" do
22-
patch(Mix.Tasks.Format, :formatter_for_file, fn _ -> raise %SyntaxError{file: ".formatter.exs", line: 1} end)
23-
24-
output = capture_io(:stderr, fn ->
25-
assert :error = SourceFile.formatter_for("file:///root.ex")
23+
patch(Mix.Tasks.Format, :formatter_for_file, fn _ ->
24+
raise %SyntaxError{file: ".formatter.exs", line: 1}
2625
end)
2726

27+
output =
28+
capture_io(:stderr, fn ->
29+
assert :error = SourceFile.formatter_for("file:///root.ex")
30+
end)
31+
2832
assert String.contains?(output, "Unable to get formatter options")
2933
end
30-
3134
end
3235
end

0 commit comments

Comments
 (0)