Skip to content

Commit

Permalink
Apply upstream fix for elixir-lang/elixir#12969
Browse files Browse the repository at this point in the history
Fixes #992
  • Loading branch information
lukaszsamson committed Sep 28, 2023
1 parent 2ba0f8a commit 372ef9b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions apps/language_server/lib/language_server/mix_tasks/format.ex
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,15 @@ defmodule Mix.Tasks.ElixirLSFormat do

defp recur_formatter_opts_for_file(file, {formatter_opts, subs}) do
Enum.find_value(subs, formatter_opts, fn {sub, formatter_opts_and_subs} ->
if String.starts_with?(file, sub) do
recur_formatter_opts_for_file(file, formatter_opts_and_subs)
size = byte_size(sub)

case file do
<<prefix::binary-size(size), dir_separator, _::binary>>
when prefix == sub and dir_separator in [?\\, ?/] ->
recur_formatter_opts_for_file(file, formatter_opts_and_subs)

_ ->
nil
end
end)
end
Expand Down

0 comments on commit 372ef9b

Please sign in to comment.