Skip to content

Commit bf112aa

Browse files
committed
add comments
1 parent bc8749f commit bf112aa

File tree

1 file changed

+18
-0
lines changed
  • apps/language_server/lib/language_server

1 file changed

+18
-0
lines changed

apps/language_server/lib/language_server/build.ex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ defmodule ElixirLS.LanguageServer.Build do
33
alias ElixirLS.Utils.MixfileHelpers
44
require Logger
55

6+
## Public API
7+
8+
@doc """
9+
Starts the build process for the project at the given `root_path` with the
10+
provided options.
11+
12+
This spawns a separate process (with a monitor on the caller) that performs
13+
the build steps while holding a global build lock.
14+
"""
615
def build(parent, root_path, opts) when is_binary(root_path) do
716
Application.loaded_applications() |> Enum.map(&elem(&1, 0))
817

@@ -67,6 +76,10 @@ defmodule ElixirLS.LanguageServer.Build do
6776
build_pid_reference
6877
end
6978

79+
@doc """
80+
Cleans the project build artifacts (and optionally dependency artifacts)
81+
by reloading the Mix project and running the "clean" task.
82+
"""
7083
def clean(root_path, clean_deps? \\ false) when is_binary(root_path) do
7184
with_build_lock(fn ->
7285
mixfile = SourceFile.Path.absname(MixfileHelpers.mix_exs(), root_path)
@@ -82,10 +95,15 @@ defmodule ElixirLS.LanguageServer.Build do
8295
end)
8396
end
8497

98+
@doc """
99+
Executes the given function `fun` while holding a global build lock.
100+
"""
85101
def with_build_lock(func) do
86102
:global.trans({__MODULE__, self()}, func)
87103
end
88104

105+
## Build Process
106+
89107
# After reloading the project, update deps and (optionally) compile.
90108
defp handle_reloaded_project(parent, mixfile, root_path, mixfile_diagnostics, opts, cached_deps) do
91109
{deps_result, deps_raw_diagnostics} =

0 commit comments

Comments
 (0)