You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/initialization.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@ When launching the elixir_ls server using the scripts, the initialization steps
4
4
5
5
1. Replace default IO with Json RPC notifications
6
6
2. Starts Mix
7
-
3. Starts the :language_server application
7
+
3. Starts the :language_server application
8
8
4. Overrides default Mix.Shell
9
9
5. Ensure the Hex version is accepted
10
-
6. Start receiving requet/responses
10
+
6. Start receiving requests/responses
11
11
7. Gets the "initialize" request
12
12
8. Starts building/analyzing the project
13
13
@@ -23,9 +23,9 @@ The servers delegate the callbacks to the module `ElixirLS.LanguageServer.JsonRp
23
23
24
24
ElixirLS uses standard Mix tooling. It will need this to retrieve project configuration, dependencies and so on. It heavily uses private Mix APIs here to start and retrieve paths for dependencies, archives and so on.
25
25
26
-
## Starts the :language_server application
26
+
## Starts the :language_server application
27
27
28
-
The main entry point for the language server is its application module `ElixirLS.LanguageServer`. It starts a supervisor with a few children.
28
+
The main entry point for the language server is its application module `ElixirLS.LanguageServer`. It starts a supervisor with a few children.
29
29
30
30
The first one is the server itself `ElixirLS.LanguageServer.Server`. This is a named `GenServer` that holds the state for the project. That state has things like:
31
31
@@ -47,7 +47,7 @@ Mix might have some "yes or no" questions that would not be possible to reply in
47
47
48
48
## Ensure the Hex version is accepted
49
49
50
-
Before building the project and start answering requests from the client, it must ensure that the Hex version is correct. If it is not, it might have trouble building things.
50
+
Before building the project and start answering requests from the client, it must ensure that the Hex version is correct. If it is not, it might have trouble building things.
51
51
52
52
This is also a private Mix API.
53
53
@@ -112,11 +112,11 @@ When the language server needs to "reload" the project it must first:
112
112
- compile only the project's `mix.exs` file. This is to ensure it is properly sourced and that it can use it for reading project metadata;
113
113
- ensure that it does not override the server logger config;
114
114
115
-
This process is handled on the private function `reload_project/0`. One interesting trick it uses is that it sets a different build path using `Mix.ProjectStack.post_config/1` (which is a private API). This is the point where it will create a `.elixir_ls` directory on your project.
115
+
This process is handled on the private function `reload_project/0`. One interesting trick it uses is that it sets a different build path using `Mix.ProjectStack.post_config/1` (which is a private API). This is the point where it will create a `.elixir_ls` directory on your project.
116
116
117
117
After reloading, the BEAM instance is free of old code and is ready to fetch/compile/analyze the project.
118
118
119
-
### Analyzing the project
119
+
### Analyzing the project
120
120
121
121
Even after build is finished, things are not yet done. Both ElixirLS and ElixirSense need dialyzer information for some introspection. So, after build is done it sends a message that is handled at `ElixirLS.LanguageServer.Server.handle_build_result/3`.
122
122
@@ -126,6 +126,6 @@ Here is the point in time where it will build the [PLT (a Persistent Lookup Tabl
126
126
127
127
There are many things done in this module. It tries to be smart about analyzing only the modules that have changed. It does that by first checking the integrity of the PLT and then loading all modules from the PLT using `:dialyzer_plt.all_modules/1`.
128
128
129
-
If it finds that there is a difference, than it calculates this difference (using `MapSet`) to separate stale modules from non-stale. Then it delegates do the `ElixirLS.LanguageServer.Dialyzer.Analyzer` module for the proper analysis run.
129
+
If it finds that there is a difference, than it calculates this difference (using `MapSet`) to separate stale modules from non-stale. Then it delegates do the `ElixirLS.LanguageServer.Dialyzer.Analyzer` module for the proper analysis run.
130
130
131
131
In the end it will publish a message that the analysis has finished, which will be delegated all the way back to the server module. There it handles the results accordingly and finally it will be ready to introspect code.
0 commit comments