Skip to content

Commit ee22565

Browse files
drewolsondix
andauthored
Handle formatting files within umbrella applcations (#350)
Signed-off-by: Drew Olson <[email protected]> Co-authored-by: dix <[email protected]>
1 parent 77a251b commit ee22565

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

apps/language_server/lib/language_server/providers/formatting.ex

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,15 @@ defmodule ElixirLS.LanguageServer.Providers.Formatting do
5252
def should_format?(file_uri, project_dir, inputs) when is_list(inputs) do
5353
file = String.trim_leading(file_uri, "file://")
5454

55-
Enum.any?(inputs, fn glob ->
56-
project_dir
57-
|> Path.join(glob)
58-
|> Path.wildcard(match_dot: true)
59-
|> Enum.any?(&(file == &1))
55+
inputs
56+
|> Stream.flat_map(fn glob ->
57+
[
58+
Path.join([project_dir, glob]),
59+
Path.join([project_dir, "apps", "*", glob])
60+
]
6061
end)
62+
|> Stream.flat_map(&Path.wildcard(&1, match_dot: true))
63+
|> Enum.any?(&(file == &1))
6164
end
6265

6366
def should_format?(_file_uri, _project_dir, _inputs), do: true

0 commit comments

Comments
 (0)