File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed
apps/language_server/lib/language_server Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -62,28 +62,31 @@ defmodule ElixirLS.LanguageServer.Build do
62
62
mixfile = Path . absname ( MixfileHelpers . mix_exs ( ) )
63
63
64
64
if File . exists? ( mixfile ) do
65
- # FIXME: Private API
66
- case Mix.ProjectStack . peek ( ) do
67
- % { file: ^ mixfile , name: module } ->
68
- # FIXME: Private API
69
- Mix.Project . pop ( )
70
- purge_module ( module )
71
-
72
- _ ->
73
- :ok
65
+ if module = Mix.Project . get ( ) do
66
+ # FIXME: Private API
67
+ Mix.Project . pop ( )
68
+ purge_module ( module )
74
69
end
75
70
76
- Mix.Task . clear ( )
77
-
78
- # Override build directory to avoid interfering with other dev tools
71
+ # We need to clear persistent cache, otherwise `deps.loadpaths` task fails with
72
+ # (Mix.Error) Can't continue due to errors on dependencies
73
+ # see https://github.com/elixir-lsp/elixir-ls/issues/120
74
+ # originally reported in https://github.com/JakeBecker/elixir-ls/issues/71
75
+ # Note that `Mix.State.clear_cache()` is not enough (at least on elixir 1.14)
79
76
# FIXME: Private API
80
- Mix.ProjectStack . post_config ( build_path: ".elixir_ls/build" )
77
+ Mix.Dep . clear_cached ( )
78
+
79
+ Mix.Task . clear ( )
81
80
82
81
# we need to reset compiler options
83
82
# project may leave tracers after previous compilation and we don't woant them interfeering
84
83
# see https://github.com/elixir-lsp/elixir-ls/issues/717
85
84
set_compiler_options ( )
86
85
86
+ # Override build directory to avoid interfering with other dev tools
87
+ # FIXME: Private API
88
+ Mix.ProjectStack . post_config ( build_path: ".elixir_ls/build" )
89
+
87
90
# We can get diagnostics if Mixfile fails to load
88
91
{ status , diagnostics } =
89
92
case Kernel.ParallelCompiler . compile ( [ mixfile ] ) do
You can’t perform that action at this time.
0 commit comments