Skip to content

Stop tracking removed files and modules #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/language_server/lib/language_server/dialyzer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,16 @@ defmodule ElixirLS.LanguageServer.Dialyzer do

{active_plt, new_mod_deps, raw_warnings} = Analyzer.analyze(active_plt, files_to_analyze)

mod_deps = Map.merge(mod_deps, new_mod_deps)
mod_deps = update_mod_deps(mod_deps, new_mod_deps, removed_modules)
warnings = add_warnings(warnings, raw_warnings)

md5 =
for {file, {_, hash}} <- file_changes, into: md5 do
{file, hash}
end

md5 = remove_files(md5, removed_files)

{active_plt, mod_deps, md5, warnings}
end)

Expand All @@ -393,6 +395,17 @@ defmodule ElixirLS.LanguageServer.Dialyzer do
analysis_finished(parent, :ok, active_plt, mod_deps, md5, warnings, timestamp, build_ref)
end

defp update_mod_deps(mod_deps, new_mod_deps, removed_modules) do
mod_deps
|> Map.merge(new_mod_deps)
|> Map.drop(removed_modules)
|> Map.new(fn {mod, deps} -> {mod, deps -- removed_modules} end)
end

defp remove_files(md5, removed_files) do
Map.drop(md5, removed_files)
end

defp add_warnings(warnings, raw_warnings) do
new_warnings =
for {_, {file, line, m_or_mfa}, _} = warning <- raw_warnings,
Expand Down