Skip to content

Commit a38967b

Browse files
committed
Apply review suggestions
1 parent 7991e48 commit a38967b

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

lib/bundlex/lsp/config.ex

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ defmodule Bundlex.LSP.Config do
3939
[]
4040
end
4141

42-
# Root compile_flags.txt with flags common to all variants written to project root only,
43-
# avoiding pollution of VCS-tracked source directories.
44-
maybe_root_flags =
42+
maybe_compile_flags =
4543
case write_compile_flags_txt(common_flags, project_dir) do
4644
{:ok, path} ->
4745
[{:compile_flags_txt, path}]
@@ -51,21 +49,18 @@ defmodule Bundlex.LSP.Config do
5149
[]
5250
end
5351

54-
case maybe_commands ++ maybe_root_flags do
52+
case maybe_commands ++ maybe_compile_flags do
5553
[] -> {:error, "No configuration files were generated"}
5654
generated -> {:ok, generated}
5755
end
5856
end
5957

6058
defp parse_compile_commands(commands, project_dir) do
61-
entries =
59+
{compile_commands, all_flag_sets} =
6260
commands
6361
|> Enum.reject(&skip_command?/1)
6462
|> Enum.flat_map(&parse_entry(&1, project_dir))
65-
66-
compile_commands = Enum.map(entries, &elem(&1, 0))
67-
68-
all_flag_sets = Enum.map(entries, &elem(&1, 1))
63+
|> Enum.unzip()
6964

7065
common_flags =
7166
case all_flag_sets do

0 commit comments

Comments
 (0)